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
22 23 24 |
# File 'lib/dugway/cli/build.rb', line 22 def self.destination_root File.join(Dir.pwd, 'build') end |
.source_root ⇒ Object
18 19 20 |
# File 'lib/dugway/cli/build.rb', line 18 def self.source_root File.join(Dir.pwd, 'source') end |
Instance Method Details
#build ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/dugway/cli/build.rb', line 38 def build Zip::ZipFile.open(build_file, Zip::ZipFile::CREATE) do |zipfile| theme.files.each do |file| zipfile.get_output_stream(file) do |f| f << theme.build_file(file) end end end end |
#create_destination ⇒ Object
34 35 36 |
# File 'lib/dugway/cli/build.rb', line 34 def create_destination empty_directory self.class.destination_root end |
#success ⇒ Object
48 49 50 |
# File 'lib/dugway/cli/build.rb', line 48 def success say_status(:create, "build/#{ build_name }") end |
#validate ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/dugway/cli/build.rb', line 26 def validate unless theme.valid?(validate_colors: !['skip-color-validation'], validate_layout_attributes: !['skip-layout-attribute-validation']) theme.errors.each { |error| say(error, :red) } say("\nTheme is invalid", :red) exit(1) end end |