polisher 0.10.2 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/bin/binary_gem_resolver.rb +2 -2
  3. data/bin/bundler2yum.rb +51 -0
  4. data/bin/check_ruby_spec.rb +32 -0
  5. data/bin/gem_dependency_checker.rb +13 -242
  6. data/bin/gem_mapper.rb +27 -0
  7. data/bin/gems2update.rb +27 -0
  8. data/bin/git_gem_diff.rb +48 -0
  9. data/bin/git_gem_updater.rb +3 -3
  10. data/bin/missing_deps.rb +29 -0
  11. data/bin/polisher-config.rb +17 -0
  12. data/bin/ruby_rpm_spec_updater.rb +23 -2
  13. data/lib/polisher.rb +5 -12
  14. data/lib/polisher/adaptors/checker_loader.rb +78 -0
  15. data/lib/polisher/{upstream.rb → adaptors/upstream.rb} +1 -0
  16. data/lib/polisher/adaptors/version_checker.rb +57 -0
  17. data/lib/polisher/adaptors/version_checker/bodhi.rb +29 -0
  18. data/lib/polisher/adaptors/version_checker/errata.rb +29 -0
  19. data/lib/polisher/adaptors/version_checker/fedora.rb +29 -0
  20. data/lib/polisher/adaptors/version_checker/gem.rb +27 -0
  21. data/lib/polisher/adaptors/version_checker/git.rb +29 -0
  22. data/lib/polisher/adaptors/version_checker/koji.rb +29 -0
  23. data/lib/polisher/adaptors/version_checker/yum.rb +29 -0
  24. data/lib/polisher/cli/all.rb +22 -0
  25. data/lib/polisher/cli/bin/gem_dependency_checker.rb +85 -0
  26. data/lib/polisher/cli/bin/gem_mapper.rb +37 -0
  27. data/lib/polisher/cli/bin/gems2update.rb +86 -0
  28. data/lib/polisher/cli/bin/missing_deps.rb +35 -0
  29. data/lib/polisher/cli/conf.rb +18 -0
  30. data/lib/polisher/cli/default.rb +25 -0
  31. data/lib/polisher/cli/format.rb +130 -0
  32. data/lib/polisher/cli/sources.rb +106 -0
  33. data/lib/polisher/cli/specifier.rb +30 -0
  34. data/lib/polisher/cli/status.rb +50 -0
  35. data/lib/polisher/cli/targets.rb +88 -0
  36. data/lib/polisher/gem.rb +41 -338
  37. data/lib/polisher/gem/attributes.rb +20 -0
  38. data/lib/polisher/gem/dependencies.rb +63 -0
  39. data/lib/polisher/gem/diff.rb +39 -0
  40. data/lib/polisher/gem/files.rb +111 -0
  41. data/lib/polisher/gem/parser.rb +85 -0
  42. data/lib/polisher/gem/retriever.rb +137 -0
  43. data/lib/polisher/{gem_state.rb → gem/state.rb} +6 -6
  44. data/lib/polisher/gem/versions.rb +131 -0
  45. data/lib/polisher/gemfile.rb +20 -89
  46. data/lib/polisher/gemfile/attributes.rb +19 -0
  47. data/lib/polisher/gemfile/deps.rb +43 -0
  48. data/lib/polisher/gemfile/parser.rb +45 -0
  49. data/lib/polisher/git/pkg.rb +33 -238
  50. data/lib/polisher/git/pkg/attributes.rb +60 -0
  51. data/lib/polisher/git/pkg/builder.rb +47 -0
  52. data/lib/polisher/git/pkg/repo.rb +82 -0
  53. data/lib/polisher/git/pkg/updater.rb +53 -0
  54. data/lib/polisher/git/pkg/versions.rb +40 -0
  55. data/lib/polisher/git/project.rb +1 -1
  56. data/lib/polisher/git/repo.rb +79 -76
  57. data/lib/polisher/{vendor.rb → mixins/vendored_deps.rb} +4 -7
  58. data/lib/polisher/mixins/versioned_dependencies.rb +86 -0
  59. data/lib/polisher/record.rb +2 -0
  60. data/lib/polisher/rpm.rb +23 -0
  61. data/lib/polisher/rpm/patch.rb +10 -8
  62. data/lib/polisher/rpm/requirement.rb +33 -189
  63. data/lib/polisher/rpm/requirement/attributes.rb +43 -0
  64. data/lib/polisher/rpm/requirement/comparison.rb +97 -0
  65. data/lib/polisher/rpm/requirement/gem_reference.rb +46 -0
  66. data/lib/polisher/rpm/requirement/parser.rb +41 -0
  67. data/lib/polisher/rpm/spec.rb +97 -436
  68. data/lib/polisher/rpm/spec/check.rb +14 -0
  69. data/lib/polisher/rpm/spec/comparison.rb +64 -0
  70. data/lib/polisher/rpm/spec/files.rb +15 -0
  71. data/lib/polisher/rpm/spec/gem_files.rb +65 -0
  72. data/lib/polisher/rpm/spec/gem_reference.rb +59 -0
  73. data/lib/polisher/rpm/spec/gem_requirements.rb +73 -0
  74. data/lib/polisher/rpm/spec/parser.rb +106 -0
  75. data/lib/polisher/rpm/spec/requirements.rb +31 -0
  76. data/lib/polisher/rpm/spec/subpackages.rb +23 -0
  77. data/lib/polisher/rpm/spec/updater.rb +268 -0
  78. data/lib/polisher/specifier.rb +13 -0
  79. data/lib/polisher/targets.rb +36 -0
  80. data/lib/polisher/{apt.rb → targets/apt.rb} +1 -1
  81. data/lib/polisher/targets/bodhi.rb +43 -0
  82. data/lib/polisher/{bugzilla.rb → targets/bugzilla.rb} +1 -1
  83. data/lib/polisher/targets/errata.rb +55 -0
  84. data/lib/polisher/targets/errata/build.rb +24 -0
  85. data/lib/polisher/targets/fedora.rb +47 -0
  86. data/lib/polisher/targets/koji.rb +39 -0
  87. data/lib/polisher/targets/koji/builder.rb +38 -0
  88. data/lib/polisher/targets/koji/diff.rb +39 -0
  89. data/lib/polisher/targets/koji/rpc.rb +43 -0
  90. data/lib/polisher/targets/koji/versions.rb +67 -0
  91. data/lib/polisher/targets/rhn.rb +12 -0
  92. data/lib/polisher/targets/yum.rb +36 -0
  93. data/lib/polisher/{component.rb → util/component.rb} +3 -3
  94. data/lib/polisher/util/conf_helpers.rb +77 -0
  95. data/lib/polisher/util/config.rb +45 -0
  96. data/lib/polisher/util/core_ext.rb +59 -0
  97. data/lib/polisher/{error.rb → util/error.rb} +0 -0
  98. data/lib/polisher/{gem_cache.rb → util/gem_cache.rb} +1 -1
  99. data/lib/polisher/{git_cache.rb → util/git_cache.rb} +0 -0
  100. data/lib/polisher/{logger.rb → util/logger.rb} +2 -0
  101. data/lib/polisher/{tag_mapper.rb → util/tag_mapper.rb} +1 -1
  102. data/lib/polisher/version.rb +1 -1
  103. data/spec/{upstream_spec.rb → adaptors/upstream_spec.rb} +1 -1
  104. data/spec/{version_checker_spec.rb → adaptors/version_checker_spec.rb} +1 -6
  105. data/spec/data/activesupport-4.1.4.gem +0 -0
  106. data/spec/data/rubygem-activesupport-with-doc.spec +247 -0
  107. data/spec/data/rubygem-activesupport-without-requires.spec +232 -0
  108. data/spec/data/rubygem-activesupport.spec +0 -122
  109. data/spec/fixtures/gem_json.rb +49 -0
  110. data/spec/fixtures/gem_spec.rb +13 -0
  111. data/spec/fixtures/gemfile.rb +10 -0
  112. data/spec/fixtures/local_gem.rb +62 -0
  113. data/spec/fixtures/rpm_spec.rb +91 -0
  114. data/spec/gem/attributes_spec.rb +17 -0
  115. data/spec/gem/diff_spec.rb +80 -0
  116. data/spec/gem/files_spec.rb +171 -0
  117. data/spec/gem/parser_spec.rb +44 -0
  118. data/spec/gem/retriever_spec.rb +124 -0
  119. data/spec/gem/state_spec.rb +79 -0
  120. data/spec/gem/versions_spec.rb +148 -0
  121. data/spec/gem_spec.rb +5 -347
  122. data/spec/gemfile/deps_spec.rb +20 -0
  123. data/spec/gemfile/parser_spec.rb +26 -0
  124. data/spec/gemfile_spec.rb +0 -34
  125. data/spec/git/pkg/attributes_spec.rb +128 -0
  126. data/spec/git/pkg/builder_spec.rb +63 -0
  127. data/spec/git/pkg/repo_spec.rb +146 -0
  128. data/spec/git/pkg/updater_spec.rb +86 -0
  129. data/spec/git/pkg/versions_spec.rb +42 -0
  130. data/spec/git/pkg_spec.rb +21 -0
  131. data/spec/git/project_spec.rb +21 -0
  132. data/spec/git/repo_spec.rb +160 -0
  133. data/spec/{vendor_spec.rb → mixins/vendored_deps_spec.rb} +2 -4
  134. data/spec/mixins/versioned_dependencies_spec.rb +48 -0
  135. data/spec/rpm/patch_spec.rb +48 -0
  136. data/spec/rpm/requirement/attributes_spec.rb +34 -0
  137. data/spec/rpm/requirement/comparison_spec.rb +286 -0
  138. data/spec/rpm/requirement/gem_spec.rb +49 -0
  139. data/spec/rpm/requirement/parser_spec.rb +31 -0
  140. data/spec/rpm/requirement_spec.rb +8 -334
  141. data/spec/rpm/spec/check_spec.rb +25 -0
  142. data/spec/rpm/spec/comparison_spec.rb +55 -0
  143. data/spec/rpm/spec/files_spec.rb +17 -0
  144. data/spec/rpm/spec/gem_files_spec.rb +112 -0
  145. data/spec/rpm/spec/gem_reference_spec.rb +99 -0
  146. data/spec/rpm/spec/gem_requirement_spec.rb +38 -0
  147. data/spec/rpm/spec/parser_spec.rb +64 -0
  148. data/spec/rpm/spec/requirements_spec.rb +10 -0
  149. data/spec/rpm/spec/subpackages_spec.rb +38 -0
  150. data/spec/rpm/spec/updater_spec.rb +486 -0
  151. data/spec/rpm/spec_spec.rb +27 -174
  152. data/spec/spec_helper.rb +7 -107
  153. data/spec/support/coveralls.rb +10 -0
  154. data/spec/support/fixtures.rb +8 -0
  155. data/spec/support/paths.rb +20 -0
  156. data/spec/support/rspec.rb +20 -0
  157. data/spec/support/vcr.rb +11 -0
  158. data/spec/{bodhi_spec.rb → targets/bodhi_spec.rb} +3 -1
  159. data/spec/{errata_spec.rb → targets/errata_spec.rb} +2 -2
  160. data/spec/{fedora_spec.rb → targets/fedora_spec.rb} +3 -3
  161. data/spec/targets/koji/builder_spec.rb +48 -0
  162. data/spec/targets/koji/diff_spec.rb +36 -0
  163. data/spec/targets/koji/rpc_spec.rb +28 -0
  164. data/spec/{koji_spec.rb → targets/koji/versions_spec.rb} +1 -59
  165. data/spec/targets/koji_spec.rb +11 -0
  166. data/spec/{yum_spec.rb → targets/yum_spec.rb} +1 -1
  167. data/spec/{component_spec.rb → util/component_spec.rb} +1 -1
  168. data/spec/{core_spec.rb → util/core_ext_spec.rb} +2 -3
  169. metadata +278 -88
  170. data/lib/polisher/bodhi.rb +0 -23
  171. data/lib/polisher/config.rb +0 -32
  172. data/lib/polisher/core.rb +0 -101
  173. data/lib/polisher/errata.rb +0 -75
  174. data/lib/polisher/fedora.rb +0 -46
  175. data/lib/polisher/git.rb +0 -8
  176. data/lib/polisher/koji.rb +0 -159
  177. data/lib/polisher/rhn.rb +0 -15
  178. data/lib/polisher/version_checker.rb +0 -177
  179. data/lib/polisher/yum.rb +0 -37
  180. data/spec/git_spec.rb +0 -445
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20d2e85a2eedbb5be4c177a7623da909a92eeec2
4
- data.tar.gz: a5f208128ed510a65864b5637e9148988974def6
3
+ metadata.gz: 78a98e2d3dca5f6b32750ae3522c3c14b3b3fc23
4
+ data.tar.gz: 1ce3acd835e075b7038846f83b75daa282c15dfd
5
5
  SHA512:
