compact_index 0.5.2 → 0.6.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: d382b43196cce6190ecf6e66bda47056fcbcba34
4
- data.tar.gz: a4ddbbbe8f24ea7b4907b8c81f9d4512a84ecc81
3
+ metadata.gz: cdd91f796331f34e5733ec038c001ad044049e92
4
+ data.tar.gz: fce1c12e543be6a8076b721835b7c0d2e4188737
5
5
  SHA512:
6
- metadata.gz: 0d2b3c7e3d0d5b2c13e66514223f025f063d6b3e3baaf0e9dcbb18d6e53aa5219504191ebaf2bc4653cf5999a5cce3cf4262cbbd4564f4a007dba601904e019b
7
- data.tar.gz: a4aa9a4e3c7ba08b4e1b0ebb003cc4971cfb7436951249fc55b2bfd6f13fb51eb6430322797de25009fced37593f7d4a7fe6988571d88e1db0ec54ce4e26e396
6
+ metadata.gz: cc06a2a9928ea2b4e25299053c9603657d57dafb422abd388baebb09fee7635a400e2c8245ec4031e4cdbd2f5f1a0bbafa803e812b0aa29ff80794ec0ff93ffa
7
+ data.tar.gz: 94b78e91b9a77a9aeefc7097efac739c741312862b005f405fe6c1dc41e8eb319c19b2c50ad790eba8eef55213739bfb38f47a070a04e3324e95a36db9a426ed
@@ -0,0 +1,69 @@
1
+ ## 0.6.0 (August 1, 2015)
2
+
3
+ Features:
4
+
5
+ - Change info and versions interface to receive separated number and version
6
+
7
+ ## 0.5.2 (July 20, 2015)
8
+
9
+ Bugfixes:
10
+
11
+ - Move update logic from bundler-api to here
12
+ - Remove unused files imported on V0.1.0
13
+
14
+
15
+ ## 0.5.1 (July 13, 2015)
16
+
17
+ Bugfixes:
18
+
19
+ - Move update logic from bundler-api to here
20
+ - Remove unused files imported on V0.1.0
21
+
22
+ ## 0.4.1 (July 13, 2015)
23
+
24
+ Bugfixes:
25
+
26
+ - Drop unecessary dependencies
27
+ - Remove unused files imported on V0.1.0
28
+
29
+ ## 0.4.0 (July 10, 2015)
30
+
31
+ Features:
32
+
33
+ - Change versions interface to receive a versions file
34
+ - Add checksum on info endpoint
35
+ - Add platform on info endpoint
36
+ - Add checksum for versions endpoint
37
+
38
+ Refactoring:
39
+
40
+ - Dry tests
41
+
42
+ ## 0.3.1 (July 5, 2015)
43
+
44
+ Features:
45
+
46
+ - Change versions interface to receive a versions file
47
+
48
+ Bugfixes:
49
+
50
+ - Fix missing colon on info endpoint
51
+
52
+ ## 0.3.0 (July 5, 2015)
53
+
54
+ Features:
55
+
56
+ - Use trailing newlines on versions file and web responses
57
+ - Remove database from project
58
+ - Add VersionsFile#update
59
+ - Add info, names and versions endpoints
60
+
61
+ ## 0.2.0 (June 26, 2015)
62
+
63
+ Features:
64
+
65
+ - Moved code from bundler-api to this gem
66
+ - Configure gemspec info
67
+ - Exposed VersionsFile and GemInfo classes
68
+ - Add versions.list file
69
+ - Configure travis
data/Rakefile CHANGED
@@ -1 +1,14 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ desc "Run specs"
7
+ RSpec::Core::RakeTask.new(:spec) do |t|
8
+ t.rspec_opts = %w(--color)
9
+ end
10
+
11
+ task :default => :spec
12
+ rescue LoadError => e
13
+ # rspec won't exist on production
14
+ end
@@ -3,7 +3,7 @@ require "compact_index/versions_file"
3
3
 
4
4
  module CompactIndex
5
5
  def self.names(gem_names)
6
- "---\n" + gem_names.join("\n") + "\n"
6
+ "---\n" << gem_names.join("\n") << "\n"
7
7
  end
8
8
 
9
9
  def self.versions(versions_file, gems)
@@ -25,24 +25,30 @@ module CompactIndex
25
25
  deps = version[:dependencies].map do |d|
