Class: Ki::Cli::AppGenerator
Instance Method Summary
collapse
Methods inherited from KiGenerator
requires_ki_directory, source_root
Instance Method Details
#create_app ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/ki/ki_cli.rb', line 39
def create_app
directory('spec/examples/base', app_name)
config_file = File.read("#{app_name}/config.yml")
config_file.gsub!('name: np_development', "name: #{app_name}_development")
config_file.gsub!('name: np_test', "name: #{app_name}_test")
config_file.gsub!('name: np', "name: #{app_name}")
File.open("#{app_name}/config.yml", 'w') { |file| file.puts config_file }
`echo #{app_name} > #{app_name}/.ruby-gemset`
end
|
#prepare_dir ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/ki/ki_cli.rb', line 25
def prepare_dir
unless app_name =~ /^[a-zA-Z0-9-]*$/
say 'App name must contain only alphanumeric characters and -'
exit 1
end
if Dir.exist? app_name
say "#{app_name} already exists"
exit 2
end
Dir.mkdir app_name
end
|