class Omnibus::CLI

Public Instance Methods

build(name) click to toggle source
# File lib/omnibus/cli.rb, line 78
def build(name)
  manifest = if @options[:use_manifest]
               Omnibus::Manifest.from_file(@options[:use_manifest])
             else
               nil
             end

  project = Project.load(name, manifest)
  say("Building #{project.name} #{project.build_version}...")
  Omnibus::S3Cache.populate if @options[:populate_s3_cache] && !Omnibus::S3Cache.fetch_missing.empty?
  begin
    project.download
  rescue
    Config.use_s3_caching(false) if Config.use_s3_caching
    project = Project.load(name, nil)
    project.download
  end
  project.build

  if @options[:output_manifest]
    FileUtils.mkdir_p("pkg")
    File.open(::File.join("pkg", "version-manifest.json"), "w") do |f|
      f.write(FFI_Yajl::Encoder.encode(project.built_manifest.to_hash, pretty: true))
    end
  end
end
list() click to toggle source
# File lib/omnibus/cli.rb, line 168
def list
  if Omnibus.projects.empty?
    say("There are no Omnibus projects!")
  else
    say("Omnibus projects:")
    Omnibus.projects.sort.each do |project|
      say("  * #{project.name} (#{project.build_version})")
    end
  end
end
manifest(name) click to toggle source
# File lib/omnibus/cli.rb, line 128
def manifest(name)
  # Override ohai information
  Ohai["os"] = @options[:os] if @options[:os]
  Ohai["platform_family"] = @options[:platform_family] if @options[:platform_family]
  Ohai["platform"] = @options[:platform] if @options[:platform]
  Ohai["platform_version"] = @options[:platform_version] if @options[:platform_version]
  Ohai["kernel"]["machine"] = @options[:architecture] if @options[:architecture]
  puts FFI_Yajl::Encoder.encode(Project.load(name).built_manifest.to_hash, pretty: true)
end
version() click to toggle source
# File lib/omnibus/cli.rb, line 193
def version
  say("Omnibus v#{Omnibus::VERSION}")
end