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
27 28 29 |
# File 'lib/dugway/cli/build.rb', line 27 def self.destination_root File.join(Dir.pwd, 'build') end |
.source_root ⇒ Object
23 24 25 |
# File 'lib/dugway/cli/build.rb', line 23 def self.source_root File.join(Dir.pwd, 'source') end |
Instance Method Details
#build ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/dugway/cli/build.rb', line 55 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
51 52 53 |
# File 'lib/dugway/cli/build.rb', line 51 def create_destination empty_directory self.class.destination_root end |
#success ⇒ Object
65 66 67 |
# File 'lib/dugway/cli/build.rb', line 65 def success say_status(:create, "build/#{ build_name }") end |
#validate ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/dugway/cli/build.rb', line 31 def validate = { validate_colors: !['skip-color-validation'], validate_layout_attributes: !['skip-layout-attribute-validation'], validate_options: !['skip-options-validation'] } is_valid = theme.valid?(**) unless theme.warnings.empty? theme.warnings.each { |warning| say(warning, :yellow) } end unless is_valid theme.errors.each { |error| say(error, :red) } say("\nTheme is invalid", :red) exit(1) end end |