pkgr 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/pkgr/builder.rb +15 -2
- data/lib/pkgr/cli.rb +3 -2
- data/lib/pkgr/config.rb +28 -0
- data/lib/pkgr/dispatcher.rb +0 -2
- data/lib/pkgr/distributions/debian.rb +2 -0
- data/lib/pkgr/version.rb +1 -1
- metadata +2 -2
data/lib/pkgr/builder.rb
CHANGED
@@ -17,9 +17,10 @@ module Pkgr
|
|
17
17
|
|
18
18
|
# Launch the full packaging procedure
|
19
19
|
def call
|
20
|
+
extract
|
21
|
+
update_config
|
20
22
|
check
|
21
23
|
setup
|
22
|
-
extract
|
23
24
|
compile
|
24
25
|
write_env
|
25
26
|
write_init
|
@@ -45,7 +46,7 @@ module Pkgr
|
|
45
46
|
|
46
47
|
# Extract the given tarball to the target directory
|
47
48
|
def extract
|
48
|
-
|
49
|
+
FileUtils.mkdir_p source_dir
|
49
50
|
|
50
51
|
opts = {}
|
51
52
|
if tarball == "-"
|
@@ -58,6 +59,14 @@ module Pkgr
|
|
58
59
|
tarball_extract.error!
|
59
60
|
end
|
60
61
|
|
62
|
+
# Update existing config with the one from .pkgr.yml file, if any
|
63
|
+
def update_config
|
64
|
+
if File.exist?(config_file)
|
65
|
+
@config = Config.load_file(config_file, distribution.version).merge(config)
|
66
|
+
Pkgr.debug "Found .pkgr.yml file. Updated config is now: #{config.inspect}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
61
70
|
# Pass the app through the buildpack
|
62
71
|
def compile
|
63
72
|
if buildpack_for_app
|
@@ -142,6 +151,10 @@ module Pkgr
|
|
142
151
|
File.join(source_dir, ".release")
|
143
152
|
end
|
144
153
|
|
154
|
+
def config_file
|
155
|
+
File.join(source_dir, ".pkgr.yml")
|
156
|
+
end
|
157
|
+
|
145
158
|
# Path to the directory containing the main app files.
|
146
159
|
def source_dir
|
147
160
|
File.join(build_dir, "opt/#{config.name}")
|
data/lib/pkgr/cli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "thor"
|
2
2
|
require 'pkgr'
|
3
|
+
require 'pkgr/buildpack'
|
3
4
|
|
4
5
|
module Pkgr
|
5
6
|
class CLI < Thor
|
@@ -30,10 +31,10 @@ module Pkgr
|
|
30
31
|
method_option :iteration, :type => :string, :default => Time.now.strftime("%Y%m%d%H%M%S"), :desc => "Package iteration (you should keep the default here)"
|
31
32
|
method_option :user, :type => :string, :desc => "User to run the app under (defaults to your app name)"
|
32
33
|
method_option :group, :type => :string, :desc => "Group to run the app under (defaults to your app name)"
|
33
|
-
method_option :compile_cache_dir, :type => :string, :desc => "Where to store the files cached between packaging runs"
|
34
|
+
method_option :compile_cache_dir, :type => :string, :desc => "Where to store the files cached between packaging runs. Path will be resolved from the temporary code repository folder, so use absolute paths if needed."
|
35
|
+
method_option :before_precompile, :type => :string, :desc => "Provide a script to run just before the buildpack compilation. Path will be resolved from the temporary code repository folder, so use absolute paths if needed."
|
34
36
|
method_option :dependencies, :type => :array, :default => [], :desc => "Specific system dependencies that you want to install with the package"
|
35
37
|
method_option :build_dependencies, :type => :array, :default => [], :desc => "Specific system dependencies that must be present before building"
|
36
|
-
method_option :before_precompile, :type => :string, :desc => "Provide a script to run just before the buildpack compilation"
|
37
38
|
method_option :host, :type => :string, :desc => "Remote host to build on (default: local machine)"
|
38
39
|
method_option :auto, :type => :boolean, :default => false, :desc => "Automatically attempt to install missing dependencies"
|
39
40
|
method_option :clean, :type => :boolean, :default => true, :desc => "Automatically clean up temporary dirs"
|
data/lib/pkgr/config.rb
CHANGED
@@ -1,11 +1,39 @@
|
|
1
1
|
require 'ostruct'
|
2
|
+
require 'yaml'
|
2
3
|
|
3
4
|
module Pkgr
|
4
5
|
class Config < OpenStruct
|
6
|
+
class << self
|
7
|
+
def load_file(path, distribution)
|
8
|
+
config = YAML.load_file(path)
|
9
|
+
|
10
|
+
targets = config.delete("targets") || {}
|
11
|
+
(targets[distribution.to_s] || {}).each do |k,v|
|
12
|
+
config[k] = v
|
13
|
+
end
|
14
|
+
|
15
|
+
self.new(config)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
5
19
|
def sesame
|
6
20
|
binding
|
7
21
|
end
|
8
22
|
|
23
|
+
def merge(other)
|
24
|
+
new_config = self.class.new
|
25
|
+
self.each{|k,v| new_config.send("#{k}=".to_sym, v)}
|
26
|
+
other.each{|k,v| new_config.send("#{k}=".to_sym, v)}
|
27
|
+
new_config
|
28
|
+
end
|
29
|
+
|
30
|
+
def each
|
31
|
+
@table.each do |k,v|
|
32
|
+
next if v.nil?
|
33
|
+
yield k, v
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
9
37
|
def home
|
10
38
|
"/opt/#{name}"
|
11
39
|
end
|
data/lib/pkgr/dispatcher.rb
CHANGED
@@ -14,8 +14,6 @@ module Pkgr
|
|
14
14
|
|
15
15
|
def setup
|
16
16
|
tarify if File.directory?(path)
|
17
|
-
config.before_precompile = File.expand_path(config.before_precompile) if config.before_precompile
|
18
|
-
config.compile_cache_dir = File.expand_path(config.compile_cache_dir) if config.compile_cache_dir
|
19
17
|
end
|
20
18
|
|
21
19
|
def call
|
data/lib/pkgr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pkgr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|