6
- metadata.gz: b6bb501825b53423c3c8dec31cc40af207bc798d350839e571d725aa7e6fa4ac8926d6507f1be6fe655ddb35b5d9eb98b288bbf404f9eb568fceb674b8bf5afc
7
- data.tar.gz: 254c39d2fbfeb36427f1fd408f96ff8171bfe8f6335e1fee2a6ad3e083c61ba9e244ba1960f98368825fe773de513a4cd0be542df42415310a05502a0324727a
6
+ metadata.gz: 87fcc0b3ad168138f46563f40bcd48c57f7655e222ba4dc5d23d9557b016bad2d2802d84f6af08c90eb36d1169a473f42dbd118c5713267105f07b5b1513a1f5
7
+ data.tar.gz: 779e70b2f7c322b11a03823dfd6d2a49b757d0c1eadf6b3d7fea35860f24910eda861742e55e5110e6502b87360c72a5bbe1fa811f5fd84751abe9147c07b7a6
@@ -4,7 +4,7 @@
4
4
  # Looks up missing binary dependencies required by ruby packages via
5
5
  # various backends (currently yum, more to be added)
6
6
  #
7
- # gem install packages as normal. If any fail due to missing requirements,
7
+ # gem install packages as normal. If any fail due to missing requirements,
8
8
  # run this script w/ the location of the failed install like so:
