Sha256: 71c5ebfef4615554ee024f0d4b3eb6a1d3523f104e1d08899280a18b03570d81

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 Bytes

Contents

require File.expand_path('../command', File.dirname(__FILE__))

module Nesta
  module Commands
    module Theme
      class Install
        include Command

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

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nesta-0.12.0 lib/nesta/commands/theme/install.rb