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

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

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Install

Returns a new instance of Install.



5
6
7
8
9
# File 'lib/nesta/commands/theme/install.rb', line 5

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

Instance Method Details

#enable(process) ⇒ Object



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

def enable(process)
  Enable.new(theme_name).execute(process)
end

#execute(process) ⇒ Object



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

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

#theme_nameObject



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

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