Class: DaemonKit::Generators::AppGenerator
- Inherits:
-
Base
show all
- Defined in:
- lib/generators/daemon_kit/app/app_generator.rb
Constant Summary
collapse
- INSTALLERS =
%w( default amqp cron nanite_agent ruote xmpp )
- DEPLOYERS =
%w( capistrano )
- TEST_FRAMEWORKS =
%w( none rspec test_unit )
Instance Attribute Summary
#behavior
Attributes included from Thor::Base
#options
Instance Method Summary
collapse
Methods inherited from Base
desc
#action, #append_file, #apply, #chmod, #copy_file, #create_file, #destination_root, #destination_root=, #directory, #empty_directory, #find_in_source_paths, #get, #gsub_file, #in_root, included, #inject_into_class, #inject_into_file, #inside, #prepend_file, #relative_to_original_destination_root, #remove_file, #run, #run_ruby_script, #source_paths, #template, #thor
Methods inherited from Thor::Group
class_options_help, desc, get_options_from_invocations, handle_argument_error, help, invocation_blocks, invocations, invoke, invoke_from_option, printable_tasks, remove_invocation, start
Methods included from Thor::Base
included, register_klass_file, shell, shell=, subclass_files, subclasses
Constructor Details
Returns a new instance of AppGenerator.
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 23
def initialize( *args )
super
unless INSTALLERS.include?( options[:installer] )
raise Error, "Invalid value for --installer option. Supported installers are: #{INSTALLERS.join(', ')}"
end
if options[:deployer] && !DEPLOYERS.include?( options[:deployer] )
raise Error, "Invalid value for --deployer option. Supported deployers are: #{DEPLOYERS.join(', ')}"
end
unless TEST_FRAMEWORKS.include?( options[:test_framework] )
raise Error, "Invalid value for --test_framework option. Supported frameworks are: #{TEST_FRAMEWORKS.join(', ')}"
end
end
|
Instance Method Details
#create_bin_files ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 51
def create_bin_files
empty_directory 'bin'
template 'bin/daemon.tt', "bin/#{app_name}" do |content|
"#{shebang}\n" + content
end
chmod "bin", 0755, :verbose => false
end
|
#create_config_files ⇒ Object
59
60
61
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 59
def create_config_files
directory 'config'
end
|
#create_cucumber ⇒ Object
127
128
129
130
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 127
def create_cucumber
return unless options.cucumber?
invoke DaemonKit::Generators::CucumberGenerator
end
|
#create_deployment_config ⇒ Object
107
108
109
110
111
112
113
114
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 107
def create_deployment_config
return unless options[:deployer]
case options[:deployer]
when 'capistrano'
invoke DaemonKit::Generators::CapistranoGenerator
end
end
|
#create_lib_files ⇒ Object
86
87
88
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 86
def create_lib_files
directory 'lib'
end
|
#create_log_directory ⇒ Object
74
75
76
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 74
def create_log_directory
empty_directory 'log'
end
|
#create_root ⇒ Object
39
40
41
42
43
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 39
def create_root
self.destination_root = File.expand_path( app_path, destination_root )
empty_directory('.')
FileUtils.cd( destination_root )
end
|
#create_root_files ⇒ Object
45
46
47
48
49
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 45
def create_root_files
template 'README.tt', 'README'
copy_file 'Rakefile'
copy_file 'Gemfile'
end
|
#create_script_files ⇒ Object
63
64
65
66
67
68
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 63
def create_script_files
directory 'script' do |content|
"#{shebang}\n" + content
end
chmod 'script', 0755, :verbose => false
end
|
#create_task_directory ⇒ Object
70
71
72
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 70
def create_task_directory
empty_directory 'tasks'
end
|
#create_test_environment ⇒ Object
#create_tmp_directory ⇒ Object
78
79
80
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 78
def create_tmp_directory
empty_directory 'tmp'
end
|
#create_vendor_directory ⇒ Object
82
83
84
|
# File 'lib/generators/daemon_kit/app/app_generator.rb', line 82
def create_vendor_directory
empty_directory 'vendor'
end
|