Class: Nesta::Commands::Theme::Create
- Inherits:
-
Object
- Object
- Nesta::Commands::Theme::Create
- Includes:
- Command
- Defined in:
- lib/nesta/commands.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(*args) ⇒ Create
constructor
A new instance of Create.
- #make_directories ⇒ Object
Methods included from Command
#copy_template, #copy_templates, #fail, #template_root, #update_config_yaml
Constructor Details
#initialize(*args) ⇒ Create
Returns a new instance of Create.
232 233 234 235 236 237 238 239 |
# File 'lib/nesta/commands.rb', line 232 def initialize(*args) name = args.shift = args.shift || {} name.nil? && (raise UsageError.new('name not specified')) @name = name @theme_path = Nesta::Path.themes(@name) fail("#{@theme_path} already exists") if File.exist?(@theme_path) end |
Instance Method Details
#execute ⇒ Object
246 247 248 249 250 251 252 253 254 255 |
# File 'lib/nesta/commands.rb', line 246 def execute make_directories copy_templates( 'themes/README.md' => "#{@theme_path}/README.md", 'themes/app.rb' => "#{@theme_path}/app.rb", 'themes/views/layout.haml' => "#{@theme_path}/views/layout.haml", 'themes/views/page.haml' => "#{@theme_path}/views/page.haml", 'themes/views/master.sass' => "#{@theme_path}/views/master.sass" ) end |
#make_directories ⇒ Object
241 242 243 244 |
# File 'lib/nesta/commands.rb', line 241 def make_directories FileUtils.mkdir_p(File.join(@theme_path, 'public', @name)) FileUtils.mkdir_p(File.join(@theme_path, 'views')) end |