gem_stream 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +4 -0
- data/lib/gem_stream.rb +1 -0
- data/lib/gem_stream/api_error.rb +3 -0
- data/lib/gem_stream/follower.rb +5 -3
- data/lib/gem_stream/version.rb +1 -1
- metadata +3 -3
- data/Gemfile.lock +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a22f7ffe295ffef583bbda157021b44d65afed4f11b86570826d873dd432517
|
4
|
+
data.tar.gz: a109cd0d77755965d9c8d376895edde12c5b5e3d9722e5baecc6f5cf43a9e7d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a589775ac97d2d1b494c263f802a59a10fdcbc11119ff2742a7b371ff3122fb46f442b41a90ba5c82e1fbe22233c3a92d2aed6bee2ea6f37e29b4dc1977395aa
|
7
|
+
data.tar.gz: d51cdfa0e406b7c2c720c5c26225be1d1bf139e36daf7e0884b035c00b8fce5f3219882a0b40665af12344d838bc8cef924550a66819f6941865f72269cbf17d
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -47,6 +47,10 @@ Once you've handled configuration, you can use GemStream like this:
|
|
47
47
|
GemStream::Follower.follow_from(start_time)
|
48
48
|
```
|
49
49
|
|
50
|
+
### Errors
|
51
|
+
|
52
|
+
If a Rubygems api error is encountered, GemStream will raise a `GemStream::ApiError`. In most cases, you can rescue this error and start a new follower from where you left of at. To get the time that you left off at, you can check the `GemStream::Follower` instance `synced_up_to_time` attribute. Note that restarting from this time may replay some `on_version` callbacks, as `synced_up_to_time` only represents the beginning of the last time frame you queried, not the published time of the most recent gem version you received back.
|
53
|
+
|
50
54
|
## Development
|
51
55
|
|
52
56
|
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.
|
data/lib/gem_stream.rb
CHANGED
data/lib/gem_stream/follower.rb
CHANGED
@@ -4,11 +4,13 @@ require 'net/http'
|
|
4
4
|
|
5
5
|
module GemStream
|
6
6
|
class Follower
|
7
|
+
attr_reader :synced_up_to_time
|
8
|
+
|
7
9
|
RUBYGEMS_ENDPOINT = 'https://rubygems.org/api/v1/timeframe_versions.json'.freeze
|
8
10
|
MAX_RUBY_GEMS_QUERY_RANGE_IN_SECONDS = 6 * 86400 # It's actually 7 days, but use 6 to be safe
|
9
11
|
|
10
12
|
def self.follow_from(start_time)
|
11
|
-
self.new(start_time).follow
|
13
|
+
self.new(start_time).tap(&:follow)
|
12
14
|
end
|
13
15
|
|
14
16
|
def initialize(start_time)
|
@@ -45,8 +47,8 @@ module GemStream
|
|
45
47
|
response = Net::HTTP.get_response(uri)
|
46
48
|
|
47
49
|
if response.code != '200'
|
48
|
-
|
49
|
-
|
50
|
+
msg = "Got status #{response.code} from rubygems for #{RUBYGEMS_ENDPOINT} with options: #{params.inspect}"
|
51
|
+
raise GemStream::ApiError, msg
|
50
52
|
end
|
51
53
|
|
52
54
|
versions = JSON.parse(response.body)
|
data/lib/gem_stream/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem_stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fletcher Wilkens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,7 +119,6 @@ files:
|
|
119
119
|
- ".rspec"
|
120
120
|
- ".travis.yml"
|
121
121
|
- Gemfile
|
122
|
-
- Gemfile.lock
|
123
122
|
- LICENSE
|
124
123
|
- README.md
|
125
124
|
- Rakefile
|
@@ -127,6 +126,7 @@ files:
|
|
127
126
|
- bin/setup
|
128
127
|
- gem_stream.gemspec
|
129
128
|
- lib/gem_stream.rb
|
129
|
+
- lib/gem_stream/api_error.rb
|
130
130
|
- lib/gem_stream/configuration.rb
|
131
131
|
- lib/gem_stream/follower.rb
|
132
132
|
- lib/gem_stream/version.rb
|
data/Gemfile.lock
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
gem_stream (0.1.3)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
addressable (2.6.0)
|
10
|
-
public_suffix (>= 2.0.2, < 4.0)
|
11
|
-
coderay (1.1.2)
|
12
|
-
crack (0.4.3)
|
13
|
-
safe_yaml (~> 1.0.0)
|
14
|
-
diff-lcs (1.3)
|
15
|
-
hashdiff (0.4.0)
|
16
|
-
method_source (0.9.2)
|
17
|
-
pry (0.12.2)
|
18
|
-
coderay (~> 1.1.0)
|
19
|
-
method_source (~> 0.9.0)
|
20
|
-
public_suffix (3.1.1)
|
21
|
-
rake (10.5.0)
|
22
|
-
rspec (3.8.0)
|
23
|
-
rspec-core (~> 3.8.0)
|
24
|
-
rspec-expectations (~> 3.8.0)
|
25
|
-
rspec-mocks (~> 3.8.0)
|
26
|
-
rspec-core (3.8.0)
|
27
|
-
rspec-support (~> 3.8.0)
|
28
|
-
rspec-expectations (3.8.3)
|
29
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.8.0)
|
31
|
-
rspec-mocks (3.8.0)
|
32
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
-
rspec-support (~> 3.8.0)
|
34
|
-
rspec-support (3.8.0)
|
35
|
-
safe_yaml (1.0.5)
|
36
|
-
timecop (0.9.1)
|
37
|
-
vcr (5.0.0)
|
38
|
-
webmock (3.6.0)
|
39
|
-
addressable (>= 2.3.6)
|
40
|
-
crack (>= 0.3.2)
|
41
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
42
|
-
|
43
|
-
PLATFORMS
|
44
|
-
ruby
|
45
|
-
|
46
|
-
DEPENDENCIES
|
47
|
-
bundler (~> 1.16)
|
48
|
-
gem_stream!
|
49
|
-
pry
|
50
|
-
rake (~> 10.0)
|
51
|
-
rspec (~> 3.0)
|
52
|
-
timecop (~> 0.9)
|
53
|
-
vcr (~> 5.0)
|
54
|
-
webmock (~> 3.6)
|
55
|
-
|
56
|
-
BUNDLED WITH
|
57
|
-
1.17.3
|