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

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

Instance Method Summary collapse

Methods included from Command

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

Constructor Details

#initialize(*args) ⇒ Install


9
10
11
12
13
# File 'lib/nesta/commands/theme/install.rb', line 9

def initialize(*args)
  @url = args.shift
  @url.nil? && (raise UsageError.new('URL not specified'))
  options = args.shift || {}
end

Instance Method Details

#enableObject


25
26
27
# File 'lib/nesta/commands/theme/install.rb', line 25

def enable
  Enable.new(theme_name).execute
end

#executeObject


19
20
21
22
23
# File 'lib/nesta/commands/theme/install.rb', line 19

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

#theme_nameObject


15
16
17
# File 'lib/nesta/commands/theme/install.rb', line 15

def theme_name
  File.basename(@url, '.git').sub(/nesta-theme-/, '')
end