gjp 0.37.0 → 0.38.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/.rubocop.yml +3 -0
  2. data/.rubocop_todo.yml +0 -130
  3. data/Rakefile +2 -2
  4. data/gjp.gemspec +2 -2
  5. data/integration-tests/commons.sh +1 -1
  6. data/lib/gjp.rb +12 -12
  7. data/lib/gjp/ant_runner.rb +2 -2
  8. data/lib/gjp/archiver.rb +13 -11
  9. data/lib/gjp/commands/ant.rb +1 -1
  10. data/lib/gjp/commands/base.rb +25 -26
  11. data/lib/gjp/commands/{download-maven-source-jars.rb → download_maven_source_jars.rb} +0 -0
  12. data/lib/gjp/commands/{dry-run.rb → dry_run.rb} +0 -0
  13. data/lib/gjp/commands/finish.rb +0 -1
  14. data/lib/gjp/commands/{generate-all.rb → generate_all.rb} +3 -4
  15. data/lib/gjp/commands/{generate-kit-archive.rb → generate_kit_archive.rb} +0 -1
  16. data/lib/gjp/commands/{generate-kit-spec.rb → generate_kit_spec.rb} +0 -1
  17. data/lib/gjp/commands/{generate-package-archive.rb → generate_package_archive.rb} +1 -2
  18. data/lib/gjp/commands/{generate-package-script.rb → generate_package_script.rb} +1 -2
  19. data/lib/gjp/commands/{generate-package-spec.rb → generate_package_spec.rb} +3 -4
  20. data/lib/gjp/commands/{get-pom.rb → get_pom.rb} +10 -9
  21. data/lib/gjp/commands/{get-source.rb → get_source.rb} +4 -5
  22. data/lib/gjp/commands/init.rb +0 -1
  23. data/lib/gjp/commands/{list-kit-missing-sources.rb → list_kit_missing_sources.rb} +1 -2
  24. data/lib/gjp/commands/{move-jars-to-kit.rb → move_jars_to_kit.rb} +0 -1
  25. data/lib/gjp/commands/mvn.rb +1 -2
  26. data/lib/gjp/git.rb +16 -14
  27. data/lib/gjp/kit_checker.rb +6 -6
  28. data/lib/gjp/kit_runner.rb +2 -2
  29. data/lib/gjp/kit_spec_adapter.rb +1 -2
  30. data/lib/gjp/logger.rb +16 -13
  31. data/lib/gjp/main.rb +0 -1
  32. data/lib/gjp/maven_runner.rb +2 -2
  33. data/lib/gjp/maven_website.rb +14 -14
  34. data/lib/gjp/package_spec_adapter.rb +9 -8
  35. data/lib/gjp/pom.rb +13 -14
  36. data/lib/gjp/pom_getter.rb +18 -16
  37. data/lib/gjp/project.rb +21 -22
  38. data/lib/gjp/script_generator.rb +8 -8
  39. data/lib/gjp/source_getter.rb +3 -3
  40. data/lib/gjp/spec_generator.rb +3 -3
  41. data/lib/gjp/template_manager.rb +2 -2
  42. data/lib/gjp/version.rb +1 -1
  43. data/lib/gjp/version_matcher.rb +32 -35
  44. data/spec/lib/archiver_spec.rb +3 -3
  45. data/spec/lib/git_spec.rb +1 -1
  46. data/spec/lib/kit_checker_spec.rb +10 -10
  47. data/spec/lib/pom_getter_spec.rb +2 -3
  48. data/spec/lib/pom_spec.rb +2 -3
  49. data/spec/lib/project_spec.rb +10 -10
  50. data/spec/lib/script_generator_spec.rb +1 -2
  51. data/spec/lib/source_getter_spec.rb +0 -1
  52. data/spec/lib/spec_generator_spec.rb +0 -1
  53. data/spec/lib/template_manager_spec.rb +1 -1
  54. data/spec/lib/version_matcher_spec.rb +8 -9
  55. data/spec/spec_helper.rb +0 -3
  56. metadata +13 -13
data/.rubocop.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ ClassLength:
4
+ Max: 200
5
+
3
6
  LineLength:
