compact_index 0.9.4 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad1dc1768a2c3699451729892496cc84c87b47fa
4
- data.tar.gz: bc2a2568b268897a9292262754183cd959bbb1e2
3
+ metadata.gz: e482659a6122776eafafea998d383a1a252c1247
4
+ data.tar.gz: f7d608614cf0e5352b802b62c1b49639233b2cba
5
5
  SHA512:
6
- metadata.gz: 37ac28ed2d9c66a90e905dabb7fb7f21b6c74272bca4a03d894cdfad2c5f96618ac032c7eae406a52912eda9c34f936a1f87cdd4abc953646a9565acc83fb9be
7
- data.tar.gz: 56316d3972c1cac287f3bf02d16d5f39f01a4891bb9a6ca089781abdd852a2f4a83a06ff482985b0f5e439a877192cabce411af08ea7de722f7091064d067ff3
6
+ metadata.gz: 34ca690508948503066eb677d520b367ac8bde9fa08102a692d0921d20afd85ed5e7182f692475c8a197cd03ac0c2d9a5d317c213017c21c58287a66d71192be
7
+ data.tar.gz: 61a3ef799c846ceef782d1ca645a9ecc6eb10293456491bd3b1b753e3087356a54507dcc47b6fc080a6a9e0ad410564e931d1d9cdbdbb87c4b78317c877b8dda
@@ -46,11 +46,6 @@ Style/StringLiterals:
46
46
  Style/StringLiteralsInInterpolation:
47
47
  EnforcedStyle: double_quotes
48
48
 
49
- # Having these make it easier to *not* forget to add one when adding a new
50
- # value and you can simply copy the previous line.
51
- Style/TrailingComma:
52
- EnforcedStyleForMultiline: comma
53
-
54
49
  # 1.8.7 support
55
50
 
56
51
  Style/HashSyntax:
@@ -68,9 +63,6 @@ Style/EachWithObject:
68
63
  Style/SpecialGlobalVars:
69
64
  Enabled: false
70
65
 
71
- Style/TrailingComma:
72
- Enabled: false
73
-
74
66
  # Metrics
75
67
 
76
68
  # We've chosen to use Rubocop only for style, and not for complexity or quality checks.
@@ -1,4 +1,4 @@
1
1
  inherit_from: .rubocop-bundler.yml
2
2
 
3
- AllCops:
4
- DisplayCopNames: true
3
+ Style/FrozenStringLiteralComment:
4
+ EnforcedStyle: always
@@ -1,389 +1,46 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2015-07-20 19:11:40 -0300 using RuboCop version 0.32.1.
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-01-21 10:40:40 -0600 using RuboCop version 0.36.0.
3
4
  # The point is for the user to remove these configuration records
4
5
  # one by one as the offenses are removed from the code base.
5
6
  # Note that changes in the inspected code, or installation of new
6
7
  # versions of RuboCop, may require this file to be generated again.
7
8
 
8
9
  # Offense count: 1
9
- Lint/AmbiguousOperator:
10
- Enabled: false
10
+ Lint/IneffectiveAccessModifier:
11
+ Exclude:
12
+ - 'lib/compact_index.rb'
11
13
 
12
14
  # Offense count: 1
13
- # Configuration parameters: AllowSafeAssignment.
14
- Lint/AssignmentInCondition:
15
- Enabled: false
15
+ Lint/UselessAccessModifier:
16
+ Exclude:
17
+ - 'lib/compact_index.rb'
16
18
 
17
- # Offense count: 1
18
- # Cop supports --auto-correct.
19
- Lint/DeprecatedClassMethods:
20
- Enabled: false
21
-
22
- # Offense count: 2
23
- Lint/Eval:
24
- Enabled: false
25
-
26
- # Offense count: 1
27
- Lint/HandleExceptions:
28
- Enabled: false
29
-
30
- # Offense count: 1
31
- Lint/LiteralInCondition:
32
- Enabled: false
33
-
34
- # Offense count: 2
35
- Lint/NestedMethodDefinition:
36
- Enabled: false
37
-
38
- # Offense count: 1
39
- Lint/ShadowingOuterLocalVariable:
40
- Enabled: false
41
-
42
- # Offense count: 5
43
- # Cop supports --auto-correct.
44
- Lint/UnusedBlockArgument:
45
- Enabled: false
46
-
47
- # Offense count: 3
48
- # Cop supports --auto-correct.
49
- Lint/UnusedMethodArgument:
50
- Enabled: false
51
-
52
- # Offense count: 10
19
+ # Offense count: 6
53
20
  Lint/UselessAssignment:
54
- Enabled: false
55
-
56
- # Offense count: 11
57
- Metrics/AbcSize:
58
- Max: 43
59
-
60
- # Offense count: 2
61
- # Configuration parameters: CountComments.
62
- Metrics/ClassLength:
63
- Max: 143
64
-
65
- # Offense count: 1
66
- Metrics/CyclomaticComplexity:
67
- Max: 7
68
-
69
- # Offense count: 65
70
- # Configuration parameters: AllowURI, URISchemes.
21
+ Exclude:
22
+ - 'Rakefile'
23
+ - 'spec/compact_index_spec.rb'
24
+ - 'spec/support/versions.rb'
25
+ - 'spec/versions_file_spec.rb'
26
+
27
+ # Offense count: 36
28
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
29
+ # URISchemes: http, https
71
30
  Metrics/LineLength:
72
31
  Max: 122
73
32
 
74
- # Offense count: 21
75
- # Configuration parameters: CountComments.
76
- Metrics/MethodLength:
77
- Max: 34
78
-
79
- # Offense count: 2
80
- # Cop supports --auto-correct.
81
- # Configuration parameters: EnforcedStyle, SupportedStyles.
82
- Style/AccessModifierIndentation:
83
- Enabled: false
84
-
85
- # Offense count: 3
86
- Style/AccessorMethodName:
87
- Enabled: false
88
-
89
- # Offense count: 5
90
- # Cop supports --auto-correct.
91
- Style/AlignArray:
92
- Enabled: false
93
-
94
- # Offense count: 3
95
- # Cop supports --auto-correct.
96
- # Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
97
- Style/AlignHash:
98
- Enabled: false
99
-
100
- # Offense count: 3
101
- # Cop supports --auto-correct.
102
- # Configuration parameters: EnforcedStyle, SupportedStyles.
103
- Style/AlignParameters:
104
- Enabled: false
105
-
106
33
  # Offense count: 1
107
34
  # Cop supports --auto-correct.
108
- # Configuration parameters: EnforcedStyle, SupportedStyles.
109
- Style/AndOr:
110
- Enabled: false
111
-
112
- # Offense count: 9
113
- # Cop supports --auto-correct.
114
- # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
115
- Style/BlockDelimiters:
116
- Enabled: false
117
-
118
- # Offense count: 2
119
- # Cop supports --auto-correct.
120
- Style/BlockEndNewline:
121
- Enabled: false
35
+ Performance/RedundantMatch:
36
+ Exclude:
37
+ - 'lib/compact_index/versions_file.rb'
122
38
 
123
39
  # Offense count: 3
124
- # Cop supports --auto-correct.
125
- # Configuration parameters: EnforcedStyle, SupportedStyles.
126
- Style/BracesAroundHashParameters:
127
- Enabled: false
128
-
129
- # Offense count: 12
130
- # Configuration parameters: EnforcedStyle, SupportedStyles.
131
- Style/ClassAndModuleChildren:
132
- Enabled: false
133
-
134
- # Offense count: 9
135
- Style/ClassVars:
136
- Enabled: false
137
-
138
- # Offense count: 31
139
40
  Style/Documentation:
140
- Enabled: false
141
-
142
- # Offense count: 9
143
- # Cop supports --auto-correct.
144
- # Configuration parameters: EnforcedStyle, SupportedStyles.
145
- Style/DotPosition:
146
- Enabled: false
147
-
148
- # Offense count: 2
149
- # Cop supports --auto-correct.
150
- # Configuration parameters: AllowAdjacentOneLineDefs.
151
- Style/EmptyLineBetweenDefs:
152
- Enabled: false
153
-
154
- # Offense count: 1
155
- # Cop supports --auto-correct.
156
- Style/EmptyLines:
157
- Enabled: false
158
-
159
- # Offense count: 6
160
- # Cop supports --auto-correct.
161
- Style/EmptyLinesAroundAccessModifier:
162
- Enabled: false
163
-
164
- # Offense count: 1
165
- # Cop supports --auto-correct.
166
- # Configuration parameters: EnforcedStyle, SupportedStyles.
167
- Style/EmptyLinesAroundBlockBody:
168
- Enabled: false
169
-
170
- # Offense count: 2
171
- # Cop supports --auto-correct.
172
- # Configuration parameters: EnforcedStyle, SupportedStyles.
173
- Style/EmptyLinesAroundClassBody:
174
- Enabled: false
175
-
176
- # Offense count: 12
177
- # Configuration parameters: AllowedVariables.
178
- Style/GlobalVars:
179
- Enabled: false
180
-
181
- # Offense count: 2
182
- # Configuration parameters: MinBodyLength.
183
- Style/GuardClause:
184
- Enabled: false
185
-
186
- # Offense count: 85
187
- # Cop supports --auto-correct.
188
- # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
189
- Style/HashSyntax:
190
- Enabled: false
191
-
192
- # Offense count: 1
193
- # Cop supports --auto-correct.
194
- # Configuration parameters: MaxLineLength.
195
- Style/IfUnlessModifier:
196
- Enabled: false
197
-
198
- # Offense count: 1
199
- # Cop supports --auto-correct.
200
- Style/IndentArray:
201
- Enabled: false
202
-
203
- # Offense count: 1
204
- # Cop supports --auto-correct.
205
- # Configuration parameters: Width.
206
- Style/IndentationWidth:
207
- Enabled: false
208
-
209
- # Offense count: 1
210
- # Cop supports --auto-correct.
211
- Style/InfiniteLoop:
212
- Enabled: false
213
-
214
- # Offense count: 1
215
- # Cop supports --auto-correct.
216
- Style/Lambda:
217
- Enabled: false
218
-
219
- # Offense count: 1
220
- # Cop supports --auto-correct.
221
- Style/LeadingCommentSpace:
222
- Enabled: false
223
-
224
- # Offense count: 1
225
- # Cop supports --auto-correct.
226
- Style/LineEndConcatenation:
227
- Enabled: false
228
-
229
- # Offense count: 3
230
- # Cop supports --auto-correct.
231
- Style/MethodCallParentheses:
232
- Enabled: false
233
-
234
- # Offense count: 1
235
- Style/MultilineBlockChain:
236
- Enabled: false
237
-
238
- # Offense count: 2
239
- # Cop supports --auto-correct.
240
- Style/MultilineBlockLayout:
241
- Enabled: false
242
-
243
- # Offense count: 1
244
- # Cop supports --auto-correct.
245
- # Configuration parameters: EnforcedStyle, SupportedStyles.
246
- Style/MultilineOperationIndentation:
247
- Enabled: false
248
-
249
- # Offense count: 1
250
- # Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
251
- Style/Next:
252
- Enabled: false
253
-
254
- # Offense count: 1
255
- # Cop supports --auto-correct.
256
- Style/NumericLiterals:
257
- MinDigits: 9
258
-
259
- # Offense count: 4
260
- # Cop supports --auto-correct.
261
- # Configuration parameters: PreferredDelimiters.
262
- Style/PercentLiteralDelimiters:
263
- Enabled: false
264
-
265
- # Offense count: 1
266
- # Cop supports --auto-correct.
267
- # Configuration parameters: AllowAsExpressionSeparator.
268
- Style/Semicolon:
269
- Enabled: false
270
-
271
- # Offense count: 4
272
- # Cop supports --auto-correct.
273
- # Configuration parameters: EnforcedStyle, SupportedStyles.
274
- Style/SignalException:
275
- Enabled: false
276
-
277
- # Offense count: 1
278
- # Configuration parameters: Methods.
279
- Style/SingleLineBlockParams:
280
- Enabled: false
281
-
282
- # Offense count: 2
283
- # Cop supports --auto-correct.
284
- # Configuration parameters: AllowIfMethodIsEmpty.
285
- Style/SingleLineMethods:
286
- Enabled: false
287
-
288
- # Offense count: 1
289
- # Cop supports --auto-correct.
290
- Style/SingleSpaceBeforeFirstArg:
291
- Enabled: false
292
-
293
- # Offense count: 1
294
- # Cop supports --auto-correct.
295
- Style/SpaceAfterComma:
296
- Enabled: false
297
-
298
- # Offense count: 61
299
- # Cop supports --auto-correct.
300
- # Configuration parameters: MultiSpaceAllowedForOperators.
301
- Style/SpaceAroundOperators:
302
- Enabled: false
303
-
304
- # Offense count: 2
305
- # Cop supports --auto-correct.
306
- # Configuration parameters: EnforcedStyle, SupportedStyles.
307
- Style/SpaceBeforeBlockBraces:
308
- Enabled: false
309
-
310
- # Offense count: 7
311
- # Cop supports --auto-correct.
312
- # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
313
- Style/SpaceInsideBlockBraces:
314
- Enabled: false
315
-
316
- # Offense count: 5
317
- # Cop supports --auto-correct.
318
- Style/SpaceInsideBrackets:
319
- Enabled: false
320
-
321
- # Offense count: 11
322
- # Cop supports --auto-correct.
323
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
324
- Style/SpaceInsideHashLiteralBraces:
325
- Enabled: false
326
-
327
- # Offense count: 40
328
- # Cop supports --auto-correct.
329
- Style/SpaceInsideParens:
330
- Enabled: false
331
-
332
- # Offense count: 13
333
- # Cop supports --auto-correct.
334
- Style/SpaceInsideStringInterpolation:
335
- Enabled: false
336
-
337
- # Offense count: 1
338
- # Cop supports --auto-correct.
339
- Style/SpecialGlobalVars:
340
- Enabled: false
341
-
342
- # Offense count: 308
343
- # Cop supports --auto-correct.
344
- # Configuration parameters: EnforcedStyle, SupportedStyles.
345
- Style/StringLiterals:
346
- Enabled: false
347
-
348
- # Offense count: 1
349
- # Cop supports --auto-correct.
350
- # Configuration parameters: EnforcedStyle, SupportedStyles.
351
- Style/StringLiteralsInInterpolation:
352
- Enabled: false
353
-
354
- # Offense count: 1
355
- Style/StructInheritance:
356
- Enabled: false
357
-
358
- # Offense count: 1
359
- # Cop supports --auto-correct.
360
- # Configuration parameters: IgnoredMethods.
361
- Style/SymbolProc:
362
- Enabled: false
363
-
364
- # Offense count: 2
365
- # Cop supports --auto-correct.
366
- # Configuration parameters: EnforcedStyle, SupportedStyles.
367
- Style/TrailingBlankLines:
368
- Enabled: false
369
-
370
- # Offense count: 2
371
- # Cop supports --auto-correct.
372
- # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
373
- Style/TrailingComma:
374
- Enabled: false
375
-
376
- # Offense count: 3
377
- # Cop supports --auto-correct.
378
- Style/TrailingUnderscoreVariable:
379
- Enabled: false
380
-
381
- # Offense count: 8
382
- # Cop supports --auto-correct.
383
- Style/TrailingWhitespace:
384
- Enabled: false
385
-
386
- # Offense count: 1
387
- # Cop supports --auto-correct.
388
- Style/UnneededCapitalW:
389
- Enabled: false
41
+ Exclude:
42
+ - 'spec/**/*'
43
+ - 'test/**/*'
44
+ - 'lib/compact_index.rb'
45
+ - 'lib/compact_index/ext/date.rb'
46
+ - 'lib/compact_index/versions_file.rb'
@@ -1,9 +1,8 @@
1
1
  language: ruby
