Class: Inkcite::Cli::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/inkcite/cli/build.rb

Class Method Summary collapse

Class Method Details

.invoke(email, opts) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/inkcite/cli/build.rb', line 5

def self.invoke email, opts

  errors = false

  # Don't allow production files to be built if there are errors.
  email.views(opts[:environment]) do |ev|

    ev.render!
    next if ev.errors.blank?

    puts "The #{ev.version} version (#{ev.format}) has #{ev.errors.size} errors:"
    puts " - #{ev.errors.join("\n - ")}"
    errors = true

  end

  abort('Fix errors or use --force to build') if errors && !opts[:force]

  # First, compile all assets to the build directory.
  build_to_dir email, opts

  # Compress the directory into an archive if so desired.
  archive = opts[:archive]
  build_archive(email, opts) unless archive.blank?

end