Class: Nesta::Commands::Theme::Install
- Inherits:
-
Object
- Object
- Nesta::Commands::Theme::Install
- Defined in:
- lib/nesta/commands/theme/install.rb
Instance Method Summary collapse
- #enable(process) ⇒ Object
- #execute(process) ⇒ Object
-
#initialize(*args) ⇒ Install
constructor
A new instance of Install.
- #theme_name ⇒ Object
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')) = 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_name ⇒ Object
11 12 13 |
# File 'lib/nesta/commands/theme/install.rb', line 11 def theme_name File.basename(@url, '.git').sub(/nesta-theme-/, '') end |