4
7
  Max: 120
5
8
 
data/.rubocop_todo.yml CHANGED
@@ -5,29 +5,6 @@
5
5
  # Note that changes in the inspected code, or installation of new
6
6
  # versions of RuboCop, may require this file to be generated again.
7
7
 
8
- # Offense count: 2
9
- ClassVars:
10
- Enabled: false
11
-
12
- # Offense count: 2
13
- # Cop supports --auto-correct.
14
- ColonMethodCall:
15
- Enabled: false
16
-
17
- # Offense count: 6
18
- # Cop supports --auto-correct.
19
- CommentIndentation:
20
- Enabled: false
21
-
22
- # Offense count: 1
23
- CyclomaticComplexity:
24
- Max: 8
25
-
26
- # Offense count: 6
27
- # Cop supports --auto-correct.
28
- DeprecatedClassMethods:
29
- Enabled: false
30
-
31
8
  # Offense count: 8
32
9
  Documentation:
33
10
  Enabled: false
@@ -36,20 +13,10 @@ Documentation:
36
13
  DoubleNegation:
37
14
  Enabled: false
38
15
 
39
- # Offense count: 1
40
- # Cop supports --auto-correct.
41
- EmptyLines:
42
- Enabled: false
43
-
44
16
  # Offense count: 1
45
17
  EmptyLinesAroundAccessModifier:
46
18
  Enabled: false
47
19
 
48
- # Offense count: 1
49
- # Cop supports --auto-correct.
50
- EmptyLinesAroundBody:
51
- Enabled: false
52
-
53
20
  # Offense count: 2
54
21
  # Configuration parameters: EnforcedStyle, SupportedStyles.
55
22
  Encoding:
@@ -70,37 +37,11 @@ FormatString:
70
37
  GuardClause:
71
38
  Enabled: false
72
39
 
73
- # Offense count: 27
74
- # Cop supports --auto-correct.
75
- # Configuration parameters: SupportedStyles.
76
- HashSyntax:
77
- EnforcedStyle: hash_rockets
78
-
79
40
  # Offense count: 7
80
41
  # Configuration parameters: MaxLineLength.
81
42
  IfUnlessModifier:
82
43
  Enabled: false
83
44
 
84
- # Offense count: 3
85
- # Cop supports --auto-correct.
86
- IndentationConsistency:
87
- Enabled: false
88
-
89
- # Offense count: 15
90
- # Cop supports --auto-correct.
91
- IndentationWidth:
92
- Enabled: false
93
-
94
- # Offense count: 3
95
- # Cop supports --auto-correct.
96
- LineEndConcatenation:
97
- Enabled: false
98
-
99
- # Offense count: 4
100
- # Cop supports --auto-correct.
101
- MethodCallParentheses:
102
- Enabled: false
103
-
104
45
  # Offense count: 28
105
46
  # Configuration parameters: CountComments.
106
47
  MethodLength:
@@ -115,22 +56,6 @@ MultilineBlockChain:
115
56
  Next:
116
57
  Enabled: false
117
58
 
118
- # Offense count: 8
119
- # Cop supports --auto-correct.
120
- NilComparison:
121
- Enabled: false
122
-
123
- # Offense count: 12
124
- # Cop supports --auto-correct.
125
- # Configuration parameters: IncludeSemanticChanges.
126
- NonNilCheck:
127
- Enabled: false
128
-
129
- # Offense count: 1
130
- # Cop supports --auto-correct.
131
- PerlBackrefs:
132
- Enabled: false
133
-
134
59
  # Offense count: 3
135
60
  # Configuration parameters: NamePrefixBlacklist.
136
61
  PredicateName:
@@ -141,17 +66,6 @@ PredicateName:
141
66
  RaiseArgs:
142
67
  EnforcedStyle: compact
143
68
 
144
- # Offense count: 2
145
- # Cop supports --auto-correct.
146
- RedundantBegin:
147
- Enabled: false
148
-
149
- # Offense count: 8
150
- # Cop supports --auto-correct.
151
- # Configuration parameters: AllowMultipleReturnValues.
152
- RedundantReturn:
153
- Enabled: false
154
-
155
69
  # Offense count: 1
