Class: Nesta::Commands::Theme::Install

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/nesta/commands.rb

Instance Method Summary collapse

Methods included from Command

#copy_template, #copy_templates, #fail, #template_root, #update_config_yaml

Constructor Details

#initialize(*args) ⇒ Install

Returns a new instance of Install.



261
262
263
264
265
266
267
# File 'lib/nesta/commands.rb', line 261

def initialize(*args)
  url = args.shift
  options = args.shift || {}
  url.nil? && (raise UsageError.new('URL not specified'))
  @url = url
  @name = File.basename(url, '.git').sub(/nesta-theme-/, '')
end

Instance Method Details

#enableObject



275
276
277
# File 'lib/nesta/commands.rb', line 275

def enable
  Enable.new(@name).execute
end

#executeObject



269
270
271
272
273
# File 'lib/nesta/commands.rb', line 269

def execute
  system('git', 'clone', @url, "themes/#{@name}")
  FileUtils.rm_r(File.join("themes/#{@name}", '.git'))
  enable
end