ghtorrent 0.10 → 0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +16 -0
  3. data/Gemfile.lock +12 -27
  4. data/README.md +20 -33
  5. data/Rakefile +1 -9
  6. data/bin/ght-log-analyzer +11 -6
  7. data/bin/ght-log-influx +190 -0
  8. data/bin/ght-queue-grep.rb +55 -0
  9. data/bin/ght-retrieve-users +6 -0
  10. data/bin/{ght-rm-dupl → ght-update-repo} +1 -1
  11. data/lib/ghtorrent.rb +4 -4
  12. data/lib/ghtorrent/adapters/base_adapter.rb +4 -11
  13. data/lib/ghtorrent/adapters/mongo_persister.rb +5 -9
  14. data/lib/ghtorrent/adapters/noop_persister.rb +0 -5
  15. data/lib/ghtorrent/api_client.rb +45 -119
  16. data/lib/ghtorrent/command.rb +25 -8
  17. data/lib/ghtorrent/commands/full_user_retriever.rb +50 -0
  18. data/lib/ghtorrent/commands/ght_data_retrieval.rb +12 -98
  19. data/lib/ghtorrent/commands/ght_get_more_commits.rb +13 -17
  20. data/lib/ghtorrent/commands/ght_load.rb +1 -2
  21. data/lib/ghtorrent/commands/ght_mirror_events.rb +8 -12
  22. data/lib/ghtorrent/commands/ght_retrieve_dependents.rb +0 -5
  23. data/lib/ghtorrent/commands/ght_retrieve_one.rb +1 -6
  24. data/lib/ghtorrent/commands/ght_retrieve_repo.rb +56 -26
  25. data/lib/ghtorrent/commands/ght_retrieve_repos.rb +5 -15
  26. data/lib/ghtorrent/commands/ght_retrieve_user.rb +13 -54
  27. data/lib/ghtorrent/commands/ght_retrieve_users.rb +49 -0
  28. data/lib/ghtorrent/commands/ght_update_repo.rb +126 -0
  29. data/lib/ghtorrent/event_processing.rb +140 -0
  30. data/lib/ghtorrent/ghtorrent.rb +330 -396
  31. data/lib/ghtorrent/logging.rb +65 -12
  32. data/lib/ghtorrent/migrations/014_add_deleted_to_projects.rb +1 -1
  33. data/lib/ghtorrent/migrations/019_add_fake_to_users.rb +1 -1
  34. data/lib/ghtorrent/migrations/020_add_deleted_to_users.rb +19 -0
  35. data/lib/ghtorrent/migrations/021_remove_ext_ref_id.rb +42 -0
  36. data/lib/ghtorrent/migrations/022_add_project_languages.rb +24 -0
  37. data/lib/ghtorrent/multiprocess_queue_client.rb +25 -5
  38. data/lib/ghtorrent/retriever.rb +100 -57
  39. data/lib/ghtorrent/settings.rb +14 -17
  40. data/lib/ghtorrent/{transacted_ghtorrent.rb → transacted_gh_torrent.rb} +28 -5
  41. data/lib/version.rb +1 -1
  42. metadata +14 -46
  43. data/bin/ght-process-event +0 -35
  44. data/lib/ghtorrent/cache.rb +0 -97
  45. data/lib/ghtorrent/commands/ght_rm_dupl.rb +0 -132
  46. data/lib/ghtorrent/gh_torrent_exception.rb +0 -6
  47. data/spec/api_client_spec.rb +0 -42
  48. data/spec/spec_helper.rb +0 -21
@@ -1,6 +0,0 @@
1
- # Base exception for all GHTorrent exceptions
2
- module GHTorrent
3
- class GHTorrentException < Exception
4
-
5
- end
6
- end
@@ -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
-
@@ -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