Module: Simplate::Command
- Defined in:
- lib/simplate/modules/command.rb
Constant Summary collapse
- @@app_name =
''- @@root_path =
''
Class Method Summary collapse
- .app_name ⇒ Object
- .app_name=(value) ⇒ Object
- .copy_file(filename) ⇒ Object
- .executables(app_name) ⇒ Object
- .prepare(app_name) ⇒ Object
- .root_path ⇒ Object
Class Method Details
.app_name ⇒ Object
10 11 12 |
# File 'lib/simplate/modules/command.rb', line 10 def Command.app_name @@app_name end |
.app_name=(value) ⇒ Object
14 15 16 |
# File 'lib/simplate/modules/command.rb', line 14 def Command.app_name=(value) @@app_name = value end |
.copy_file(filename) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/simplate/modules/command.rb', line 44 def Command.copy_file(filename) case filename when "Gemfile" from = Command.root_path.join('lib/simplate/copies/Gemfile') to = Command.app_name + '/Gemfile' "cp #{from} #{to}" when "spec_helper.rb" from = Command.root_path.join('lib/simplate/copies/spec_helper.rb') to = Command.app_name + '/spec/spec_helper.rb' "cp #{from} #{to}" end end |
.executables(app_name) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/simplate/modules/command.rb', line 26 def Command.executables(app_name) Command.app_name = app_name executables = [] executables << "mkdir #{app_name}" executables << "mkdir #{app_name}/lib" executables << "mkdir #{app_name}/lib/models" executables << "mkdir #{app_name}/lib/modules" executables << "mkdir #{app_name}/spec" executables << "mkdir #{app_name}/spec/models" executables << "mkdir #{app_name}/spec/modules" executables << Command.copy_file('Gemfile') executables << Command.copy_file('spec_helper.rb') executables end |
.prepare(app_name) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/simplate/modules/command.rb', line 18 def Command.prepare(app_name) @@app_name = app_name Command.executables(app_name).each do |c| `#{c}` end end |
.root_path ⇒ Object
6 7 8 |
# File 'lib/simplate/modules/command.rb', line 6 def Command.root_path Pathname.new(File.dirname(__FILE__)).parent.parent.parent end |