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(url, options = {}) ⇒ Install

Returns a new instance of Install.



161
162
163
164
165
# File 'lib/nesta/commands.rb', line 161

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

Instance Method Details

#executeObject



167
168
169
170
171
# File 'lib/nesta/commands.rb', line 167

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