2
+ before_install: gem install bundler
2
3
  rvm:
3
4
  - "2.3.0"
4
5
  - "2.2.4"
5
6
  - "2.1.5"
6
7
  - "1.9.3"
7
8
  - "1.8.7"
8
- script: bundle exec rspec
9
-
@@ -1,3 +1,13 @@
1
+ ## 0.10.0 (January 22, 2016)
2
+
3
+ Features:
4
+
5
+ - Frozen string literal support
6
+
7
+ Bugfixes:
8
+
9
+ - Use the last info checksum, rather than the first
10
+
1
11
  ## 0.9.4 (January 5, 2016)
2
12
 
3
13
  Features:
data/Gemfile CHANGED
@@ -1,7 +1,14 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+ source "https://rubygems.org"
2
3
 
3
4
  # Specify your gem's dependencies in compact_index.gemspec
4
5
  gemspec
5
6
 
6
- gem "yard", "~>0.8"
7
- gem "redcarpet", "~>2.3"
7
+ group :documentation do
8
+ gem "yard", "~> 0.8"
9
+ gem "redcarpet", "~> 2.3"
10
+ end
11
+
12
+ group :development do
13
+ gem "rubocop", :install_if => lambda { RUBY_VERSION >= "1.9" }
14
+ end
data/Rakefile CHANGED
@@ -1,14 +1,23 @@
1
+ # frozen_string_literal: true
1
2
  require "bundler/gem_tasks"
2
3
 
3
4
  begin
4
- require 'rspec/core/rake_task'
5
+ require "rspec/core/rake_task"
5
6
 
6
7
  desc "Run specs"
7
8
  RSpec::Core::RakeTask.new(:spec) do |t|
8
9
  t.rspec_opts = %w(--color)
9
10
  end
10
11
 
11
- task :default => :spec
12
+ begin
13
+ require "rubocop/rake_task"
14
+ RuboCop::RakeTask.new
15
+ rescue LoadError
16
+ task :rubocop
17
+ end
18
+
19
+ task :default => [:rubocop, :spec]
12
20
  rescue LoadError => e
13
21
  # rspec won't exist on production