9
9
  #
10
10
  # ./binary_gem_resolver.rb <path-to-gem-install>
@@ -46,7 +46,7 @@ end
46
46
 
47
47
  #############################################################
48
48
 
49
- # require/override mkmf methods
49
+ # require/override mkmf methods
50
50
  require 'mkmf'
51
51
 
52
52
  alias :_cpp_command :cpp_command
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/ruby
2
+ # Tool to convert a bundler Gemfile + various
3
+ # RPM sources to a yum repository
4
+ #
5
+ # Pass -h to command for complete list of command
6
+ # line options
7
+ #
8
+ # Licensed under the MIT License
9
+ # Copyright (C) 2013-2014 Red Hat, Inc.
10
+
11
+ require 'colored'
12
+ require 'optparse'
13
+
14
+ conf = { :gemfile => './Gemfile',
15
+ :sources => [],
16
+ :dest => nil}
17
+
18
+ optparse = OptionParser.new do |opts|
19
+ opts.on('-h', '--help', 'Display this help screen') do
20
+ puts opts
21
+ exit
22
+ end
23
+
24
+ opts.on('--gemfile file', 'Location of the gemfile to parse') do |g|
25
+ conf[:gemfile] = g
26
+ end
27
+
28
+ opts.on('--source source', 'Source which to pull packages from') do |s|
29
+ conf[:sources] << s
30
+ end
31
+
32
+ opts.on('--dest dest', 'Destination which to write repo to') do |s|
33
+ conf[:dest] = nil
34
+ end
35
+ end
36
+
37
+ optparse.parse!
38
+
39
+ if conf[:gemfile].nil? || conf[:dest].nil?
40
+ puts "Valid Gemfile must be specified".bold.red
41
+ exit 1
42
+ end
43
+
44
+ gemfile = Polisher::Gemfile.parse(conf[:gemfile])
45
+ gemfile.dependency_versions do |tgt, dep, versions|
46
+ # TODO:
47
+ # - attempt to retrieve versioned dependency from specified sources
48
+ # - error out if package cannot be retrieved
49
+ # - use createrepo and/or other tool (should be configurable)
50
+ # to create yum (or other) repo
51
+ end
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/ruby
2
+ # Check a Ruby RPM spec against an upstream source
3
+ # to validate it is up to date
4
+ #
5
+ # Run with the path to the spec to validate along
6
+ # with optional upstream source
7
+ #
8
+ # Usage:
9
+ # check_ruby_spec.rb <path-to-spec> <optional-source-or-version>
10
+ #
11
+ # Licensed under the MIT License
12
+ # Copyright (C) 2013-2014 Red Hat, Inc.
13
+
14
+ require 'colored'
15
+ require 'polisher'
16
+
17
+ spec_file = ARGV.shift
18
+ source = ARGV.shift
19
+ rpmspec = Polisher::RPM::Spec.parse File.read(spec_file)
20
+ source = source.nil? ?
21
+ Polisher::Gem.retrieve(rpmspec.gem_name) :
22
+ Polisher::Upstream.parse(source)
23
+
24
+ result = rpmspec.compare(source)
25
+ unless result[:diff].keys.empty?
26
+ puts "differences between rpmspec and upstream source detected".red.bold
27
+ result[:diff].each do |dep,versions|
28
+ puts "#{dep} / " \
29
+ "spec (#{versions[:spec]}) / " \
30
+ "upstream #{versions[:upstream]}".bold.red
31
+ end
32
+ end
@@ -14,257 +14,28 @@
14
14
  # Copyright (C) 2013-2014 Red Hat, Inc.
