Class: Tap::Generator::Generators::RootGenerator

Inherits:
Base show all
Defined in:
lib/tap/generator/generators/root/root_generator.rb

Overview

:startdoc: Tap::Generator::Generators::RootGenerator::generator a basic tap directory structure

Generates a tap root directory structure. Use the switches to generate a Tapfile and/or a tap config file:

root
|- Rakefile
|- lib
|- sample.gemspec
|- tap.yml
|- Tapfile
`- test
    |- tap_test_helper.rb
    |- tap_test_suite.rb
    `- tapfile_test.rb

Constant Summary

Constants inherited from Base

Base::Constant

Constants inherited from Task

Task::DEFAULT_HELP_TEMPLATE

Instance Attribute Summary

Attributes inherited from Base

#file_task, #target_dir, #template_dir

Attributes inherited from Task

#name

Attributes included from Support::Executable

#_method_name, #app, #batch, #dependencies, #on_complete_block

Attributes included from Support::Configurable

#config

Instance Method Summary collapse

Methods inherited from Base

#directories, #directory, #file, #initialize, #iterate, lazydoc, #log_relative, #process, #template, #template_files

Methods inherited from Task

execute, help, inherited, #initialize, #initialize_batch_obj, #inspect, instance, intern, lazydoc, #log, parse, parse!, #process, #to_s

Methods included from Support::Executable

#_execute, #batch_index, #batch_with, #batched?, #check_terminate, #depends_on, #enq, #execute, #fork, initialize, #initialize_batch_obj, #inspect, #merge, #on_complete, #reset_dependencies, #resolve_dependencies, #sequence, #switch, #sync_merge, #unbatched_depends_on, #unbatched_enq, #unbatched_on_complete

Methods included from Support::Configurable

included, #initialize_copy, #reconfigure

Constructor Details

This class inherits a constructor from Tap::Generator::Base

Instance Method Details

#manifest(m, root, project_name = nil) ⇒ Object

::args ROOT, PROJECT_NAME=basename(ROOT)



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/tap/generator/generators/root/root_generator.rb', line 27

def manifest(m, root, project_name=nil)
  r = Tap::Root.new(root)
  project_name = File.basename(r.root) if project_name == nil
  
  m.directory r.root
  m.directory r['lib']
  
  template_files do |source, target|
    case
    when File.directory?(source)
      m.directory r[target]
      next
    when target == 'gemspec'
      m.template r[project_name + '.gemspec'], source, :project_name => project_name, :tapfile => tapfile, :config_file => config_file
      next
    when target =~ /tapfile/i
      next unless tapfile
    end
    
    m.template r[target], source, :project_name => project_name
  end
  
  m.file(r['tap.yml']) do |file|
   Tap::App.configurations.inspect(:doc, file) do |templater|
     next unless templater.receiver == Tap::Root
      
     templater.configurations.each do |(key, config)| 
       config.default = nil if key.to_s == 'root'
     end
   end
   Tap::Env.configurations.inspect(:doc, file)
  end if config_file
end