Class: Dugway::Cli::Build

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/dugway/cli/build.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.destination_rootObject



12
13
14
# File 'lib/dugway/cli/build.rb', line 12

def self.destination_root
  File.join(Dir.pwd, 'build')
end

.source_rootObject



8
9
10
# File 'lib/dugway/cli/build.rb', line 8

def self.source_root
  File.join(Dir.pwd, 'source')
end

Instance Method Details

#buildObject



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) do |zipfile|
    theme.files.each do |file|
      zipfile.get_output_stream(file) do |f|
        f << theme.build_file(file)
      end
    end
  end
end

#create_destinationObject



23
24
25
# File 'lib/dugway/cli/build.rb', line 23

def create_destination
  empty_directory self.class.destination_root
end

#successObject



37
38
39
# File 'lib/dugway/cli/build.rb', line 37

def success
  say_status(:create, "build/#{ build_name }")
end

#validateObject



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