22
+ nil
14
23
  end
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "compact_index"
@@ -1,7 +1,8 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ # frozen_string_literal: true
3
+ lib = File.expand_path("../lib", __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'compact_index/version'
5
+ require "compact_index/version"
5
6
 
6
7
  Gem::Specification.new do |spec|
7
8
  spec.name = "compact_index"
@@ -13,9 +14,9 @@ Gem::Specification.new do |spec|
13
14
  spec.homepage = "https://github.com/bundler/compact_index"
14
15
  spec.license = "MIT"
15
16
 
16
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
17
18
  spec.bindir = "exe"
18
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
19
20
  spec.require_paths = ["lib"]
20
21
 
21
22
  spec.add_development_dependency "rake", "~> 10.0"
@@ -1,73 +1,76 @@
1
+ # frozen_string_literal: true
1
2
  Sequel.migration do
2
3
  change do
3
- create_table(:dependencies, :ignore_index_errors=>true) do
4
+ create_table(:dependencies, :ignore_index_errors => true) do
4
5
  primary_key :id
5
- String :requirements, :size=>255
6
+ String :requirements, :size => 255
6
7
  DateTime :created_at
7
8
  DateTime :updated_at
8
9
  Integer :rubygem_id
9
10
  Integer :version_id
10
- String :scope, :size=>255
11
- String :unresolved_name, :size=>255
12
-
13
- index [:rubygem_id], :name=>:index_dependencies_on_rubygem_id
14
- index [:unresolved_name], :name=>:index_dependencies_on_unresolved_name
15
- index [:version_id], :name=>:index_dependencies_on_version_id
11
+ String :scope, :size => 255
12
+ String :unresolved_name, :size => 255
13
+
14
+ index [:rubygem_id], :name => :index_dependencies_on_rubygem_id
15
+ index [:unresolved_name], :name => :index_dependencies_on_unresolved_name
16
+ index [:version_id], :name => :index_dependencies_on_version_id
16
17
  end
17
-
18
- create_table(:linksets, :ignore_index_errors=>true) do
18
+
19
+ create_table(:linksets, :ignore_index_errors => true) do
19
20
  primary_key :id
20
21
  Integer :rubygem_id
21
- String :home, :size=>255
22
- String :wiki, :size=>255
23
- String :docs, :size=>255
24
- String :mail, :size=>255
25
- String :code, :size=>255
26
- String :bugs, :size=>255
22
+ String :home, :size => 255
23
+ String :wiki, :size => 255
24
+ String :docs, :size => 255
25
+ String :mail, :size => 255
26
+ String :code, :size => 255
27
+ String :bugs, :size => 255
27
28
  DateTime :created_at
28
29
  DateTime :updated_at
29
-
30
- index [:rubygem_id], :name=>:index_linksets_on_rubygem_id
30
+
31
+ index [:rubygem_id], :name => :index_linksets_on_rubygem_id
31
32
  end
32
-
33
- create_table(:rubygems, :ignore_index_errors=>true) do
33
+
34
+ create_table(:rubygems, :ignore_index_errors => true) do
34
35
  primary_key :id
35
- String :name, :size=>255
36
+ String :name, :size => 255
36
37
  DateTime :created_at
37
38
  DateTime :updated_at
38
- Integer :downloads, :default=>0
39
- String :slug, :size=>255
40
-
41
- index [:name], :name=>:index_rubygems_on_name, :unique=>true
39
+ Integer :downloads, :default => 0
40
+ String :slug, :size => 255
41
+
42
+ index [:name], :name => :index_rubygems_on_name, :unique => true
42
43
  end
43
-
44
- create_table(:versions, :ignore_index_errors=>true) do
44
+
45
+ create_table(:versions, :ignore_index_errors => true) do
45
46
  primary_key :id
46
- String :authors, :text=>true
47
- String :description, :text=>true
48
- String :number, :size=>255
47
+ String :authors, :text => true
48
+ String :description, :text => true
49
+ String :number, :size => 255
49
50
  Integer :rubygem_id
50
51
  DateTime :built_at
51
52
  DateTime :updated_at
52
- String :rubyforge_project, :size=>255
53
- String :summary, :text=>true
54
- String :platform, :size=>255
53
+ String :rubyforge_project, :size => 255
54
+ String :summary, :text => true
55
+ String :platform, :size => 255
55
56
  DateTime :created_at
56
- TrueClass :indexed, :default=>true
57
+ TrueClass :indexed, :default => true
57
58
  TrueClass :prerelease
58
59
  Integer :position
59
60
  TrueClass :latest
60
- String :full_name, :size=>255
61
-
62
- index [:built_at], :name=>:index_versions_on_built_at
63
- index [:created_at], :name=>:index_versions_on_created_at
64
- index [:full_name], :name=>:index_versions_on_full_name
65
- index [:indexed], :name=>:index_versions_on_indexed
66
- index [:number], :name=>:index_versions_on_number
67
- index [:position], :name=>:index_versions_on_position
68
- index [:prerelease], :name=>:index_versions_on_prerelease
69
- index [:rubygem_id], :name=>:index_versions_on_rubygem_id
70
- index [:rubygem_id, :number, :platform], :name=>:index_versions_on_rubygem_id_and_number_and_platform, :unique=>true
61
+ String :full_name, :size => 255
62
+
63
+ index [:built_at], :name => :index_versions_on_built_at
64
+ index [:created_at], :name => :index_versions_on_created_at
65
+ index [:full_name], :name => :index_versions_on_full_name
66
+ index [:indexed], :name => :index_versions_on_indexed
67
+ index [:number], :name => :index_versions_on_number
68
+ index [:position], :name => :index_versions_on_position
69
+ index [:prerelease], :name => :index_versions_on_prerelease
70
+ index [:rubygem_id], :name => :index_versions_on_rubygem_id
71
+ index [:rubygem_id, :number, :platform],
72
+ :name => :index_versions_on_rubygem_id_and_number_and_platform,
73
+ :unique => true
71
74
  end
72
75
  end
73
76
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Sequel.migration do
2
3
  up do
3
4
  drop_table :linksets
@@ -28,47 +29,47 @@ Sequel.migration do
28
29
  end
29
30
 
30
31
  down do
31
- create_table(:linksets, :ignore_index_errors=>true) do
32
+ create_table(:linksets, :ignore_index_errors => true) do
32
33
  primary_key :id
33
34
  Integer :rubygem_id
34
- String :home, :size=>255
35
- String :wiki, :size=>255
36
- String :docs, :size=>255
37
- String :mail, :size=>255
38
- String :code, :size=>255
39
- String :bugs, :size=>255
35
+ String :home, :size => 255
36
+ String :wiki, :size => 255
37
+ String :docs, :size => 255
38
+ String :mail, :size => 255
39
+ String :code, :size => 255
40
+ String :bugs, :size => 255
40
41
  DateTime :created_at
41
42
  DateTime :updated_at
42
43
 
43
- index [:rubygem_id], :name=>:index_linksets_on_rubygem_id
44
+ index [:rubygem_id], :name => :index_linksets_on_rubygem_id
44
45
  end
45
46
 
46
47
  alter_table :dependencies do
47
48
  add_column :created_at, DateTime
48
49
  add_column :updated_at, DateTime
49
- add_column :unresolved_name, String, :size=>255
50
- add_index [:unresolved_name], :name=>:index_dependencies_on_unresolved_name
50
+ add_column :unresolved_name, String, :size => 255
51
+ add_index [:unresolved_name], :name => :index_dependencies_on_unresolved_name
51
52
  end
52
53
 
53
54
  alter_table :rubygems do
54
55
  add_column :created_at, DateTime
55
56
  add_column :updated_at, DateTime
56
- add_column :downloads, Integer, :default=>0
57
- add_column :slug, String, :size=>255
57
+ add_column :downloads, Integer, :default => 0
58
+ add_column :slug, String, :size => 255
58
59
  end
59
60
 
60
61
  alter_table :versions do
61
62
  add_column :created_at, DateTime
62
63
  add_column :updated_at, DateTime
63
- add_column :authors, String, :text=>true
64
- add_column :description, String, :text=>true
64
+ add_column :authors, String, :text => true
65
+ add_column :description, String, :text => true
65
66
  add_column :built_at, DateTime
66
- add_column :rubyforge_project, String, :size=>255
67
+ add_column :rubyforge_project, String, :size => 255
67
68
  add_column :position, Integer
68
69
  add_column :latest, TrueClass
69
- add_index [:created_at], :name=>:index_versions_on_created_at
70
- add_index [:built_at], :name=>:index_versions_on_built_at
71
- add_index [:position], :name=>:index_versions_on_position
70
+ add_index [:created_at], :name => :index_versions_on_created_at
71
+ add_index [:built_at], :name => :index_versions_on_built_at
72
+ add_index [:position], :name => :index_versions_on_position
72
73
  end
73
74
  end
74
75
  end
@@ -1,8 +1,9 @@
1
+ # frozen_string_literal: true
1
2
  Sequel.migration do
2
3
  up do
3
4
  alter_table :versions do
4
- add_column :rubygems_version, String, :size=>255
5
- add_column :required_ruby_version, String, :size=>255
5
+ add_column :rubygems_version, String, :size => 255
6
+ add_column :required_ruby_version, String, :size => 255
6
7
  end
7
8
  end
8
9
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Sequel.migration do
2
3
  change do
3
4
  alter_table :rubygems do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Sequel.migration do
2
3
  change do
3
4
  create_table :checksums do
@@ -5,7 +6,7 @@ Sequel.migration do
5
6
  String :name
6
7
  String :md5
7
8
 
8
- index [:name], name: :index_checksums_on_name, unqiue: true
9
+ index [:name], :name => :index_checksums_on_name, :unqiue => true
9
10
  end
10
11
  end
11
12
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Sequel.migration do
2
3
  change do
3
4
  alter_table :versions do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Sequel.migration do
2
3
  change do
3
4
  alter_table :versions do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "compact_index/gem"
2
3
  require "compact_index/gem_version"
3
4
  require "compact_index/dependency"
@@ -17,7 +18,7 @@ module CompactIndex
17
18
  # other-gem
18
19
  # ```
19
20
  def self.names(gem_names)
20
- "---\n" << gem_names.join("\n") << "\n"
21
+ String.new("---\n") << gem_names.join("\n") << "\n"
21
22
  end
22
23
 
23
24
  # Returns the versions file content argumented with some extra gems
@@ -48,7 +49,6 @@ module CompactIndex
48
49
  versions_file.contents(gems, args)
49
50
  end
50
51
 
51
-
52
52
  # Formats the versions information of a gem, to be display in the `/info/gemname` endpoint.
53
53
  #
54
54
  # @param versions_file [CompactIndex::VersionsFile] which will be used as a base response
@@ -70,31 +70,29 @@ module CompactIndex
70
70
  # 1.0.2 requirement:<2.0&>1.0,requirement2:=1.1|checksum:abc2,ruby:>1.0,rubygems:>2.0
71
71
  # ```
72
72
  def self.info(params)
73
- output = "---\n"
73
+ output = String.new("---\n")
74
74
  params.each do |version|
75
75
  output << version_line(version) << "\n"
76
76
  end
77
77
  output
78
78
  end
79
79
 
80
-
81
- private
82
-
80
+ private
83
81
 
84
82
  def self.version_line(version)
85
83
  if version[:dependencies]
86
84
  version[:dependencies]
87
85
  deps = version[:dependencies].map do |d|
88
86
  [
89
- d[:gem],
90
- d.version_and_platform.split(', ').sort.join("&")
91
- ].join(':')
87
+ d[:gem],
88
+ d.version_and_platform.split(", ").sort.join("&")
89
+ ].join(":")
92
90
  end
