compact_index_client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/.rubocop.yml +99 -0
- data/.rubocop_todo.yml +20 -0
- data/.travis.yml +8 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +50 -0
- data/LICENSE.txt +21 -0
- data/README.md +36 -0
- data/Rakefile +14 -0
- data/bin/console +14 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/rubocop +16 -0
- data/bin/setup +7 -0
- data/compact_index_client.gemspec +24 -0
- data/lib/compact_index_client.rb +57 -0
- data/lib/compact_index_client/cache.rb +80 -0
- data/lib/compact_index_client/updater.rb +29 -0
- data/lib/compact_index_client/version.rb +3 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 18f334a60412f00251629bf03ce547871b37a714
|
4
|
+
data.tar.gz: 22e80a4875200879d9ee784f3ec9a392930a894a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 633282b34accd47e64833d523a4c9d226020eed42b36b1a4fcf79b00f36404b3a2b84d39c86ad4570a3c2ba6bc00accb30e962e4d0ac5dca2de5a8e22e70d1e0
|
7
|
+
data.tar.gz: be2f1c89aeffffc872bce26d168f24c1e023530c58dd9c0155f6cb8c1860b09401608e0524a9c99fb0a5682e419bf60069dc16bdbfb3f0555d57639ebdc9b7e4
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- .rubocop_todo.yml
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
Exclude:
|
6
|
+
- tmp/**/*
|
7
|
+
- vendor/**/*
|
8
|
+
- bin/**/*
|
9
|
+
DisplayCopNames: true
|
10
|
+
|
11
|
+
# Lint
|
12
|
+
|
13
|
+
# They are idiomatic
|
14
|
+
Lint/AssignmentInCondition:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Lint/EndAlignment:
|
18
|
+
AlignWith: variable
|
19
|
+
|
20
|
+
# Style
|
21
|
+
|
22
|
+
Style/AccessModifierIndentation:
|
23
|
+
EnforcedStyle: outdent
|
24
|
+
|
25
|
+
Style/AlignParameters:
|
26
|
+
EnforcedStyle: with_fixed_indentation
|
27
|
+
|
28
|
+
Style/MultilineOperationIndentation:
|
29
|
+
EnforcedStyle: indented
|
30
|
+
|
31
|
+
Style/SpaceInsideBlockBraces:
|
32
|
+
SpaceBeforeBlockParameters: false
|
33
|
+
|
34
|
+
Style/TrivialAccessors:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
# We adopted raise instead of fail.
|
38
|
+
Style/SignalException:
|
39
|
+
EnforcedStyle: only_raise
|
40
|
+
|
41
|
+
Style/StringLiterals:
|
42
|
+
EnforcedStyle: double_quotes
|
43
|
+
|
44
|
+
Style/StringLiteralsInInterpolation:
|
45
|
+
EnforcedStyle: double_quotes
|
46
|
+
|
47
|
+
# Having these make it easier to *not* forget to add one when adding a new
|
48
|
+
# value and you can simply copy the previous line.
|
49
|
+
Style/TrailingComma:
|
50
|
+
EnforcedStyleForMultiline: comma
|
51
|
+
|
52
|
+
# 1.8.7 support
|
53
|
+
|
54
|
+
Style/HashSyntax:
|
55
|
+
EnforcedStyle: hash_rockets
|
56
|
+
|
57
|
+
Style/Lambda:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Style/DotPosition:
|
61
|
+
EnforcedStyle: trailing
|
62
|
+
|
63
|
+
Style/EachWithObject:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Style/SpecialGlobalVars:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Style/TrailingComma:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Performance/FlatMap:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
# Metrics
|
76
|
+
|
77
|
+
# Arbitrary max lengths for classes simply do not work and enabling this will
|
78
|
+
# lead to a never ending stream of annoyance and changes.
|
79
|
+
Metrics/ClassLength:
|
80
|
+
Enabled: false
|
81
|
+
|
82
|
+
# Arbitrary max lengths for methods simply do not work and enabling this will
|
83
|
+
# lead to a never ending stream of annoyance and changes.
|
84
|
+
Metrics/MethodLength:
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
# No enforced convention here.
|
88
|
+
Metrics/BlockNesting:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
# It will be obvious which code is complex, Rubocop should only lint simple
|
92
|
+
# rules for us.
|
93
|
+
Metrics/AbcSize:
|
94
|
+
Enabled: false
|
95
|
+
|
96
|
+
# It will be obvious which code is complex, Rubocop should only lint simple
|
97
|
+
# rules for us.
|
98
|
+
Metrics/CyclomaticComplexity:
|
99
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2015-08-19 00:08:04 -0600 using RuboCop version 0.33.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 7
|
10
|
+
# Configuration parameters: AllowURI, URISchemes.
|
11
|
+
Metrics/LineLength:
|
12
|
+
Max: 104
|
13
|
+
|
14
|
+
# Offense count: 4
|
15
|
+
Style/Documentation:
|
16
|
+
Exclude:
|
17
|
+
- 'lib/compact_index_client.rb'
|
18
|
+
- 'lib/compact_index_client/cache.rb'
|
19
|
+
- 'lib/compact_index_client/updater.rb'
|
20
|
+
- 'lib/compact_index_client/version.rb'
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
compact_index_client (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.1.0)
|
10
|
+
astrolabe (1.3.1)
|
11
|
+
parser (~> 2.2)
|
12
|
+
diff-lcs (1.2.5)
|
13
|
+
parser (2.2.2.6)
|
14
|
+
ast (>= 1.1, < 3.0)
|
15
|
+
powerpack (0.1.1)
|
16
|
+
rainbow (2.0.0)
|
17
|
+
rake (10.4.2)
|
18
|
+
rspec (3.3.0)
|
19
|
+
rspec-core (~> 3.3.0)
|
20
|
+
rspec-expectations (~> 3.3.0)
|
21
|
+
rspec-mocks (~> 3.3.0)
|
22
|
+
rspec-core (3.3.2)
|
23
|
+
rspec-support (~> 3.3.0)
|
24
|
+
rspec-expectations (3.3.1)
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
+
rspec-support (~> 3.3.0)
|
27
|
+
rspec-mocks (3.3.2)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.3.0)
|
30
|
+
rspec-support (3.3.0)
|
31
|
+
rubocop (0.33.0)
|
32
|
+
astrolabe (~> 1.3)
|
33
|
+
parser (>= 2.2.2.5, < 3.0)
|
34
|
+
powerpack (~> 0.1)
|
35
|
+
rainbow (>= 1.99.1, < 3.0)
|
36
|
+
ruby-progressbar (~> 1.4)
|
37
|
+
ruby-progressbar (1.7.5)
|
38
|
+
|
39
|
+
PLATFORMS
|
40
|
+
ruby
|
41
|
+
|
42
|
+
DEPENDENCIES
|
43
|
+
bundler (~> 1.10)
|
44
|
+
compact_index_client!
|
45
|
+
rake (~> 10.0)
|
46
|
+
rspec (~> 3.0)
|
47
|
+
rubocop (= 0.33.0)
|
48
|
+
|
49
|
+
BUNDLED WITH
|
50
|
+
1.10.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Samuel E. Giddins
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# CompactIndexClient
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'compact_index_client'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install compact_index_client
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Initialize a new `CompactIndexClient` with a root directory for the local copy of the compact index, and a block used to make HTTP requests.
|
22
|
+
|
23
|
+
## Development
|
24
|
+
|
25
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
26
|
+
|
27
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/bundler/compact_index_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
32
|
+
|
33
|
+
|
34
|
+
## License
|
35
|
+
|
36
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "compact_index_client"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rake', 'rake')
|
data/bin/rspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rspec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rspec-core', 'rspec')
|
data/bin/rubocop
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rubocop' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rubocop', 'rubocop')
|
data/bin/setup
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "compact_index_client/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "compact_index_client"
|
8
|
+
spec.version = CompactIndexClient::VERSION
|
9
|
+
spec.authors = ["Samuel E. Giddins"]
|
10
|
+
spec.email = ["segiddins@segiddins.me"]
|
11
|
+
|
12
|
+
spec.summary = "The client for the new Bundler compact index format."
|
13
|
+
spec.homepage = "https://github.com/bundler/compact_index_client"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "set"
|
3
|
+
|
4
|
+
class CompactIndexClient
|
5
|
+
require "compact_index_client/cache"
|
6
|
+
require "compact_index_client/updater"
|
7
|
+
require "compact_index_client/version"
|
8
|
+
|
9
|
+
def initialize(directory, fetcher)
|
10
|
+
@directory = Pathname.new(directory)
|
11
|
+
@updater = Updater.new(fetcher)
|
12
|
+
@cache = Cache.new(@directory)
|
13
|
+
@endpoints = Set.new
|
14
|
+
@info_checksums_by_name = {}
|
15
|
+
end
|
16
|
+
|
17
|
+
def names
|
18
|
+
update(@cache.names_path, "names")
|
19
|
+
@cache.names
|
20
|
+
end
|
21
|
+
|
22
|
+
def versions
|
23
|
+
update(@cache.versions_path, "versions")
|
24
|
+
versions, @info_checksums_by_name = @cache.versions
|
25
|
+
versions
|
26
|
+
end
|
27
|
+
|
28
|
+
def dependencies(names)
|
29
|
+
names.each {|n| update_info(n) }
|
30
|
+
names.map do |name|
|
31
|
+
@cache.dependencies(name).map {|d| d.unshift(name) }
|
32
|
+
end.flatten(1)
|
33
|
+
end
|
34
|
+
|
35
|
+
def spec(name, version, platform = nil)
|
36
|
+
update_info(name)
|
37
|
+
@cache.specific_dependency(name, version, platform)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def update(local_path, remote_path)
|
43
|
+
return if @endpoints.include?(remote_path)
|
44
|
+
@updater.update(local_path, url(remote_path))
|
45
|
+
@endpoints << remote_path
|
46
|
+
end
|
47
|
+
|
48
|
+
def update_info(name)
|
49
|
+
path = @cache.dependencies_path(name)
|
50
|
+
return if @info_checksums_by_name[name] == @updater.checksum_for_file(path)
|
51
|
+
update(path, "info/#{name}")
|
52
|
+
end
|
53
|
+
|
54
|
+
def url(path)
|
55
|
+
path
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
class CompactIndexClient
|
2
|
+
class Cache
|
3
|
+
attr_reader :directory
|
4
|
+
|
5
|
+
def initialize(directory)
|
6
|
+
@directory = Pathname.new(directory).expand_path
|
7
|
+
FileUtils.mkdir_p dependencies_path(nil)
|
8
|
+
end
|
9
|
+
|
10
|
+
def names
|
11
|
+
lines(names_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def names_path
|
15
|
+
directory + "names"
|
16
|
+
end
|
17
|
+
|
18
|
+
def versions
|
19
|
+
versions_by_name = Hash.new {|hash, key| hash[key] = [] }
|
20
|
+
info_checksums_by_name = {}
|
21
|
+
lines(versions_path).map do |line|
|
22
|
+
next if line == "-1"
|
23
|
+
name, versions_string, info_checksum = line.split(" ", 3)
|
24
|
+
info_checksums_by_name[name] = info_checksum || ""
|
25
|
+
versions_by_name[name].concat(versions_string.split(",").map! do |version|
|
26
|
+
version.split("-", 2).unshift(name)
|
27
|
+
end)
|
28
|
+
end
|
29
|
+
[versions_by_name, info_checksums_by_name]
|
30
|
+
end
|
31
|
+
|
32
|
+
def versions_path
|
33
|
+
directory + "versions"
|
34
|
+
end
|
35
|
+
|
36
|
+
def dependencies(name)
|
37
|
+
lines(dependencies_path(name)).map do |line|
|
38
|
+
parse_gem(line)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def dependencies_path(name)
|
43
|
+
directory + "dependencies" + name.to_s
|
44
|
+
end
|
45
|
+
|
46
|
+
def specific_dependency(name, version, platform)
|
47
|
+
pattern = [version, platform].compact.join("-")
|
48
|
+
matcher = /\A#{Regexp.escape(pattern)}\b/ unless pattern.empty?
|
49
|
+
lines(dependencies_path(name)).each do |line|
|
50
|
+
return parse_gem(line) if line =~ matcher
|
51
|
+
end if matcher
|
52
|
+
nil
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def lines(path)
|
58
|
+
return [] unless path.file?
|
59
|
+
lines = path.read.lines
|
60
|
+
header = lines.index("---\n")
|
61
|
+
lines = header ? lines[header + 1..-1] : lines
|
62
|
+
lines.each!(&:strip!)
|
63
|
+
end
|
64
|
+
|
65
|
+
def parse_gem(string)
|
66
|
+
version_and_platform, rest = string.split(" ", 2)
|
67
|
+
version, platform = version_and_platform.split("-", 2)
|
68
|
+
dependencies, requirements = rest.split("|", 2).map {|s| s.split(",") } if rest
|
69
|
+
dependencies = dependencies ? dependencies.map {|d| parse_dependency(d) } : []
|
70
|
+
requirements = requirements ? requirements.map {|r| parse_dependency(r) } : []
|
71
|
+
[version, platform, dependencies, requirements]
|
72
|
+
end
|
73
|
+
|
74
|
+
def parse_dependency(string)
|
75
|
+
dependency = string.split(":")
|
76
|
+
dependency[-1] = dependency[-1].split("&")
|
77
|
+
dependency
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class CompactIndexClient
|
2
|
+
class Updater
|
3
|
+
attr_reader :fetcher
|
4
|
+
def initialize(fetcher)
|
5
|
+
@fetcher = fetcher
|
6
|
+
end
|
7
|
+
|
8
|
+
def update(local_path, remote_path)
|
9
|
+
headers = {}
|
10
|
+
if local_path.file?
|
11
|
+
headers["If-None-Match"] = checksum_for_file(local_path)
|
12
|
+
headers["Range"] = "bytes=#{local_path.size}-"
|
13
|
+
end
|
14
|
+
response = fetcher.call(remote_path, headers)
|
15
|
+
return if response.is_a?(Net::HTTPNotModified)
|
16
|
+
mode = response.is_a?(Net::HTTPPartialContent) ? "a" : "w"
|
17
|
+
local_path.open(mode) {|f| f << response.body }
|
18
|
+
|
19
|
+
return if checksum_for_file(local_path) == response["ETag"]
|
20
|
+
local_path.delete
|
21
|
+
update(local_path, remote_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
def checksum_for_file(path)
|
25
|
+
return nil unless path.file?
|
26
|
+
Digest::MD5.file(path).hexdigest
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: compact_index_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Samuel E. Giddins
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- segiddins@segiddins.me
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".rubocop_todo.yml"
|
66
|
+
- ".travis.yml"
|
67
|
+
- CHANGELOG.md
|
68
|
+
- Gemfile
|
69
|
+
- Gemfile.lock
|
70
|
+
- LICENSE.txt
|
71
|
+
- README.md
|
72
|
+
- Rakefile
|
73
|
+
- bin/console
|
74
|
+
- bin/rake
|
75
|
+
- bin/rspec
|
76
|
+
- bin/rubocop
|
77
|
+
- bin/setup
|
78
|
+
- compact_index_client.gemspec
|
79
|
+
- lib/compact_index_client.rb
|
80
|
+
- lib/compact_index_client/cache.rb
|
81
|
+
- lib/compact_index_client/updater.rb
|
82
|
+
- lib/compact_index_client/version.rb
|
83
|
+
homepage: https://github.com/bundler/compact_index_client
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.4.8
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: The client for the new Bundler compact index format.
|
107
|
+
test_files: []
|