Class: Dugway::Cli::Build
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Dugway::Cli::Build
- Includes:
- Thor::Actions
- Defined in:
- lib/dugway/cli/build.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.destination_root ⇒ Object
12 13 14 |
# File 'lib/dugway/cli/build.rb', line 12 def self.destination_root File.join(Dir.pwd, 'build') end |
.source_root ⇒ Object
8 9 10 |
# File 'lib/dugway/cli/build.rb', line 8 def self.source_root File.join(Dir.pwd, 'source') end |
Instance Method Details
#build ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/dugway/cli/build.rb', line 27 def build Zip::ZipFile.open(build_file, Zip::ZipFile::CREATE) { |zipfile| theme.files.each { |file| zipfile.get_output_stream(file) { |f| f << theme.build_file(file) } } } end |
#create_destination ⇒ Object
23 24 25 |
# File 'lib/dugway/cli/build.rb', line 23 def create_destination empty_directory self.class.destination_root end |
#success ⇒ Object
37 38 39 |
# File 'lib/dugway/cli/build.rb', line 37 def success say_status(:create, "build/#{ build_name }") end |
#validate ⇒ Object
16 17 18 19 20 21 |
# File 'lib/dugway/cli/build.rb', line 16 def validate unless theme.valid? theme.errors.each { |error| say(error, :red) } raise "Theme is invalid" end end |