15
15
  ###########################################################
16
16
 
17
- require 'optparse'
18
- require 'colored'
19
17
  require 'polisher/gem'
20
18
  require 'polisher/gemfile'
21
- require 'polisher/core'
19
+ require 'polisher/util/config'
22
20
 
23
- ##########################################################
21
+ require 'polisher/cli/all'
22
+ require 'polisher/cli/bin/gem_dependency_checker'
24
23
 
25
- conf = {:format => nil,
26
- :log_level => :info,
27
- :gemfile => './Gemfile',
28
- :gemspec => nil,
29
- :gemname => nil,
30
- :prefix => nil,
31
- :groups => [],
32
- :devel_deps => false,
33
- :check_fedora => false,
34
- :check_git => false,
35
- :check_koji => false,
36
- :check_rhn => false,
37
- :check_yum => false,
38
- :check_bugzilla => false,
39
- :check_errata => false,
40
- :check_bodhi => false}
41
-
42
- optparse = OptionParser.new do |opts|
43
- opts.on('-h', '--help', 'Display this help screen') do
44
- puts opts
45
- exit
46
- end
47
-
48
- opts.on("--format val", 'Format which to render output') do |f|
49
- conf[:format] = f
50
- end
51
-
52
- opts.on("--log-level level", "Log verbosity") do |l|
53
- conf[:log_level] = l.to_sym
54
- end
55
-
56
- opts.on('--gemfile file', 'Location of the gemfile to parse') do |g|
57
- conf[:gemfile] = g
58
- end
59
-
60
- opts.on('--group gemfile_groups', 'Gemfile groups (may be specified multiple times)') do |g|
61
- conf[:groups] << g
62
- end
63
-
64
- opts.on('--gemspec file', 'Location of the gemspec to parse') do |g|
65
- conf[:gemspec] = g
66
- end
67
-
68
- opts.on('--gem name', 'Name of the rubygem to check') do |g|
69
- conf[:gemname] = g
70
- end
71
-
72
- opts.on('-p', '--prefix prefix', 'Prefix to append to gem name') do |p|
73
- conf[:prefix] = p
74
- end
75
-
76
- opts.on('--[no-]devel', 'Include development dependencies') do |d|
77
- conf[:devel_deps] = d
78
- end
79
-
80
- opts.on('-f', '--[no-]fedora', 'Check fedora for packages') do |f|
81
- conf[:check_fedora] = f
82
- end
83
-
84
- opts.on('-g', '--git [url]', 'Check git for packages') do |g|
85
- conf[:check_git] = g || "git://pkgs.fedoraproject.org/"
86
- end
87
-
88
- opts.on('-k', '--koji [url]', 'Check koji for packages') do |k|
89
- conf[:check_koji] = k || true
90
- end
91
-
92
- opts.on('-t', '--koji-tag tag', 'Koji tag to query') do |t|
93
- conf[:koji_tag] = t
94
- end
95
-
96
- opts.on('-b', '--bodhi [url]', 'Check Bodhi for packages') do |r|
97
- conf[:check_bodhi] = r || 'https://admin.fedoraproject.org/updates/'
98
- end
99
-
100
- opts.on('--rhn [url]', 'Check RHN for packages') do |r|
101
- conf[:check_rhn] = r || 'TODO'
102
- end
103
-
104
- opts.on('-y', '--yum', 'Check yum for packages') do |y|
105
- conf[:check_yum] = y
106
- end
107
-
108
- opts.on('-b', '--bugzilla', 'Check bugzilla for bugs filed against package') do |b|
109
- conf[:check_bugzilla] = b
110
- end
111
-
112
- opts.on('-e', '--errata [url]', 'Check packages filed in errata') do |e|
113
- conf[:check_errata] = e || nil
114
- end
115
- end
24
+ include Polisher::CLI
116
25
 