93
91
  else
94
92
  deps = []
95
93
  end
96
94
 
97
- line = version.number_and_platform
95
+ line = version.number_and_platform.dup
98
96
  line << " "
99
97
  line << deps.join(",")
100
98
  line << "|"
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  module CompactIndex
2
3
  Dependency = Struct.new(:gem, :version, :platform, :checksum) do
3
4
  def version_and_platform
4
- if platform.nil? || platform == 'ruby'
5
+ if platform.nil? || platform == "ruby"
5
6
  version.dup
6
7
  else
7
8
  "#{version}-#{platform}"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "date"
2
3
 
3
4
  # Ruby 1.8.7 makes Time#to_datetime private, but we need it
@@ -5,4 +6,4 @@ unless Time.public_instance_methods.include? :to_datetime
5
6
  class Time
6
7
  public :to_datetime
7
8
  end
8
- end
9
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module CompactIndex
2
3
  Gem = Struct.new(:name, :versions)
3
4
  end
@@ -1,8 +1,9 @@
1
+ # frozen_string_literal: true
1
2
  module CompactIndex
2
3
  GemVersion = Struct.new(:number, :platform, :checksum, :info_checksum,
3
- :dependencies, :ruby_version, :rubygems_version) do
4
+ :dependencies, :ruby_version, :rubygems_version) do
4
5
  def number_and_platform
