forked from ddollar/foreman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
239 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
source "http://rubygems.org" | ||
|
||
gemspec | ||
|
||
group :development do | ||
gem 'parka' | ||
gem 'rake' | ||
gem 'ronn' | ||
gem 'fakefs', '~> 0.2.1' | ||
gem 'rcov', '~> 0.9.8' | ||
gem 'rr', '~> 1.0.2' | ||
gem 'rspec', '~> 2.6.0' | ||
gem "rubyzip" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
file pkg("foreman-#{version}.gem") => distribution_files do |t| | ||
sh "gem build foreman.gemspec" | ||
sh "mv foreman-#{version}.gem #{t.name}" | ||
end | ||
|
||
task "gem:build" => pkg("foreman-#{version}.gem") | ||
|
||
task "gem:clean" do | ||
clean pkg("foreman-#{version}.gem") | ||
end | ||
|
||
task "gem:release" => "gem:build" do |t| | ||
sh "parka push -f #{pkg("foreman-#{version}.gem")}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
require "erb" | ||
|
||
file pkg("foreman-#{version}.pkg") => distribution_files do |t| | ||
tempdir do |dir| | ||
mkchdir("foreman") do | ||
assemble_distribution | ||
assemble_gems | ||
assemble resource("pkg/foreman"), "bin/foreman", 0755 | ||
end | ||
|
||
kbytes = %x{ du -ks foreman | cut -f 1 } | ||
num_files = %x{ find foreman | wc -l } | ||
|
||
mkdir_p "pkg" | ||
mkdir_p "pkg/Resources" | ||
mkdir_p "pkg/foreman-#{version}.pkg" | ||
|
||
dist = File.read(resource("pkg/Distribution.erb")) | ||
dist = ERB.new(dist).result(binding) | ||
File.open("pkg/Distribution", "w") { |f| f.puts dist } | ||
|
||
dist = File.read(resource("pkg/PackageInfo.erb")) | ||
dist = ERB.new(dist).result(binding) | ||
File.open("pkg/foreman-#{version}.pkg/PackageInfo", "w") { |f| f.puts dist } | ||
|
||
mkdir_p "pkg/foreman-#{version}.pkg/Scripts" | ||
cp resource("pkg/postinstall"), "pkg/foreman-#{version}.pkg/Scripts/postinstall" | ||
chmod 0755, "pkg/foreman-#{version}.pkg/Scripts/postinstall" | ||
|
||
sh %{ mkbom -s foreman pkg/foreman-#{version}.pkg/Bom } | ||
|
||
Dir.chdir("foreman") do | ||
sh %{ pax -wz -x cpio . > ../pkg/foreman-#{version}.pkg/Payload } | ||
end | ||
|
||
sh %{ pkgutil --flatten pkg foreman-#{version}.pkg } | ||
|
||
cp_r "foreman-#{version}.pkg", t.name | ||
end | ||
end | ||
|
||
task "pkg:build" => pkg("foreman-#{version}.pkg") | ||
|
||
task "pkg:clean" do | ||
clean pkg("foreman-#{version}.pkg") | ||
end | ||
|
||
task "pkg:release" => "pkg:build" do |t| | ||
store pkg("foreman-#{version}.pkg"), "foreman/foreman-#{version}.pkg" | ||
store pkg("foreman-#{version}.pkg"), "foreman/foreman-beta.pkg" if beta? | ||
store pkg("foreman-#{version}.pkg"), "foreman/foreman.pkg" unless beta? | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "pathname" | ||
bin_file = Pathname.new(__FILE__).realpath | ||
|
||
gem_dir = File.expand_path("../vendor/gems", bin_file) | ||
Dir["#{gem_dir}/**/lib"].each do |libdir| | ||
$:.unshift libdir | ||
end | ||
|
||
$:.unshift File.expand_path("../lib", bin_file) | ||
|
||
require "foreman/cli" | ||
|
||
Foreman::CLI.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
file pkg("foreman-#{version}.tgz") => distribution_files do |t| | ||
tempdir do |dir| | ||
mkchdir("foreman") do | ||
assemble_distribution | ||
assemble_gems | ||
rm_rf "bin" | ||
assemble resource("tgz/foreman"), "foreman", 0755 | ||
end | ||
|
||
sh "tar czvf #{t.name} foreman" | ||
end | ||
end | ||
|
||
task "tgz:build" => pkg("foreman-#{version}.tgz") | ||
|
||
task "tgz:clean" do | ||
clean pkg("foreman-#{version}.tgz") | ||
end | ||
|
||
task "tgz:release" => "tgz:build" do |t| | ||
store pkg("foreman-#{version}.tgz"), "foreman/foreman-#{version}.tgz" | ||
store pkg("foreman-#{version}.tgz"), "foreman/foreman-beta.tgz" if beta? | ||
store pkg("foreman-#{version}.tgz"), "foreman/foreman.tgz" unless beta? | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Foreman | ||
module Distribution | ||
def self.files | ||
Dir[File.expand_path("../../../{bin,data,lib}/**/*", __FILE__)].select do |file| | ||
File.file?(file) | ||
end | ||
end | ||
end | ||
end |