gpm 0.1.3 → 0.1.7
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/gpm/cli.rb +2 -0
- data/lib/gpm/gpm_logging.rb +12 -0
- data/lib/gpm/source/files_providers/files_from_bundler_directory_provider.rb +5 -1
- data/lib/gpm/target.rb +2 -5
- data/lib/gpm/target/deb.rb +5 -6
- data/lib/gpm/target/generate_from_templates.rb +8 -2
- data/lib/gpm/target/step_plugin.rb +5 -2
- data/templates/deb/control.tar.gz.dir/md5sums.erb +6 -0
- metadata +28 -27
data/lib/gpm/cli.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'logger'
|
2
|
+
env_log_level = ENV["GPM_LOG_LEVEL"].to_s.upcase.to_sym
|
3
|
+
GPM_LOG_LEVEL = ::Logger.constants.include?(env_log_level) ? ::Logger.const_get(env_log_level) : ::Logger::INFO
|
4
|
+
GPM_LOG_DESTINATION = STDOUT
|
5
|
+
|
6
|
+
class Object
|
7
|
+
def create_logger
|
8
|
+
logger = ::Logger.new(GPM_LOG_DESTINATION)
|
9
|
+
logger.level = GPM_LOG_LEVEL
|
10
|
+
logger
|
11
|
+
end
|
12
|
+
end
|
@@ -15,6 +15,7 @@ module Source
|
|
15
15
|
@gemfile = gemfile
|
16
16
|
@gemspec = gemspec
|
17
17
|
@vendored_gems_installer = vendored_gems_installer || Source::VendoredGemsInstaller.new(gemfile)
|
18
|
+
@installed = false
|
18
19
|
end
|
19
20
|
|
20
21
|
def bundled_files
|
@@ -26,7 +27,10 @@ module Source
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def file_contents
|
29
|
-
@
|
30
|
+
unless @installed
|
31
|
+
@vendored_gems_installer.install!
|
32
|
+
@installed = true
|
33
|
+
end
|
30
34
|
super_contents = super.merge(read_file_contents(bundled_files+[File.basename(gemfile),File.basename(gemspec),'Gemfile.lock','.bundle/config'], directory))
|
31
35
|
super_contents
|
32
36
|
end
|
data/lib/gpm/target.rb
CHANGED
@@ -23,16 +23,13 @@ module Target
|
|
23
23
|
def self.add_step_for_phase(phase, block, description = nil)
|
24
24
|
steps_for_phase(phase) << [block, description]
|
25
25
|
end
|
26
|
-
|
26
|
+
class_attribute *phase_steps_names
|
27
27
|
phase_steps_names.each {|p| self.send("#{p}=".to_sym,[])}
|
28
28
|
|
29
|
-
include GenerateFromTemplates
|
30
|
-
include ZipDirectories
|
31
29
|
attr_reader :work_dir, :options
|
32
30
|
def initialize(work_dir, options = {})
|
33
31
|
@work_dir = work_dir
|
34
|
-
@logger =
|
35
|
-
@logger.level = ::Logger::INFO
|
32
|
+
@logger = create_logger
|
36
33
|
@options = options
|
37
34
|
end
|
38
35
|
|
data/lib/gpm/target/deb.rb
CHANGED
@@ -37,7 +37,7 @@ class Target::Deb < Target::Base
|
|
37
37
|
def initialize(source)
|
38
38
|
raise("nil source") unless source
|
39
39
|
super(source)
|
40
|
-
@logger =
|
40
|
+
@logger = create_logger
|
41
41
|
end
|
42
42
|
|
43
43
|
def permission_overrides
|
@@ -121,9 +121,12 @@ class Target::Deb < Target::Base
|
|
121
121
|
def all_binaries
|
122
122
|
Dir["**/*.so"]
|
123
123
|
end
|
124
|
-
|
124
|
+
in_phase(:file_creation, "Generating files from source...") { |source| write_file_contents_in_directory source.file_contents, File.join("data.tar.gz.dir",options[:destination] || "") }
|
125
125
|
in_phase(:file_creation, "Stripping links from binaries...") { exec("strip --strip-unneeded #{all_binaries.join(' ')}") unless all_binaries.empty? }
|
126
126
|
in_phase(:file_creation, "Removing absolute paths from binaries...") { exec("chrpath --delete #{all_binaries.join(' ')}") unless all_binaries.empty? }
|
127
|
+
include GenerateFromTemplates
|
128
|
+
add_generation_phase("Expanding templates another time to get correct md5sums")
|
129
|
+
include ZipDirectories
|
127
130
|
in_phase(:file_creation, "Making files unwriteable by group and others...") { exec("chmod -R go-w *") }
|
128
131
|
in_phase(:packaging, "Packaging metafiles and files into .deb package...") {|source| exec("ar -qc ../#{source.default_output} debian-binary control.tar.gz data.tar.gz") }
|
129
132
|
in_phase(:packaging, "Copying .deb package to output directory...") {|source| FileUtils.cp("../#{source.default_output}",@origin_dir) }
|
@@ -131,9 +134,5 @@ class Target::Deb < Target::Base
|
|
131
134
|
def create_package(source)
|
132
135
|
super(DebianSourceWrapper.new(source))
|
133
136
|
end
|
134
|
-
def write_files_to_package_dir(source)
|
135
|
-
super
|
136
|
-
write_file_contents_in_directory source.file_contents, File.join("data.tar.gz.dir",options[:destination] || "")
|
137
|
-
end
|
138
137
|
|
139
138
|
end
|
@@ -2,7 +2,13 @@ require_relative 'step_plugin'
|
|
2
2
|
require_relative '../file_path_and_permissions'
|
3
3
|
module GenerateFromTemplates
|
4
4
|
include StepPlugin
|
5
|
-
|
5
|
+
def self.included(base)
|
6
|
+
def base.add_generation_phase(explanation="Expanding templates...")
|
7
|
+
in_phase(:file_creation, explanation) { |source| write_files_to_package_dir(source) }
|
8
|
+
end
|
9
|
+
base.add_generation_phase
|
10
|
+
self.plugin_included(base)
|
11
|
+
end
|
6
12
|
|
7
13
|
def template_paths
|
8
14
|
@template_paths ||= Dir["#{template_dir}/**/*.erb"]
|
@@ -19,7 +25,7 @@ module GenerateFromTemplates
|
|
19
25
|
def templates
|
20
26
|
Hash[*template_paths.map {|file| FilePathAndPermissions.new(file.gsub(/#{template_dir}\//,"").gsub(".erb",""),File.new(file).lstat.mode)}.zip(template_paths.map do |template_file|
|
21
27
|
tpl = File.read(template_file)
|
22
|
-
::ERB.new(tpl, nil,
|
28
|
+
::ERB.new(tpl, nil,'%<>-')
|
23
29
|
end).flatten]
|
24
30
|
end
|
25
31
|
|
@@ -10,14 +10,17 @@ module StepPlugin
|
|
10
10
|
@phase_blocks[phase] ||= []
|
11
11
|
@phase_blocks[phase] << [block, description]
|
12
12
|
end
|
13
|
-
def base.
|
14
|
-
@phase_blocks.each do |phase, blocks|
|
13
|
+
def base.plugin_included(clazz)
|
14
|
+
(@phase_blocks || []).each do |phase, blocks|
|
15
15
|
blocks.each do |block_and_description|
|
16
16
|
block, description = block_and_description
|
17
17
|
clazz.add_step_for_phase(phase,block,description)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
|
+
def base.included(clazz)
|
22
|
+
plugin_included(clazz)
|
23
|
+
end
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-14 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: &
|
16
|
+
requirement: &76972990 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *76972990
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &76972540 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,21 +32,21 @@ dependencies:
|
|
32
32
|
version: 0.14.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *76972540
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activesupport
|
38
|
-
requirement: &
|
38
|
+
requirement: &76972240 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 3.1.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *76972240
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: i18n
|
49
|
-
requirement: &
|
49
|
+
requirement: &76972050 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *76972050
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: cucumber
|
60
|
-
requirement: &
|
60
|
+
requirement: &76971730 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.2
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *76971730
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: aruba
|
71
|
-
requirement: &
|
71
|
+
requirement: &76971420 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.4.3
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *76971420
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: guard
|
82
|
-
requirement: &
|
82
|
+
requirement: &76971130 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.7.0
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *76971130
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: guard-cucumber
|
93
|
-
requirement: &
|
93
|
+
requirement: &76970850 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 0.6.3
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *76970850
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: guard-bundler
|
104
|
-
requirement: &
|
104
|
+
requirement: &76970570 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: 0.1.3
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *76970570
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: guard-rspec
|
115
|
-
requirement: &
|
115
|
+
requirement: &76970290 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,21 +120,21 @@ dependencies:
|
|
120
120
|
version: 0.4.5
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *76970290
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: fakefs
|
126
|
-
requirement: &
|
126
|
+
requirement: &76970030 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
131
|
+
version: 0.4.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *76970030
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: simplecov
|
137
|
-
requirement: &
|
137
|
+
requirement: &76969780 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ~>
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
version: 0.4.2
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *76969780
|
146
146
|
description: Convert directories, rpms, python eggs, rubygems, and more to rpms, debs,
|
147
147
|
solaris packages and more. Win at package management without wasting pointless hours
|
148
148
|
debugging bad rpm specs!
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- lib/gpm/source/bundler.rb
|
164
164
|
- lib/gpm/source/gem.rb
|
165
165
|
- lib/gpm/packaging_task.rb
|
166
|
+
- lib/gpm/gpm_logging.rb
|
166
167
|
- lib/gpm/file_path_and_permissions.rb
|
167
168
|
- lib/gpm/target.rb
|
168
169
|
- lib/gpm/source.rb
|