5
- if platform.nil? || platform == 'ruby'
6
+ if platform.nil? || platform == "ruby"
6
7
  number.dup
7
8
  else
8
9
  "#{number}-#{platform}"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module CompactIndex
2
- VERSION = "0.9.4"
3
+ VERSION = "0.10.0".freeze
3
4
  end
@@ -1,116 +1,116 @@
1
- require 'time'
2
- require 'date'
3
- require 'digest'
4
- require 'compact_index'
5
-
6
- class CompactIndex::VersionsFile
7
- def initialize(file = nil)
8
- @path = file || "/versions.list"
9
- end
10
-
11
- def contents(gems = nil, args = {})
12
- if args[:calculate_checksums]
13
- gems = calculate_checksums(gems)
1
+ # frozen_string_literal: true
2
+ require "time"
3
+ require "date"
4
+ require "digest"
5
+ require "compact_index"
6
+
7
+ module CompactIndex
8
+ class VersionsFile
9
+ def initialize(file = nil)
10
+ @path = file || "/versions.list"
14
11
  end
15
12
 
16
- out = File.read(@path)
17
- out << parse_gems(gems) if gems
18
- out
19
- end
13
+ def contents(gems = nil, args = {})
14
+ gems = calculate_info_checksums(gems) if args.delete(:calculate_info_checksums) { false }
20
15
 
21
- def updated_at
22
- created_at_header(@path) || Time.at(0).to_datetime
23
- end
16
+ raise ArgumentError, "Unknown options: #{args.keys.join(", ")}" unless args.empty?
24
17
 
25
- def update_with(gems)
26
- if File.exists?(@path) && !File.zero?(@path)
27
- update(gems)
28
- else
29
- create(gems)
18
+ out = File.read(@path)
19
+ out << parse_gems(gems) if gems
20
+ out
30
21
  end
31
- end
32
22
 
23
+ def updated_at
24
+ created_at_header(@path) || Time.at(0).to_datetime
25
+ end
33
26
 
34
- private
27
+ def update_with(gems)
28
+ if File.exist?(@path) && !File.zero?(@path)
29
+ update(gems)
30
+ else
31
+ create(gems)
32
+ end
33
+ end
35
34
 
35
+ private
36
36
 
37
- def create(gems)
38
- content = "created_at: #{Time.now.iso8601}"
39
- content << "\n---\n"
40
- content << parse_gems_for_create(gems)
37
+ def create(gems)
38
+ content = "created_at: #{Time.now.iso8601}".dup
39
+ content << "\n---\n"
40
+ content << parse_gems_for_create(gems)
41
41
 
42
- File.open(@path, 'w') do |io|
43
- io.write content
42
+ File.open(@path, "w") do |io|
43
+ io.write content
44
+ end
44
45
  end