26
+ conf = gem_dependency_checker_conf
27
+ optparse = gem_dependency_checker_option_parser
117
28
  optparse.parse!
118
-
119
- if conf[:gemfile].nil? &&
120
- conf[:gemspec].nil? &&
121
- conf[:gemname].nil?
122
-
123
- if File.exists?('./Gemfile')
124
- conf[:gemfile] = './Gemfile'
125
- else
126
- puts "Valid Gemfile, GemSpec, or Gem must be specified".bold.red
127
- exit 1
128
- end
129
- end
29
+ validate_sources
130
30
 
131
31
  Polisher::Logging.level = conf[:log_level]
132
32
  Polisher::Config.set
133
-
134
- targets = []
135
- targets << Polisher::VersionChecker::GEM_TARGET if conf[:check_gem]
136
- targets << Polisher::VersionChecker::KOJI_TARGET if conf[:check_koji]
137
- targets << Polisher::VersionChecker::FEDORA_TARGET if conf[:check_fedora]
138
- targets << Polisher::VersionChecker::GIT_TARGET if conf[:check_git]
139
- targets << Polisher::VersionChecker::YUM_TARGET if conf[:check_yum]
140
- targets << Polisher::VersionChecker::BODHI_TARGET if conf[:check_bodhi]
141
- targets = Polisher::VersionChecker::ALL_TARGETS if targets.empty?
142
- Polisher::VersionChecker.check targets
143
-
144
- if conf[:check_koji]
145
- require 'polisher/koji'
146
- Polisher::Koji.koji_url conf[:check_koji] if conf[:koji_url].is_a?(String)
147
- Polisher::Koji.koji_tag conf[:koji_tag] if conf[:koji_tag]
148
- Polisher::Koji.package_prefix conf[:prefix] if conf[:prefix]
149
- end
150
-
151
- @format = conf[:format]
152
-
153
- def format_dep(dep)
154
- if @format.nil?
155
- dep.to_s.blue.bold
156
- elsif @format == 'xml'
157
- "<#{dep}>"
158
- elsif @format == 'json'
159
- "'#{dep}':{"
160
- end
161
- end
162
-
163
- def format_end_dep(dep)
164
- if @format.nil?
165
- "\n"
166
- elsif @format == 'xml'
167
- "\n</#{dep}>"
168
- elsif @format == 'json'
169
- "\n}"
170
- end
171
- end
172
-
173
- def format_tgt(tgt)
174
- if @format.nil?
175
- "#{tgt.to_s.red.bold} "
176
- elsif @format == 'xml'
177
- "<#{tgt}/>"
178
- elsif @format == 'json'
179
- "'#{tgt}':null,"
180
- end
181
- end
182
-
183
- def format_unknown_tgt(tgt)
184
- if @format.nil?
185
- "#{tgt.to_s.red.bold}: " + "unknown".yellow
186
- else
187
- format_tgt("#{tgt} (unknown)")
188
- end
189
- end
190
-
191
- def format_tgt_with_versions(tgt, versions)
192
- if @format.nil?
193
- "#{tgt.to_s.green.bold}: #{versions.join(', ').yellow} "
194
- elsif @format == 'xml'
195
- "<#{tgt}>#{versions.join(', ')}</#{tgt}>"
196
- elsif @format == 'json'
197
- "'#{tgt}':['#{versions.join('\', \'')}'],"
198
- end
199
- end
200
-
201
- def print_header
202
- if @format == 'xml'
203
- puts '<dependencies>'
204
- elsif @format == 'json'
205
- puts '{'
206
- end
207
- end
208
-
209
- def print_footer
210
- if @format == 'xml'
211
- puts "</dependencies>"
212
- elsif @format == 'json'
213
- puts "}"
214
- end
215
- end
216
-
217
- def print_dep(tgt, dep, versions)
218
- # XXX little bit hacky but works for now
219
- @last_dep ||= nil
220
- if @last_dep != dep
221
- puts format_end_dep(@last_dep) unless @last_dep.nil?
222
- puts format_dep(dep)
223
- @last_dep = dep
224
- end
225
-
226
- if versions.blank? || (versions.size == 1 && versions.first.blank?)
227
- print format_tgt(tgt)
228
-
229
- elsif versions.size == 1 && versions.first == :unknown
230
- print format_unknown_tgt(tgt)
231
-
232
- else
233
- print format_tgt_with_versions(tgt, versions)
234
- end
235
- end
236
-
33
+ set_targets conf
34
+ configure_targets conf
35
+ set_format conf
237
36
  print_header
