lib/locomotive/wagon/generators/site/unzip.rb in locomotivecms_wagon-1.4.0 vs lib/locomotive/wagon/generators/site/unzip.rb in locomotivecms_wagon-1.5.0.rc1
- old
+ new
@@ -6,17 +6,21 @@
module Generators
module Site
class Unzip < Base
+ class_option :location, type: :string, default: nil, required: false, desc: 'Location of the zip file'
+
+ @@source_root = nil
+
def prepare
remove_file join('tmp')
empty_directory join('tmp')
end
def ask_for_location
- @location = ask('What is the location (on the filesystem or url) of the zip file ?')
+ @location = options[:location] || ask('What is the location (on the filesystem or url) of the zip file ?')
raise GeneratorException.new('Please enter a location') if @location.blank?
end
def download_or_copy
@template_path = join('tmp', File.basename(@location))
@@ -53,10 +57,14 @@
self.class.source_root = File.expand_path(join('tmp', @path, '/'))
say "copying files from #{self.class.source_root} / #{self.destination}"
directory('.', self.destination, { recursive: true })
end
+ def bundle_install
+ super
+ end
+
def self.source_root
# only way to change the source root from the instance
@@source_root
end
@@ -71,10 +79,10 @@
end
end
Locomotive::Wagon::Generators::Site.register(:unzip, Unzip, %{
- Unzip a local or remote (http, https, ftp) zipped LocomotiveCMS site.
+ Unzip a local or remote (http, https, ftp) zipped site.
})
end
end
end
end
\ No newline at end of file