26
26
  [
27
27
  d[:gem],
28
- d[:version].gsub(/, /, "&")
28
+ number_and_platform(d[:version],d[:platform]).gsub(/, /, "&")
29
29
  ].join(':')
30
30
  end
31
31
  else
32
32
  deps = []
33
33
  end
34
34
 
35
- line = version[:number]
36
- line << " "
37
- line << deps.join(",") if deps.any?
35
+ line = number_and_platform(version[:number], version[:platform])
36
+ line << " "
37
+ line << deps.join(",")
38
38
  line << "|"
39
39
 
40
- after_pipe = []
41
- after_pipe << "checksum:#{version[:checksum]}"
42
- after_pipe << "ruby:#{version[:ruby_version]}" if version[:ruby_version]
43
- after_pipe << "rubygems:#{version[:rubygems_version]}" if version[:rubygems_version]
44
- line << after_pipe.join(",")
45
-
40
+ line << "checksum:#{version[:checksum]}"
41
+ line << ",ruby:#{version[:ruby_version]}" if version[:ruby_version]
42
+ line << ",rubygems:#{version[:rubygems_version]}" if version[:rubygems_version]
43
+
46
44
  line
47
45
  end
46
+
47
+ def self.number_and_platform(number, platform)
48
+ if platform.nil? || platform == 'ruby'
49
+ number
50
+ else
51
+ "#{number}-#{platform}"
52
+ end
53
+ end
48
54
  end
@@ -1,3 +1,3 @@
1
1
  module CompactIndex
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -6,8 +6,8 @@ class CompactIndex::VersionsFile
6
6
  end
7
7
 
8
8
  def contents(gems=nil)
9
- out = File.open(@path).read
10
- out += parse_gems(gems) if gems
9
+ out = File.read(@path)
10
+ out << parse_gems(gems) if gems
11
11
  out
12
12
  end
13
13
 
@@ -33,8 +33,8 @@ class CompactIndex::VersionsFile
33
33
 
34
34
  def create(gems)
35
35
  content = "created_at: #{Time.now.iso8601}"
36
- content += "\n---\n"
37
- content += parse_gems_for_create(gems)
36
+ content << "\n---\n"
37
+ content << parse_gems_for_create(gems)
38
38
 
39
39
  File.open(@path, 'w') do |io|
40
40
  io.write content
@@ -68,7 +68,7 @@ class CompactIndex::VersionsFile
68
68
  versions.each do |v|
69
69
  by_created_at[v[:created_at]] ||= {}
70
70
  by_created_at[v[:created_at]][name] ||= []
71
- by_created_at[v[:created_at]][name] << v[:number]
71
+ by_created_at[v[:created_at]][name] << number_and_platform(v[:number], v[:platform])
72
72
  checksums[v[:created_at]] ||= {}
73
73
  checksums[v[:created_at]] = v[:checksum]
74
74
  end
@@ -83,13 +83,19 @@ class CompactIndex::VersionsFile
83
83
  def gem_lines(gems)
84
84
  gems.reduce("") do |concat, entry|
85
85
  versions = sort_versions(entry[:versions])
86
- concat + "#{entry[:name]} #{versions.join(',')} #{entry[:checksum]}\n"
86
+ concat << "#{entry[:name]} #{versions.join(',')} #{entry[:checksum]}\n"
87
87
  end
88
88
  end
89
89
 
90
90
  def sort_versions(versions)
91
- versions.sort do |a,b|
92
- gem_comp = Gem::Version.new(a) <=> Gem::Version.new(b)
91
+ versions.sort_by { |v| Gem::Version.create(v) }
92
+ end
93
+
94
+ def number_and_platform(number, platform)
95
+ if platform.nil? || platform == 'ruby'
96
+ number
97
+ else
98
+ "#{number}-#{platform}"
93
99
  end
94
100
  end
95
101
  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.5.2
4
+ version: 0.6.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: 2015-07-20 00:00:00.000000000 Z
11
+ date: 2015-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -48,6 +48,7 @@ files:
48
48
  - ".gitignore"
49
49
  - ".rspec"
50
50
  - ".travis.yml"
51
+ - CHANGELOG.md
51
52
  - CODE_OF_CONDUCT.md
52
53
  - Gemfile
53
54
  - LICENSE.txt