156
70
  # Configuration parameters: MaxSlashes.
157
71
  RegexpLiteral:
@@ -167,34 +81,6 @@ ShadowingOuterLocalVariable:
167
81
  SignalException:
168
82
  Enabled: false
169
83
 
170
- # Offense count: 11
171
- # Cop supports --auto-correct.
172
- SpaceAfterComma:
173
- Enabled: false
174
-
175
- # Offense count: 8
176
- # Cop supports --auto-correct.
177
- SpaceAroundOperators:
178
- Enabled: false
179
-
180
- # Offense count: 2
181
- # Cop supports --auto-correct.
182
- # Configuration parameters: EnforcedStyle, SupportedStyles.
183
- SpaceBeforeBlockBraces:
184
- Enabled: false
185
-
186
- # Offense count: 13
187
- # Cop supports --auto-correct.
188
- # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
189
- SpaceInsideBlockBraces:
190
- Enabled: false
191
-
192
- # Offense count: 22
193
- # Cop supports --auto-correct.
194
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
195
- SpaceInsideHashLiteralBraces:
196
- Enabled: false
197
-
198
84
  # Offense count: 4
199
85
  # Cop supports --auto-correct.
200
86
  SpecialGlobalVars:
@@ -204,22 +90,6 @@ SpecialGlobalVars:
204
90
  Tab:
205
91
  Enabled: false
206
92
 
207
- # Offense count: 8
208
- # Cop supports --auto-correct.
209
- # Configuration parameters: EnforcedStyle, SupportedStyles.
210
- TrailingBlankLines:
211
- Enabled: false
212
-
213
- # Offense count: 2
214
- # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
215
- TrailingComma:
216
- Enabled: false
217
-
218
- # Offense count: 45
219
- # Cop supports --auto-correct.
220
- TrailingWhitespace:
221
- Enabled: false
222
-
223
93
  # Offense count: 2
224
94
  # Cop supports --auto-correct.
225
95
  # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
data/Rakefile CHANGED
@@ -3,5 +3,5 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new
5
5
 
6
- task :default => :test
7
- task :test => :spec
6
+ task default: :test
7
+ task test: :spec
data/gjp.gemspec CHANGED
@@ -16,12 +16,12 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_development_dependency "rake"
23
23
  s.add_development_dependency "rspec"
24
-
24
+
25
25
  s.add_runtime_dependency "clamp"
26
26
  s.add_runtime_dependency "rubyzip", ">= 1.0"
27
27
  s.add_runtime_dependency "rest-client"
@@ -22,7 +22,7 @@ unzip apache-maven-*.zip
22
22
  rm apache-maven-*.zip
23
23
  cd ..
24
24
 
25
- gjp dry-run
25
+ gjp dry-run --very-very-verbose
26
26
  cd src/commons-collections/commons-collections-3.2.1-src/
27
27
  gjp mvn package -DskipTests
28
28
  gjp finish
data/lib/gjp.rb CHANGED
@@ -23,20 +23,20 @@ require "gjp/kit_checker"
23
23
  require "gjp/commands/base"
24
24
 
25
25
  require "gjp/commands/ant"
26
- require "gjp/commands/download-maven-source-jars"
27
- require "gjp/commands/dry-run"
26
+ require "gjp/commands/download_maven_source_jars"
27
+ require "gjp/commands/dry_run"
28
28
  require "gjp/commands/finish"
29
- require "gjp/commands/generate-all"
30
- require "gjp/commands/generate-kit-archive"
31
- require "gjp/commands/generate-kit-spec"
32
- require "gjp/commands/generate-package-archive"
33
- require "gjp/commands/generate-package-script"
34
- require "gjp/commands/generate-package-spec"
35
- require "gjp/commands/get-pom"
36
- require "gjp/commands/get-source"
29
+ require "gjp/commands/generate_all"
30
+ require "gjp/commands/generate_kit_archive"
31
+ require "gjp/commands/generate_kit_spec"
32
+ require "gjp/commands/generate_package_archive"
33
+ require "gjp/commands/generate_package_script"
34
+ require "gjp/commands/generate_package_spec"
35
+ require "gjp/commands/get_pom"
36
+ require "gjp/commands/get_source"
37
37
  require "gjp/commands/init"
