ghtorrent 0.10 → 0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +16 -0
- data/Gemfile.lock +12 -27
- data/README.md +20 -33
- data/Rakefile +1 -9
- data/bin/ght-log-analyzer +11 -6
- data/bin/ght-log-influx +190 -0
- data/bin/ght-queue-grep.rb +55 -0
- data/bin/ght-retrieve-users +6 -0
- data/bin/{ght-rm-dupl → ght-update-repo} +1 -1
- data/lib/ghtorrent.rb +4 -4
- data/lib/ghtorrent/adapters/base_adapter.rb +4 -11
- data/lib/ghtorrent/adapters/mongo_persister.rb +5 -9
- data/lib/ghtorrent/adapters/noop_persister.rb +0 -5
- data/lib/ghtorrent/api_client.rb +45 -119
- data/lib/ghtorrent/command.rb +25 -8
- data/lib/ghtorrent/commands/full_user_retriever.rb +50 -0
- data/lib/ghtorrent/commands/ght_data_retrieval.rb +12 -98
- data/lib/ghtorrent/commands/ght_get_more_commits.rb +13 -17
- data/lib/ghtorrent/commands/ght_load.rb +1 -2
- data/lib/ghtorrent/commands/ght_mirror_events.rb +8 -12
- data/lib/ghtorrent/commands/ght_retrieve_dependents.rb +0 -5
- data/lib/ghtorrent/commands/ght_retrieve_one.rb +1 -6
- data/lib/ghtorrent/commands/ght_retrieve_repo.rb +56 -26
- data/lib/ghtorrent/commands/ght_retrieve_repos.rb +5 -15
- data/lib/ghtorrent/commands/ght_retrieve_user.rb +13 -54
- data/lib/ghtorrent/commands/ght_retrieve_users.rb +49 -0
- data/lib/ghtorrent/commands/ght_update_repo.rb +126 -0
- data/lib/ghtorrent/event_processing.rb +140 -0
- data/lib/ghtorrent/ghtorrent.rb +330 -396
- data/lib/ghtorrent/logging.rb +65 -12
- data/lib/ghtorrent/migrations/014_add_deleted_to_projects.rb +1 -1
- data/lib/ghtorrent/migrations/019_add_fake_to_users.rb +1 -1
- data/lib/ghtorrent/migrations/020_add_deleted_to_users.rb +19 -0
- data/lib/ghtorrent/migrations/021_remove_ext_ref_id.rb +42 -0
- data/lib/ghtorrent/migrations/022_add_project_languages.rb +24 -0
- data/lib/ghtorrent/multiprocess_queue_client.rb +25 -5
- data/lib/ghtorrent/retriever.rb +100 -57
- data/lib/ghtorrent/settings.rb +14 -17
- data/lib/ghtorrent/{transacted_ghtorrent.rb → transacted_gh_torrent.rb} +28 -5
- data/lib/version.rb +1 -1
- metadata +14 -46
- data/bin/ght-process-event +0 -35
- data/lib/ghtorrent/cache.rb +0 -97
- data/lib/ghtorrent/commands/ght_rm_dupl.rb +0 -132
- data/lib/ghtorrent/gh_torrent_exception.rb +0 -6
- data/spec/api_client_spec.rb +0 -42
- data/spec/spec_helper.rb +0 -21
data/spec/api_client_spec.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
include GHTorrent::Settings
|
4
|
-
include GHTorrent::APIClient
|
5
|
-
|
6
|
-
describe 'The API client' do
|
7
|
-
|
8
|
-
def stub_config(remaining, reset)
|
9
|
-
stub_request(:get, "https://#{config(:github_username)}:#{config(:github_passwd)}@api.github.com/events").
|
10
|
-
with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'ghtorrent'}).
|
11
|
-
to_return(:status => 200, :body => (1..30).to_a,
|
12
|
-
:headers => {'x-ratelimit-remaining' => remaining,
|
13
|
-
'x-ratelimit-reset' => reset})
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'call /events should return 30 results' do
|
17
|
-
stub_config(1000, 1000)
|
18
|
-
r = api_request 'https://api.github.com/events', false
|
19
|
-
expect(r.size).to eq(30)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should resume from sleep' do
|
23
|
-
time = Time.now.to_i
|
24
|
-
stub_config(2, Time.now.to_i + 1)
|
25
|
-
api_request 'https://api.github.com/events', false
|
26
|
-
|
27
|
-
|
28
|
-
stub_config(1000, 1000)
|
29
|
-
api_request 'https://api.github.com/events', false
|
30
|
-
expect(Time.now.to_i - time).to be_within(0.3).of(3)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should sleep for 7 seconds' do
|
34
|
-
stub_config(2, Time.now.to_i + 5)
|
35
|
-
|
36
|
-
time = Time.now.to_i
|
37
|
-
api_request 'https://api.github.com/events', false
|
38
|
-
expect(Time.now.to_i - time).to be_within(0.3).of(7)
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
data/spec/spec_helper.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'webmock/rspec'
|
3
|
-
|
4
|
-
require 'ghtorrent'
|
5
|
-
|
6
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
8
|
-
|
9
|
-
RSpec.configure do |config|
|
10
|
-
config.expect_with :rspec do |c|
|
11
|
-
c.syntax = :expect
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def settings
|
16
|
-
YAML::load_file('config.yaml')
|
17
|
-
end
|
18
|
-
|
19
|
-
def logger
|
20
|
-
Logger.new(STDERR)
|
21
|
-
end
|