238
-
239
- if conf[:gemname]
240
- gem = Polisher::Gem.retrieve(conf[:gemname])
241
- gem.versions(:recursive => true,
242
- :dev_deps => conf[:devel_deps]) do |tgt, dep, versions|
243
- print_dep(tgt, dep, versions)
244
- end
245
-
246
- elsif conf[:gemspec]
247
- gem = Polisher::Gem.from_gemspec(conf[:gemspec])
248
- gem.versions(:recursive => true,
249
- :dev_deps => conf[:devel_deps]) do |tgt, dep, versions|
250
- print_dep(tgt, dep, versions)
251
- end
252
-
253
- elsif conf[:gemfile]
254
- gemfile = nil
255
-
256
- begin
257
- gemfile = Polisher::Gemfile.parse(conf[:gemfile], :groups => conf[:groups])
258
- rescue => e
259
- puts "Runtime err #{e}".red
260
- exit 1
261
- end
262
-
263
- gemfile.dependency_versions :recursive => true,
264
- :dev_deps => conf[:devel_deps] do |tgt, dep, versions|
265
- print_dep(tgt, dep, versions)
266
- end
37
+ begin
38
+ print_deps conf
39
+ rescue Exception
267
40
  end
268
-
269
- puts format_end_dep(@last_dep) unless @last_dep.nil? # XXX
270
41
  print_footer
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/ruby
2
+ # Gem Dependency Mapper
3
+ #
4
+ # Licensed under the MIT license
5
+ # Copyright (C) 2015 Red Hat, Inc.
6
+ ###########################################################
7
+
8
+ require 'polisher/gemfile'
9
+ require 'polisher/util/config'
10
+
11
+ require 'polisher/cli/all'
12
+ require 'polisher/cli/bin/gem_mapper'
13
+
14
+ include Polisher::CLI
15
+
16
+ conf = gem_mapper_conf
17
+ optparse = gem_mapper_parser
18
+ optparse.parse!
19
+
20
+ validate_sources
21
+
22
+ Polisher::Logging.level = conf[:log_level]
23
+ Polisher::Config.set
24
+ begin
25
+ print_tree conf
26
+ rescue Exception => e
27
+ end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/ruby
2
+ # Display consolidated gems needing updating
3
+ #
4
+ # Licensed under the MIT license
5
+ # Copyright (C) 2015 Red Hat, Inc.
6
+
7
+ require 'polisher/util/logger'
8
+ require 'polisher/util/config'
9
+
10
+ require 'polisher/cli/all'
11
+ require 'polisher/cli/bin/gems2update'
12
+
13
+ include Polisher::CLI
14
+
15
+ conf = gems2update_conf
16
+ optparse = gems2update_parser
17
+ optparse.parse!
18
+
19
+ Polisher::Logging.level = conf[:log_level]
20
+ Polisher::Config.set
21
+ set_targets conf
22
+ configure_targets conf
23
+
24
+ begin
25
+ check_gems conf
26
+ rescue Exception => e
27
+ end
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/ruby
2
+ # Diff a Git Gem Against its Rubygems equivalent
3
+ #
4
+ # ./git_gem_diff.rb
5
+ #
6
+ # Licensed under the MIT license
7
+ # Copyright (C) 2014 Red Hat, Inc.
8
+ ###########################################################
9
+
10
+ require 'colored'
11
+ require 'polisher/git/pkg'
12
+ require 'polisher/git/repo'
13
+
14
+ conf = { :git => nil}
15
+
16
+ optparse = OptionParser.new do |opts|
17
+ opts.on('-h', '--help', 'Display this help screen') do
18
+ puts opts
19
+ exit
20
+ end
21
+
22
+ opts.on('-g', '--git [url]', 'url') do |url|
23
+ conf[:git] = url
24
+ end
25
+ end
26
+
27
+ optparse.parse!
28
+
29
+ if conf[:git].nil?
30
+ puts "Must specify a git url".bold.red
31
+ exit 1
32
+ end
33
+
34
+ git = Polisher::Git::Repo.new :url => conf[:git]
35
+ git.clone unless git.cloned?
36
+
37
+ name, version = nil
38
+
39
+ git.in_repo do
40
+ gemspec_path = Dir.glob('*.gemspec').first
41
+ gem = Polisher::Gem.from_gemspec gemspec_path
42
+ name = gem.name
43
+ version = gem.version
44
+ end
45
+
46
+ gem = Polisher::Gem.from_rubygems name, version
47
+ diff = gem.diff(git)
48
+ puts diff