38
- require "gjp/commands/list-kit-missing-sources"
39
- require "gjp/commands/move-jars-to-kit"
38
+ require "gjp/commands/list_kit_missing_sources"
39
+ require "gjp/commands/move_jars_to_kit"
40
40
  require "gjp/commands/mvn"
41
41
 
42
42
  require "gjp/main"
@@ -3,7 +3,7 @@
3
3
  module Gjp
4
4
  # runs Ant with gjp-specific options
5
5
  class AntRunner < KitRunner
6
- include Logger
6
+ include Logging
7
7
 
8
8
  # runs ant in a subprocess
9
9
  def ant(options)
@@ -15,7 +15,7 @@ module Gjp
15
15
  def get_ant_commandline(prefix)
16
16
  executable = find_executable("ant")
17
17
 
18
- if executable != nil
18
+ if !executable.nil?
19
19
  ant_path = File.join(prefix, executable)
20
20
 
21
21
  "#{ant_path}"
data/lib/gjp/archiver.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Gjp
4
4
  # generates file archives that accompany spec files
5
5
  class Archiver
6
- include Logger
6
+ include Logging
7
7
 
8
8
  def initialize(project)
9
9
  @project = project
@@ -18,16 +18,18 @@ module Gjp
18
18
 
19
19
  @project.take_snapshot "Kit archival started"
20
20
 
21
- destination_file = if full
22
- remove_stale_incremental(destination_dir, file_prefix, file_suffix)
23
- archive_single("kit", File.join(destination_dir, file_prefix + file_suffix))
24
- else
25
- log.debug "doing incremental archive"
26
- archive_incremental("kit", destination_dir, file_prefix, file_suffix, :archive_kit)
27
- end
21
+ destination_file = (
22
+ if full
23
+ remove_stale_incremental(destination_dir, file_prefix, file_suffix)
24
+ archive_single("kit", File.join(destination_dir, file_prefix + file_suffix))
25
+ else
26
+ log.debug "doing incremental archive"
27
+ archive_incremental("kit", destination_dir, file_prefix, file_suffix, :archive_kit)
28
+ end
29
+ )
28
30
 
29
31
  @project.take_snapshot "Kit archive generated", :archive_kit
30
-
32
+
31
33
  destination_file
32
34
  end
33
35
 
@@ -66,7 +68,7 @@ module Gjp
66
68
 
67
69
  log.debug "files that changed since then: #{@project.git.changed_files_since(tag)}"
68
70
  list = @project.git.changed_files_since(tag).select do |file|
69
- File.expand_path(file) =~ /^#{File.expand_path(source_directory)}\//
71
+ File.expand_path(file) =~ /^#{File.expand_path(source_directory)}\//
70
72
  end.map do |file|
71
73
  Pathname.new(file).relative_path_from Pathname.new(source_directory)
72
74
  end
@@ -82,7 +84,7 @@ module Gjp
82
84
  # removes any stale incremental files
83
85
  def remove_stale_incremental(destination_dir, file_prefix, file_suffix)
84
86
  Dir.entries(destination_dir)