45
- end
46
46
 
47
- def update(gems)
48
- File.open(@path, 'a') do |io|
49
- io.write parse_gems(gems)
47
+ def update(gems)
48
+ File.open(@path, "a") do |io|
49
+ io.write parse_gems(gems)
50
+ end
50
51
  end
51
- end
52
52
 
53
- def parse_gems_for_create(gems)
54
- # Join all versions for each gem in one hash
55
- gems_hash = {}
56
- gems.each do |entry|
57
- gems_hash[entry[:name]] ||= []
58
- gems_hash[entry[:name]] += entry[:versions]
59
- end
53
+ def parse_gems_for_create(gems)
54
+ # Join all versions for each gem in one hash
55
+ gems_hash = {}
56
+ gems.each do |entry|
57
+ gems_hash[entry[:name]] ||= []
58
+ gems_hash[entry[:name]] += entry[:versions]
59
+ end
60
60
 
61
- # Transform hash in a list of line informations to be printed
62
- gems = gems_hash.map do |gem, versions|
63
- { :name => gem, :versions => versions, :checksum => versions.first[:checksum] }
64
- end
61
+ # Transform hash in a list of line informations to be printed
62
+ gems = gems_hash.map do |gem, versions|
63
+ { :name => gem, :versions => versions, :info_checksum => versions.last[:info_checksum] }
64
+ end
65
65
 
66
- # Sort gems by name and versions by number
67
- gems.sort! { |a,b| a[:name] <=> b[:name] }
68
- gems.each do |entry|
69
- entry[:versions].sort! do |a,b|
70
- Gem::Version.create(a[:number]) <=> Gem::Version.create(b[:number])
66
+ # Sort gems by name and versions by number
67
+ gems.sort! {|a, b| a[:name] <=> b[:name] }
68
+ gems.each do |entry|
69
+ entry[:versions].sort! do |a, b|
70
+ ::Gem::Version.create(a[:number]) <=> ::Gem::Version.create(b[:number])
71
+ end
71
72
  end
72
- end
73
73
 
74
- gem_lines(gems)
75
- end
74
+ gem_lines(gems)
75
+ end
76
76
 
77
- def parse_gems(gems)
78
- gem_lines = gems.map do |entry|
79
- {
80
- :name => entry[:name],
81
- :versions => entry[:versions],
82
- :checksum => entry[:versions].first[:checksum]
83
- }
77
+ def parse_gems(gems)
78
+ gem_lines = gems.map do |entry|
79
+ {
80
+ :name => entry[:name],
81
+ :versions => entry[:versions],
82
+ :info_checksum => entry[:versions].last[:info_checksum]
83
+ }
84
+ end
85
+ gem_lines(gem_lines)
84
86
  end
85
- gem_lines(gem_lines)
86
- end
87
87
 
88
- def gem_lines(gems)
89
- gems.reduce("") do |concat, entry|
90
- versions = entry[:versions]
91
- concat << "#{entry[:name]} #{versions.map(&:number_and_platform).join(',')} #{entry[:checksum]}\n"
88
+ def gem_lines(gems)
89
+ gems.reduce("".dup) do |concat, entry|
90
+ versions = entry[:versions]
91
+ concat << "#{entry[:name]} #{versions.map(&:number_and_platform).join(",")} #{entry[:info_checksum]}\n"
92
+ end
92
93
  end
93
- end
94
94
 
95
- def calculate_checksums(gems)
96
- gems.each do |gem|
97
- info_checksum = Digest::MD5.hexdigest(CompactIndex.info(gem[:versions]))
98
- gem[:versions].first[:checksum] = info_checksum
95
+ def calculate_info_checksums(gems)
96
+ gems.each do |gem|
97
+ info_checksum = Digest::MD5.hexdigest(CompactIndex.info(gem[:versions]))
98
+ gem[:versions].last[:info_checksum] = info_checksum
99
+ end
99
100
  end
100
- end
101
101
 
102
- def created_at_header(path)
103
- return unless File.exists? path
102
+ def created_at_header(path)
103
+ return unless File.exist? path
104
104
 
105
- File.open(path) do |file|
106
- file.each_line do |line|
107
- line.match(/created_at: (.*)\n|---\n/) do |match|
108
- return match[1] && DateTime.parse(match[1])
105
+ File.open(path) do |file|
106
+ file.each_line do |line|
107
+ line.match(/created_at: (.*)\n|---\n/) do |match|
108
+ return match[1] && DateTime.parse(match[1])
109
+ end
109
110
  end
110
111
  end
111
- end
112
112
 
113
- nil
113
+ nil
114
+ end
114
115
  end
115
-
116
116
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compact_index
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fotanus@gmail.com
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-05 00:00:00.000000000 Z
11
+ date: 2016-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -95,8 +95,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 2.4.6
98
+ rubygems_version: 2.5.1
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Backend for compact index
102
102
  test_files: []
103
+ has_rdoc: