class Inkcite::Cli::Base

Public Instance Methods

build() click to toggle source
# File lib/inkcite/cli/base.rb, line 25
def build
  require_relative 'build'
  Cli::Build.invoke(email, options)
end
imageoptim() click to toggle source
# File lib/inkcite/cli/base.rb, line 53
def imageoptim

  if options[:image]
    ImageMinifier.minify(email, options[:image], true)

  else
    ImageMinifier.minify_all(email, options[:force])

    original_size = Util.dir_size(email.image_dir)
    compressed_size = Util.dir_size(email.optimized_image_dir)
    compressed_percent = ImageMinifier.compressed_percent(original_size, compressed_size)
    image_count = Dir.glob(File.join(email.optimized_image_dir, '*.*')).count

    puts "Compressed #{image_count} images from #{Util.pretty_file_size(original_size)} to #{Util.pretty_file_size(compressed_size)} (#{compressed_percent}%)"
  end

end
init(name) click to toggle source
# File lib/inkcite/cli/base.rb, line 39
def init name
  require_relative 'init'
  Cli::Init.invoke(name, options)
end
preview(list=:developer) click to toggle source
# File lib/inkcite/cli/base.rb, line 82
def preview list=:developer
  require_relative 'preview'
  Cli::Preview.invoke(email, list, options)
end
scope() click to toggle source
# File lib/inkcite/cli/base.rb, line 91
def scope
  require_relative 'scope'
  Cli::Scope.invoke(email, options)
end
server() click to toggle source
# File lib/inkcite/cli/base.rb, line 119
def server
  require_relative 'server'

  Cli::Server.start(email, {
      :environment => environment,
      :format => format,
      :host => options['host'],
      :port => options['port'],
      :version => version
  })

end
test() click to toggle source
# File lib/inkcite/cli/base.rb, line 139
def test
  require_relative 'test'
  Cli::Test.invoke(email, options)
end
upload() click to toggle source
# File lib/inkcite/cli/base.rb, line 152
def upload
  email.upload options
end

Private Instance Methods

email() click to toggle source
# File lib/inkcite/cli/base.rb, line 164
def email
  Email.new(Dir.pwd)
end
environment() click to toggle source

Resolves the desired environment (e.g. :development or :preview) from Thor's commandline options.

# File lib/inkcite/cli/base.rb, line 160
def environment
  options['environment'] || :development
end
format() click to toggle source

Resolves the desired format (e.g. :browser or :email) from Thor's commandline options.

# File lib/inkcite/cli/base.rb, line 170
def format
  options['format'] || :email
end
version() click to toggle source

Resolves the desired version (typically blank or :default) from Thor's commandline options.

# File lib/inkcite/cli/base.rb, line 176
def version
  options['version']
end
view() click to toggle source
# File lib/inkcite/cli/base.rb, line 180
def view
  email.view(environment, format, version)
end