85
- .select { |f| f =~ /^#{file_prefix}_([0-9]+)#{file_suffix}$/}
87
+ .select { |f| f =~ /^#{file_prefix}_([0-9]+)#{file_suffix}$/ }
86
88
  .each do |f|
87
89
  log.debug "removing stale incremental archive #{f}"
88
90
  File.delete(File.join(destination_dir, f))
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Gjp
4
4
  class AntCommand < Gjp::BaseCommand
5
- parameter "[ANT OPTIONS] ...", "ant options", :attribute_name => "dummy"
5
+ parameter "[ANT OPTIONS] ...", "ant options", attribute_name: "dummy"
6
6
 
7
7
  # override parsing in order to pipe everything to mvn
8
8
  def parse(args)
@@ -3,10 +3,9 @@ require "clamp"
3
3
  require "gjp/logger"
4
4
 
5
5
  module Gjp
6
-
7
6
  # implements common options and utility methods
8
7
  class BaseCommand < Clamp::Command
9
- include Logger
8
+ include Logging
10
9
 
11
10
  # Options available to all gjp commands
12
11
  option ["-v", "--verbose"], :flag, "verbose output"
@@ -17,11 +16,11 @@ module Gjp
17
16
  def very_very_verbose=(flag)
18
17
  configure_log_level(verbose?, very_verbose?, flag)
19
18
  end
20
-
19
+
21
20
  def very_verbose=(flag)
22
21
  configure_log_level(verbose?, flag, very_very_verbose?)
23
22
  end
24
-
23
+
25
24
  def verbose=(flag)
26
25
  configure_log_level(flag, very_verbose?, very_very_verbose?)
27
26
  end
@@ -62,33 +61,33 @@ module Gjp
62
61
 
63
62
  # generates a version of path relative to the current directory
64
63
  def format_path(path, project)
65
- full_path = if Pathname.new(path).relative?
66
- File.join(project.full_path, path)
67
- else
68
- path
69
- end
64
+ full_path = (
65
+ if Pathname.new(path).relative?
66
+ File.join(project.full_path, path)
67
+ else
68
+ path
69
+ end
70
+ )
70
71
  Pathname.new(full_path).relative_path_from(Pathname.new(Dir.pwd))
71
72
  end
72
73
 
73
74
  # handles most fatal exceptions
74
75
  def checking_exceptions
75
- begin
76
- yield
77
- rescue Errno::EACCES => e
78
- $stderr.puts e
79
- rescue Errno::ENOENT => e
80
- $stderr.puts e
81
- rescue Errno::EEXIST => e
82
- $stderr.puts e
83
- rescue NoProjectDirectoryError => e
84
- $stderr.puts "#{e.directory} is not a gjp project directory, see gjp init"
85
- rescue NoPackageDirectoryError => e
86
- $stderr.puts "#{e.directory} is not a gjp package directory, see README"
87
- rescue GitAlreadyInitedError => e
88
- $stderr.puts "This directory is already a gjp project"
89
- rescue ExecutableNotFoundError => e
90
- $stderr.puts "Executable #{e.executable} not found in kit/ or any of its subdirectories"
91
- end
76
+ yield
77
+ rescue Errno::EACCES => e
78
+ $stderr.puts e
79
+ rescue Errno::ENOENT => e
80
+ $stderr.puts e
81
+ rescue Errno::EEXIST => e
82
+ $stderr.puts e
83
+ rescue NoProjectDirectoryError => e
84
+ $stderr.puts "#{e.directory} is not a gjp project directory, see gjp init"
85
+ rescue NoPackageDirectoryError => e
86
+ $stderr.puts "#{e.directory} is not a gjp package directory, see README"
87
+ rescue GitAlreadyInitedError => e
88
+ $stderr.puts "This directory is already a gjp project"
89
+ rescue ExecutableNotFoundError => e
90
+ $stderr.puts "Executable #{e.executable} not found in kit/ or any of its subdirectories"
92
91
  end
93
92
  end
94
93
  end
File without changes
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Gjp
4
4
  class FinishCommand < Gjp::BaseCommand
5
-
6
5
  option ["-a", "--abort"], :flag, "build abort, restore files as before dry-run"
7
6
 
8
7
  def execute
@@ -2,11 +2,10 @@
2
2
 
3
3
  module Gjp
4
4
  class GenerateAllCommand < Gjp::BaseCommand
5
-
6
- option ["-f", "--filter"], "FILTER", "filter files to be installed by this package spec", :default => "*.jar"
5
+ option ["-f", "--filter"], "FILTER", "filter files to be installed by this package spec", default: "*.jar"
7
6
  option ["-f", "--full"], :flag, "create a full archive (not incremental)"
8
- parameter "[DIRECTORY]", "path to a package directory (src/<package name>)", :default => "."
9
- parameter "[POM]", "a package pom file path", :default => "pom.xml"
7
+ parameter "[DIRECTORY]", "path to a package directory (src/<package name>)", default: "."
8
+ parameter "[POM]", "a package pom file path", default: "pom.xml"
10
9
 
11
10
  def execute
12
11
  checking_exceptions do