polisher 0.4 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -661
- data/README.md +39 -0
- data/Rakefile +11 -88
- data/bin/binary_gem_resolver.rb +95 -0
- data/bin/gem_dependency_checker.rb +165 -0
- data/bin/git_gem_updater.rb +86 -0
- data/bin/ruby_rpm_spec_updater.rb +29 -0
- data/lib/polisher.rb +19 -0
- data/lib/polisher/apt.rb +12 -0
- data/lib/polisher/bodhi.rb +21 -0
- data/lib/polisher/bugzilla.rb +9 -0
- data/lib/polisher/core.rb +33 -0
- data/lib/polisher/errata.rb +43 -0
- data/lib/polisher/fedora.rb +43 -0
- data/lib/polisher/gem.rb +155 -0
- data/lib/polisher/gemfile.rb +72 -0
- data/lib/polisher/gemspec.rb +32 -0
- data/lib/polisher/git.rb +135 -0
- data/lib/polisher/koji.rb +54 -0
- data/lib/polisher/rhn.rb +14 -0
- data/lib/polisher/rpmspec.rb +254 -0
- data/lib/polisher/upstream.rb +29 -0
- data/lib/polisher/vendor.rb +9 -0
- data/lib/polisher/version_checker.rb +100 -0
- data/lib/polisher/yum.rb +28 -0
- data/spec/core_spec.rb +64 -0
- data/spec/fedora_spec.rb +14 -0
- data/spec/gem_spec.rb +82 -0
- data/spec/gemfile_spec.rb +45 -0
- data/spec/git_spec.rb +74 -0
- data/spec/rpmspec_spec.rb +105 -0
- data/spec/spec_helper.rb +50 -37
- data/spec/upstream_spec.rb +39 -0
- metadata +173 -179
- data/COPYING +0 -8
- data/README.rdoc +0 -105
- data/TODO +0 -7
- data/bin/server +0 -4
- data/config.ru +0 -25
- data/config/database.yml +0 -13
- data/config/polisher.yml +0 -5
- data/db/connection.rb +0 -52
- data/db/migrations/001_create_projects.rb +0 -23
- data/db/migrations/002_create_sources.rb +0 -25
- data/db/migrations/003_create_project_source_versions.rb +0 -28
- data/db/migrations/004_create_events.rb +0 -27
- data/db/migrations/005_create_project_dependencies.rb +0 -28
- data/db/models/event.rb +0 -87
- data/db/models/project.rb +0 -110
- data/db/models/project_dependency.rb +0 -27
- data/db/models/project_source_version.rb +0 -31
- data/db/models/source.rb +0 -101
- data/lib/common.rb +0 -71
- data/lib/dsl.rb +0 -292
- data/lib/event_handlers.rb +0 -166
- data/lib/gem_adapter.rb +0 -94
- data/lib/sinatra/url_for.rb +0 -40
- data/polisher.rb +0 -372
- data/public/stylesheets/style.css +0 -67
- data/spec/common_spec.rb +0 -28
- data/spec/dsl_spec.rb +0 -357
- data/spec/event_handlers_spec.rb +0 -300
- data/spec/gem_adapter_spec.rb +0 -89
- data/spec/models_spec.rb +0 -721
- data/spec/polisher_spec.rb +0 -573
- data/views/layout.haml +0 -22
- data/views/projects/index.haml +0 -42
- data/views/projects/index.html.haml +0 -38
- data/views/result.haml +0 -9
- data/views/sources/index.haml +0 -24
- data/views/sources/index.html.haml +0 -26
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
Polisher
|
2
|
+
======================
|
3
|
+
Ruby Post-Publishing Processor - Polish your Ruby projects with ease!
|
4
|
+
|
5
|
+
<pre>
|
6
|
+
.77 7.
|
7
|
+
+$ =~
|
8
|
+
+?ZZZII .Z$$$$$$
|
9
|
+
$~~:,.$Z $~~:,.7
|
10
|
+
?~:,, .......................................redmine...............=~:,,.
|
11
|
+
~::,..rails.......................................................~~:,.
|
12
|
+
~~:,, .........rack................json...........................=~:,,
|
13
|
+
=~::,.....................sass............activerecord..............~::,.
|
14
|
+
~~:,.=....eruby...................................................~~:,.~
|
15
|
+
+~:,,.................haml......................eventmachine.......?~::,.
|
16
|
+
~::,. ........................rspec................................~~:,.:
|
17
|
+
=~:,,:.........................................bundler.............~~:,,
|
18
|
+
~I7I..........rvm..................rake...........................,~7?II
|
19
|
+
$$$$$$$O $$$$$$$$
|
20
|
+
.ZO7Z, .+ZIZ.
|
21
|
+
7 7
|
22
|
+
$I ZI
|
23
|
+
</pre>
|
24
|
+
|
25
|
+
Polisher is a Ruby module and set of utilities aimed to assisting the post-publishing
|
26
|
+
packaging process for Ruby gems and applications.
|
27
|
+
|
28
|
+
Provided are a series of tools geared towards querying rubygems.org and other upstream
|
29
|
+
ruby sources for metadata as well as downstream sources such as the Fedora and Debian
|
30
|
+
distributions to cross reference various supported stacks vendored by each.
|
31
|
+
|
32
|
+
Also prodivided are tools to integrate and hook into various build and install workflows
|
33
|
+
used by both upstream and downstream developers to synergize operations and streamline
|
34
|
+
the packaging and support process.
|
35
|
+
|
36
|
+
The project is still in its early / conceptual stages, and all are welcome to assist
|
37
|
+
shaping its direction. See documentation and spec suite for specific usage.
|
38
|
+
|
39
|
+
Polisher is Licensed under the MIT License, Copyright (C) 2013 Red Hat, Inc.
|
data/Rakefile
CHANGED
@@ -1,94 +1,17 @@
|
|
1
|
-
#
|
1
|
+
# Polisher Project Rakefile
|
2
|
+
#
|
3
|
+
# Licensed under the MIT license
|
4
|
+
# Copyright (C) 2013 Red Hat, Inc.
|
2
5
|
|
3
|
-
require
|
4
|
-
require 'db/connection'
|
5
|
-
require 'rake/rdoctask'
|
6
|
-
require 'spec/rake/spectask'
|
7
|
-
require 'rake/gempackagetask'
|
8
|
-
|
9
|
-
#task :default => :test
|
10
|
-
|
11
|
-
env = ENV['RACK_ENV']
|
12
|
-
env ||= 'development'
|
13
|
-
|
14
|
-
logger = Logger.new(STDOUT)
|
15
|
-
|
16
|
-
GEM_NAME='polisher'
|
17
|
-
PKG_VERSION='0.4'
|
18
|
-
|
19
|
-
namespace :db do
|
20
|
-
desc "Migrate the database"
|
21
|
-
task :migrate do
|
22
|
-
Polisher::DB.connect Polisher::DB.load_config('./config/database.yml', env), logger
|
23
|
-
Polisher::DB.migrate './db/migrations'
|
24
|
-
end
|
25
|
-
|
26
|
-
desc "Rollback the database"
|
27
|
-
task :rollback do
|
28
|
-
Polisher::DB.connect Polisher::DB.load_config('./config/database.yml', env), logger
|
29
|
-
Polisher::DB.rollback './db/migrations'
|
30
|
-
end
|
31
|
-
|
32
|
-
desc "Drop all tables in the database"
|
33
|
-
task :drop_tables do
|
34
|
-
Polisher::DB.connect Polisher::DB.load_config('./config/database.yml', env), logger
|
35
|
-
Polisher::DB.drop_tables './db/migrations'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
task 'test_env' do
|
40
|
-
env = 'test'
|
41
|
-
create_missing_polisher_dirs(:artifacts_dir => 'spec/artifacts', :db_data_dir => 'db/data', :log_dir => 'log')
|
42
|
-
end
|
6
|
+
require "rspec/core/rake_task"
|
43
7
|
|
44
8
|
desc "Run all specs"
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
Rake::RDocTask.new do |rd|
|
50
|
-
rd.main = "README.rdoc"
|
51
|
-
rd.rdoc_dir = "doc/site/api"
|
52
|
-
rd.rdoc_files.include("README.rdoc", "polisher.rb", "db/models/*.rb", "lib/**/*.rb")
|
53
|
-
end
|
54
|
-
|
55
|
-
PKG_FILES = FileList['bin/*', 'config/*.yml', 'config.ru', 'COPYING',
|
56
|
-
'db/**/*.rb', 'lib/**/*.rb', 'LICENSE', 'polisher.rb', 'public/**/*', 'Rakefile',
|
57
|
-
'README.rdoc', 'spec/**/*.rb', 'TODO', 'views/**/*.haml']
|
58
|
-
|
59
|
-
DIST_FILES = FileList[
|
60
|
-
"pkg/*.tgz", "pkg/*.gem"
|
61
|
-
]
|
62
|
-
|
63
|
-
SPEC = Gem::Specification.new do |s|
|
64
|
-
s.name = GEM_NAME
|
65
|
-
s.version = PKG_VERSION
|
66
|
-
s.files = PKG_FILES
|
67
|
-
|
68
|
-
s.required_ruby_version = '>= 1.8.1'
|
69
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.3")
|
70
|
-
|
71
|
-
s.add_dependency('sinatra', '>= 0.9.4')
|
72
|
-
s.add_dependency('thin', '>= 1.2.7')
|
73
|
-
s.add_dependency('activerecord', '>= 2.3.5')
|
74
|
-
s.add_dependency('haml', '>= 2.2.20')
|
75
|
-
s.add_dependency('curb', '>= 0.6.7') # eg curl
|
76
|
-
s.add_dependency('libxml-ruby', '>= 1.1.3')
|
77
|
-
s.add_dependency('rest-client', '>= 1.4.2')
|
78
|
-
s.add_dependency('json_pure', '>= 1.2.0')
|
79
|
-
s.add_dependency('gem2rpm', '>= 0.6.0')
|
80
|
-
s.add_dependency('rspec', '>= 1.3.0')
|
81
|
-
s.add_dependency('rack-test', '>= 0.5.3')
|
82
|
-
|
83
|
-
s.author = "Mohammed Morsi"
|
84
|
-
s.email = "mmorsi@redhat.com"
|
85
|
-
s.date = %q{2010-03-11}
|
86
|
-
s.summary = "A project release management tool"
|
87
|
-
s.description = "Polisher provides simple REST and DSL interfaces allowing you to configure event workflows to be invoked on specific versions of project/source releases"
|
88
|
-
s.homepage = "http://github.com/movitto/polisher"
|
9
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
10
|
+
spec.pattern = 'specs/**/*_spec.rb'
|
11
|
+
spec.rspec_opts = ['--backtrace', '-fd', '-c']
|
89
12
|
end
|
90
13
|
|
91
|
-
|
92
|
-
|
93
|
-
|
14
|
+
desc "build the polisher gem"
|
15
|
+
task :build do
|
16
|
+
system "gem build polisher.gemspec"
|
94
17
|
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# binary gem resolver
|
3
|
+
#
|
4
|
+
# Looks up missing binary dependencies required by ruby packages via
|
5
|
+
# various backends (currently yum, more to be added)
|
6
|
+
#
|
7
|
+
# gem install packages as normal. If any fail due to missing requirements,
|
8
|
+
# run this script w/ the location of the failed install like so:
|
9
|
+
#
|
10
|
+
# ./binary_gem_resolver.rb <path-to-gem-install>
|
11
|
+
#
|
12
|
+
# Licensed under the MIT license
|
13
|
+
# Copyright (C) 2013 Red Hat, Inc.
|
14
|
+
###########################################################
|
15
|
+
|
16
|
+
require 'colored'
|
17
|
+
|
18
|
+
# retrieve extconf.rb for gem at specified path in filesystem
|
19
|
+
gem_dir = ARGV.shift
|
20
|
+
extconf = nil
|
21
|
+
|
22
|
+
require 'find'
|
23
|
+
Find.find(gem_dir) do |path|
|
24
|
+
if path =~ /.*extconf.rb/
|
25
|
+
extconf = File.expand_path path
|
26
|
+
break
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if extconf.nil?
|
31
|
+
puts "extconf could not be found".red.bold
|
32
|
+
exit 1
|
33
|
+
end
|
34
|
+
|
35
|
+
# helper to lookup missing headers / print packages that satisfy them
|
36
|
+
def lookup_missing(header)
|
37
|
+
puts 'looking up... (may take a few minutes)'.yellow
|
38
|
+
matches = []
|
39
|
+
`yum provides */usr/include/#{header}`.each_line { |l|
|
40
|
+
if l =~ /(.*)\.fc.*/
|
41
|
+
matches << $1
|
42
|
+
end
|
43
|
+
}
|
44
|
+
puts "packages which provide header:\n#{matches.join("\n")}".yellow.bold
|
45
|
+
end
|
46
|
+
|
47
|
+
#############################################################
|
48
|
+
|
49
|
+
# require/override mkmf methods
|
50
|
+
require 'mkmf'
|
51
|
+
|
52
|
+
alias :_cpp_command :cpp_command
|
53
|
+
def cpp_command(outfile="", opt)
|
54
|
+
""
|
55
|
+
end
|
56
|
+
|
57
|
+
alias :_have_library :have_library
|
58
|
+
def have_library(lib, func = nil, headers = nil, &b)
|
59
|
+
_have_library(lib, func, headers, &b)
|
60
|
+
end
|
61
|
+
|
62
|
+
alias :_find_library :find_library
|
63
|
+
def find_library(lib, func, *paths, &b)
|
64
|
+
_find_library(lib, func, *paths, &b)
|
65
|
+
end
|
66
|
+
|
67
|
+
alias :_have_func :have_func
|
68
|
+
def have_func(func, headers = nil, &b)
|
69
|
+
_have_func(func, headers, &b)
|
70
|
+
|
71
|
+
rescue => e
|
72
|
+
puts "missing func #{func}".red.bold
|
73
|
+
end
|
74
|
+
|
75
|
+
alias :_hav_header :have_header
|
76
|
+
def have_header(header, preheaders = nil, &b)
|
77
|
+
_have_header(header, preheaders, &b)
|
78
|
+
|
79
|
+
rescue => e
|
80
|
+
puts "missing header #{header}".red.bold
|
81
|
+
lookup_missing(header)
|
82
|
+
end
|
83
|
+
|
84
|
+
# other mkmf methods which may be overridden
|
85
|
+
#def find_header(header, *paths)
|
86
|
+
#def have_var(var, headers = nil, &b)
|
87
|
+
#def try_type(type, headers = nil, opt = "", &b)
|
88
|
+
#def have_type(type, headers = nil, opt = "", &b)
|
89
|
+
#def find_type(type, opt, *headers, &b)
|
90
|
+
#def try_const(const, headers = nil, opt = "", &b)
|
91
|
+
#def have_const(const, headers = nil, opt = "", &b)
|
92
|
+
#def find_executable0(bin, path = nil)
|
93
|
+
|
94
|
+
# require the gem's extconf
|
95
|
+
require extconf
|
@@ -0,0 +1,165 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# Gem Dependency Checker
|
3
|
+
# Print out Gem/Gemspec/Gemfile dependencies, highlighting
|
4
|
+
# missing dependencies and those that are remotely
|
5
|
+
# available in various locations including koji,
|
6
|
+
# git, fedora, bodhi, rhn, etc.
|
7
|
+
#
|
8
|
+
# Pass -h to the script to see command line option details
|
9
|
+
#
|
10
|
+
# User is responsible for establishing authorization session
|
11
|
+
# before invoking this script
|
12
|
+
#
|
13
|
+
# Licensed under the MIT license
|
14
|
+
# Copyright (C) 2013 Red Hat, Inc.
|
15
|
+
###########################################################
|
16
|
+
|
17
|
+
require 'optparse'
|
18
|
+
require 'colored'
|
19
|
+
require 'polisher/gem'
|
20
|
+
require 'polisher/gemfile'
|
21
|
+
require 'polisher/gemspec'
|
22
|
+
|
23
|
+
##########################################################
|
24
|
+
|
25
|
+
conf = { :gemfile => './Gemfile',
|
26
|
+
:gemspec => nil,
|
27
|
+
:gemname => nil,
|
28
|
+
:devel_deps => false,
|
29
|
+
:highlight_missing => false,
|
30
|
+
:check_fedora => false,
|
31
|
+
:check_git => false,
|
32
|
+
:check_koji => false,
|
33
|
+
:check_rhn => false,
|
34
|
+
:check_yum => false,
|
35
|
+
:check_bugzilla => false,
|
36
|
+
:check_errata => false}
|
37
|
+
|
38
|
+
optparse = OptionParser.new do |opts|
|
39
|
+
opts.on('-h', '--help', 'Display this help screen') do
|
40
|
+
puts opts
|
41
|
+
exit
|
42
|
+
end
|
43
|
+
|
44
|
+
opts.on('--gemfile file', 'Location of the gemfile to parse') do |g|
|
45
|
+
conf[:gemfile] = g
|
46
|
+
end
|
47
|
+
|
48
|
+
opts.on('--gemspec file', 'Location of the gemspec to parse') do |g|
|
49
|
+
conf[:gemspec] = g
|
50
|
+
end
|
51
|
+
|
52
|
+
opts.on('--gem name', 'Name of the rubygem to check') do |g|
|
53
|
+
conf[:gemname] = g
|
54
|
+
end
|
55
|
+
|
56
|
+
opts.on('--[no-]devel', 'Include development dependencies') do |d|
|
57
|
+
conf[:devel_deps] = d
|
58
|
+
end
|
59
|
+
|
60
|
+
opts.on('-m', '--[no-]missing', 'Highlight missing packages') do |m|
|
61
|
+
conf[:highlight_missing] = m
|
62
|
+
end
|
63
|
+
|
64
|
+
opts.on('-f', '--[no-]fedora', 'Check fedora for packages') do |f|
|
65
|
+
conf[:check_fedora] = f
|
66
|
+
end
|
67
|
+
|
68
|
+
opts.on('-g', '--git [url]', 'Check git for packages') do |g|
|
69
|
+
conf[:check_git] = g || "git://pkgs.fedoraproject.org/"
|
70
|
+
end
|
71
|
+
|
72
|
+
opts.on('-k', '--koji [url]', 'Check koji for packages') do |k|
|
73
|
+
conf[:check_koji] = k || 'koji.fedoraproject.org/kojihub'
|
74
|
+
end
|
75
|
+
|
76
|
+
opts.on('-t', '--koji-tag tag', 'Koji tag to query') do |t|
|
77
|
+
conf[:koji_tag] = t
|
78
|
+
end
|
79
|
+
|
80
|
+
opts.on('-b', '--bodhi [url]', 'Check Bodhi for packages') do |r|
|
81
|
+
conf[:check_bodhi] = r || 'https://admin.fedoraproject.org/updates/'
|
82
|
+
end
|
83
|
+
|
84
|
+
opts.on('--rhn [url]', 'Check RHN for packages') do |r|
|
85
|
+
conf[:check_rhn] = r || 'TODO'
|
86
|
+
end
|
87
|
+
|
88
|
+
opts.on('-y', '--yum', 'Check yum for packages') do |y|
|
89
|
+
conf[:check_yum] = y
|
90
|
+
end
|
91
|
+
|
92
|
+
opts.on('-b', '--bugzilla', 'Check bugzilla for bugs filed against package') do |b|
|
93
|
+
conf[:check_bugzilla] = b
|
94
|
+
end
|
95
|
+
|
96
|
+
opts.on('-e', '--errata [url]', 'Check packages filed in errata') do |e|
|
97
|
+
conf[:check_errata] = e || nil
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
optparse.parse!
|
102
|
+
|
103
|
+
if conf[:gemfile].nil? &&
|
104
|
+
conf[:gemspec].nil? &&
|
105
|
+
conf[:gemname].nil?
|
106
|
+
|
107
|
+
if File.exists?('./Gemfile')
|
108
|
+
conf[:gemfile] = './Gemfile'
|
109
|
+
else
|
110
|
+
puts "Valid Gemfile, GemSpec, or Gem must be specified".bold.red
|
111
|
+
exit 1
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
targets = []
|
116
|
+
targets << Polisher::VersionChecker::GEM_TARGET if conf[:check_gem]
|
117
|
+
targets << Polisher::VersionChecker::KOJI_TARGET if conf[:check_koji]
|
118
|
+
targets << Polisher::VersionChecker::FEDORA_TARGET if conf[:check_fedora]
|
119
|
+
targets << Polisher::VersionChecker::GIT_TARGET if conf[:check_git]
|
120
|
+
targets << Polisher::VersionChecker::YUM_TARGET if conf[:check_yum]
|
121
|
+
targets = Polisher::VersionChecker::ALL_TARGETS if targets.empty?
|
122
|
+
Polisher::VersionChecker.check targets
|
123
|
+
|
124
|
+
def print_dep(tgt, dep, versions)
|
125
|
+
# XXX little bit hacky but works for now
|
126
|
+
@last_dep ||= nil
|
127
|
+
if @last_dep != dep
|
128
|
+
puts "\n#{dep}".blue.bold
|
129
|
+
@last_dep = dep
|
130
|
+
end
|
131
|
+
|
132
|
+
if versions.nil? || versions.empty? ||
|
133
|
+
versions.size == 1 && versions[0].nil?
|
134
|
+
print " #{tgt.to_s.red.bold} "
|
135
|
+
else
|
136
|
+
print " #{tgt.to_s.green.bold}: #{versions.join(', ').yellow}"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
if conf[:gemname]
|
141
|
+
gem = Polisher::Gem.retrieve(conf[:gemname])
|
142
|
+
gem.versions(:recursive => true, :dev_deps => true) do |tgt, dep, versions|
|
143
|
+
print_dep(tgt, dep, versions)
|
144
|
+
end
|
145
|
+
|
146
|
+
elsif conf[:gemfile]
|
147
|
+
gemfile = nil
|
148
|
+
|
149
|
+
begin
|
150
|
+
gemfile = Polisher::Gemfile.parse(conf[:gemfile])
|
151
|
+
rescue => e
|
152
|
+
puts "Runtime err #{e}".red
|
153
|
+
exit 1
|
154
|
+
end
|
155
|
+
|
156
|
+
gemfile.dependency_versions do |tgt, dep, versions|
|
157
|
+
print_dep(tgt, dep, versions)
|
158
|
+
end
|
159
|
+
|
160
|
+
elsif conf[:gemspec]
|
161
|
+
gemspec = Polisher::Gemspec.parse(conf[:gemspec])
|
162
|
+
gemspec.dependency_versions do |tgt, dep, versions|
|
163
|
+
print_dep(tgt, dep, versions)
|
164
|
+
end
|
165
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# git gem updater
|
3
|
+
#
|
4
|
+
# Will checkout an existing gem rpm from distgit,
|
5
|
+
# and update to the latest version found on http://rubygems.org
|
6
|
+
#
|
7
|
+
# Usage:
|
8
|
+
# git_gem_updater.rb -n <gem_name>
|
9
|
+
#
|
10
|
+
# Licensed under the MIT License
|
11
|
+
# Copyright (C) 2013 Red Hat, Inc.
|
12
|
+
|
13
|
+
require 'colored'
|
14
|
+
require 'curb'
|
15
|
+
require 'json'
|
16
|
+
require 'optparse'
|
17
|
+
require 'nokogiri'
|
18
|
+
|
19
|
+
require 'polisher/git'
|
20
|
+
require 'polisher/gem'
|
21
|
+
|
22
|
+
ORIG_DIR = Dir.pwd
|
23
|
+
|
24
|
+
# read various options from the command line
|
25
|
+
conf = { :dir => ORIG_DIR,
|
26
|
+
:user => nil,
|
27
|
+
:gems => []}
|
28
|
+
|
29
|
+
optparse = OptionParser.new do|opts|
|
30
|
+
opts.on('-n', '--name GEM', 'gem name' ) do |n|
|
31
|
+
conf[:gems] << n
|
32
|
+
end
|
33
|
+
|
34
|
+
opts.on('-u', '--user USER', 'fedora user name' ) do |u|
|
35
|
+
conf[:user] = u
|
36
|
+
end
|
37
|
+
|
38
|
+
opts.on('-d', '--dir path', 'Directory to cd to before checking out / manipulating packages' ) do |p|
|
39
|
+
conf[:dir] = p
|
40
|
+
end
|
41
|
+
|
42
|
+
opts.on('-h', '--help', 'display this screen' ) do
|
43
|
+
puts opts
|
44
|
+
exit
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
optparse.parse!
|
49
|
+
|
50
|
+
conf[:gems] += Polisher::Fedora.gems_owned_by(conf[:user]) unless conf[:user].nil?
|
51
|
+
|
52
|
+
if conf[:gems].empty?
|
53
|
+
puts "must specify a gem name or user name!".red
|
54
|
+
exit 1
|
55
|
+
end
|
56
|
+
|
57
|
+
Dir.mkdir conf[:dir] unless File.directory?(conf[:dir])
|
58
|
+
Dir.chdir conf[:dir]
|
59
|
+
|
60
|
+
# iterate over gems
|
61
|
+
conf[:gems].each do |gem_name|
|
62
|
+
pkg =
|
63
|
+
begin
|
64
|
+
Polisher::GitPackage.clone(gem_name)
|
65
|
+
rescue => e
|
66
|
+
next
|
67
|
+
end
|
68
|
+
|
69
|
+
gem = Polisher::Gem.retrieve gem_name
|
70
|
+
File.write("#{gem.name}-#{gem.version}.gem", gem.download_gem)
|
71
|
+
pkg.update_to(gem)
|
72
|
+
# TODO append gem dependencies to conf[:gems] list
|
73
|
+
|
74
|
+
pkg.build
|
75
|
+
|
76
|
+
unless pkg.has_check?
|
77
|
+
puts "Warning: no %check section in spec,\
|
78
|
+
manually verify functionality!".bold.red
|
79
|
+
end
|
80
|
+
|
81
|
+
pkg.commit
|
82
|
+
|
83
|
+
puts "#{gem_name} commit complete".green
|
84
|
+
puts "Push commit with: git push".blue
|
85
|
+
puts "Build and tag official rpms with: #{Polisher::GitPackage::PKG_CMD} build".blue
|
86
|
+
end
|