hubba 0.3.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,6 @@
1
- # encoding: utf-8
2
-
3
1
  module Hubba
4
2
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
5
- MINOR = 3
3
+ MINOR = 6
6
4
  PATCH = 0
7
5
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
6
 
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  # minitest setup
4
2
  require 'minitest/autorun'
5
3
 
@@ -0,0 +1,25 @@
1
+ {
2
+ "full_name": "jekyll/minima",
3
+ "created_at": "2016-05-20T23:07:56Z",
4
+ "updated_at": "2018-02-11T16:13:33Z",
5
+ "pushed_at": "2018-02-07T22:14:11Z",
6
+ "size": 321,
7
+ "history": {
8
+ "2018-02-12": {
9
+ "stargazers_count": 717
10
+ }
11
+ },
12
+ "commits": [
13
+ {
14
+ "author": {
15
+ "name": "ashmaroli",
16
+ "date": "2018-02-21T19:35:59Z"
17
+ },
18
+ "committer": {
19
+ "name": "Frank Taillandier",
20
+ "date": "2018-02-21T19:35:59Z"
21
+ },
22
+ "message": "social icons should resolve baseurl properly (#201)"
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "full_name": "openblockchains/awesome-blockchains",
3
+ "created_at": "2017-09-13T22:33:56Z",
4
+ "size": 1620,
5
+ "history": {
6
+ "2017-12-10": {
7
+ "stargazers_count": 1084
8
+ },
9
+ "2018-01-28": {
10
+ "stargazers_count": 1411
11
+ },
12
+ "2018-02-08": {
13
+ "stargazers_count": 1526
14
+ }
15
+ },
16
+ "commits": [
17
+ {
18
+ "committer": {
19
+ "date": "2018-02-08T09:33:28Z",
20
+ "name": "Gerald Bauer"
21
+ },
22
+ "message": "Update README.md\n\nJust a little typo cryto -> crypto."
23
+ }
24
+ ],
25
+ "updated_at": "2018-02-08T19:26:35Z",
26
+ "pushed_at": "2018-02-08T09:33:29Z"
27
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "full_name": "opendatajson/factbook.json",
3
+ "created_at": "2014-07-12T12:43:52Z",
4
+ "history": {
5
+ "2017-02-11": {
6
+ "stargazers_count": 457
7
+ },
8
+ "2017-02-12": {
9
+ "stargazers_count": 457
10
+ },
11
+ "2017-06-18": {
12
+ "stargazers_count": 505
13
+ },
14
+ "2017-07-28": {
15
+ "stargazers_count": 512
16
+ },
17
+ "2017-12-10": {
18
+ "stargazers_count": 533
19
+ },
20
+ "2018-01-28": {
21
+ "stargazers_count": 536
22
+ },
23
+ "2018-02-08": {
24
+ "stargazers_count": 539
25
+ }
26
+ },
27
+ "commits": [
28
+ {
29
+ "committer": {
30
+ "date": "2017-03-29T17:23:29Z",
31
+ "name": "GitHub"
32
+ },
33
+ "message": "Update MONGO.md"
34
+ }
35
+ ],
36
+ "size": 7355,
37
+ "updated_at": "2018-02-01T12:35:19Z",
38
+ "pushed_at": "2017-03-29T17:23:30Z"
39
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "full_name": "poole/hyde",
3
+ "created_at": "2013-02-07T07:01:38Z",
4
+ "updated_at": "2018-02-12T05:44:07Z",
5
+ "pushed_at": "2018-01-14T02:41:16Z",
6
+ "size": 28428,
7
+ "history": {
8
+ "2018-02-12": {
9
+ "stargazers_count": 2125
10
+ }
11
+ },
12
+ "commits": [
13
+ {
14
+ "committer": {
15
+ "date": "2015-05-11T20:21:43Z",
16
+ "name": "Mark Otto"
17
+ },
18
+ "message": "Merge pull request #91 from pborreli/patch-1\n\nFixed typo"
19
+ }
20
+ ]
21
+ }
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  ###
4
2
  # to run use
5
3
  # ruby -I ./lib -I ./test test/test_config.rb
@@ -14,10 +12,20 @@ class TestConfig < MiniTest::Test
14
12
  Hubba.configure do |config|
15
13
  config.user = 'user1'
16
14
  config.password = 'password1'
15
+ # -or-
16
+ config.token = 'token1'
17
17
  end
18
18
 
19
19
  assert_equal 'user1', Hubba.configuration.user
20
20
  assert_equal 'password1', Hubba.configuration.password
21
+ assert_equal 'token1', Hubba.configuration.token
22
+
23
+ assert_equal 'user1', Hubba.config.user
24
+ assert_equal 'password1', Hubba.config.password
25
+ assert_equal 'token1', Hubba.config.token
26
+
27
+ assert_equal './data', Hubba.configuration.data_dir
28
+ assert_equal './data', Hubba.config.data_dir
21
29
  end
22
30
 
23
31
  end # class TestConfig
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  ###
4
2
  # to run use
5
3
  # ruby -I ./lib -I ./test test/test_stats.rb
@@ -10,31 +8,118 @@ require 'helper'
10
8
 
11
9
  class TestStats < MiniTest::Test
12
10
 
13
- def setup
14
- @gh = Hubba::Github.new( cache_dir: "#{Hubba.root}/test/cache" )
11
+
12
+ def test_jekyll_minima
13
+
14
+ stats = Hubba::Stats.new( 'jekyll/minima' )
15
+
16
+ assert_equal 0, stats.size
17
+ assert_equal 0, stats.stars
18
+ assert_nil stats.history
19
+
20
+ Hubba.config.data_dir = "#{Hubba.root}/test/stats"
21
+ stats.read
22
+
23
+ assert_equal 321, stats.size
24
+ assert_equal 717, stats.stars
25
+ assert_equal 717, stats.history[0].stars
26
+ assert_equal 1, stats.history.size
27
+
28
+ assert_equal Date.new(2018, 2, 12 ), stats.history[0].date
29
+
30
+ assert_nil stats.history[0].diff_days
31
+
32
+ assert_equal Date.new(2018, 2, 21 ), stats.committed
33
+ assert_equal Date.new(2016, 5, 20 ), stats.created
34
+ assert_equal Date.new(2018, 2, 11 ), stats.updated
35
+ assert_equal Date.new(2018, 2, 7 ), stats.pushed
36
+
37
+ assert_equal DateTime.new(2018, 2, 21, 19, 35, 59 ), stats.committed_at
38
+ assert_equal DateTime.new(2016, 5, 20, 23, 7, 56 ), stats.created_at
39
+ assert_equal DateTime.new(2018, 2, 11, 16, 13, 33 ), stats.updated_at
40
+ assert_equal DateTime.new(2018, 2, 7, 22, 14, 11 ), stats.pushed_at
41
+
42
+
43
+ pp stats.last_commit
44
+ pp stats.last_commit_message
45
+ pp stats.history_str ## pp history pretty printed to string (buffer)
15
46
  end
16
47
 
17
- def test_stats
18
- repos = [
19
- 'henrythemes/jekyll-starter-theme',
20
- 'poole/hyde',
21
- 'jekyll/minima'
22
- ]
23
48
 
24
- repos.each do |repo|
25
- stats = Hubba::Stats.new( repo )
26
- stats.read( data_dir: './tmp' )
27
49
 
28
- puts "stars before fetch: #{stats.stars}"
29
- puts "size before fetch: #{stats.size} kb"
30
- stats.fetch( @gh )
31
- puts "stars after fetch: #{stats.stars}"
32
- puts "size after fetch: #{stats.size} kb"
50
+ def test_awesome_blockchains
51
+
52
+ stats = Hubba::Stats.new( 'openblockchains/awesome-blockchains' )
53
+
54
+ assert_equal 0, stats.size
55
+ assert_equal 0, stats.stars
56
+ assert_nil stats.history
57
+
58
+ Hubba.config.data_dir = "#{Hubba.root}/test/stats"
59
+ stats.read
60
+
61
+ assert_equal 1620, stats.size
62
+ assert_equal 1526, stats.stars
63
+ assert_equal 1526, stats.history[0].stars
64
+ assert_equal 1411, stats.history[1].stars
65
+ assert_equal 1084, stats.history[2].stars
66
+ assert_equal 1084, stats.history[-1].stars
67
+ assert_equal 3, stats.history.size
68
+
69
+ assert_equal Date.new(2018, 2, 8 ), stats.history[0].date
70
+ assert_equal Date.new(2018, 1, 28 ), stats.history[1].date
71
+ assert_equal Date.new(2017, 12, 10 ), stats.history[2].date
72
+
73
+ assert_equal 11, stats.history[0].diff_days
74
+ assert_equal 49, stats.history[1].diff_days
75
+ assert_nil stats.history[2].diff_days
76
+
77
+ assert_equal 115, stats.history[0].diff_stars
78
+ assert_equal 327, stats.history[1].diff_stars
79
+ assert_nil stats.history[2].diff_stars
80
+
81
+ assert_equal 221.0, stats.calc_diff_stars ## defaults to samples: 3, days: 30
82
+ assert_equal 51.566, stats.calc_diff_stars( samples: 5, days: 7 )
83
+
84
+ pp stats.history_str ## pp history pretty printed to string (buffer)
85
+ end
86
+
87
+
88
+ def test_factbook_json
89
+
90
+ stats = Hubba::Stats.new( 'opendatajson/factbook.json' )
91
+
92
+ assert_equal 0, stats.size
93
+ assert_equal 0, stats.stars
94
+ assert_nil stats.history
95
+
96
+ Hubba.config.data_dir = "#{Hubba.root}/test/stats"
97
+ stats.read
98
+
99
+ assert_equal 7355, stats.size
100
+ assert_equal 539, stats.stars
101
+ assert_equal 539, stats.history[0].stars
102
+ assert_equal 536, stats.history[1].stars
103
+ assert_equal 533, stats.history[2].stars
104
+ assert_equal 457, stats.history[-1].stars
105
+ assert_equal 7, stats.history.size
106
+
107
+ assert_equal Date.new(2018, 2, 8 ), stats.history[0].date
108
+ assert_equal Date.new(2018, 1, 28 ), stats.history[1].date
109
+ assert_equal Date.new(2017, 12, 10 ), stats.history[2].date
110
+
111
+ assert_equal 11, stats.history[0].diff_days
112
+ assert_equal 49, stats.history[1].diff_days
113
+ assert_nil stats.history[-1].diff_days
114
+
115
+ assert_equal 3, stats.history[0].diff_stars
116
+ assert_equal 3, stats.history[1].diff_stars
117
+ assert_nil stats.history[-1].diff_stars
33
118
 
34
- stats.write( data_dir: './tmp' )
35
- end
119
+ assert_equal 3.0, stats.calc_diff_stars ## defaults to samples: 3, days: 30
120
+ assert_equal 1.012, stats.calc_diff_stars( samples: 5, days: 7 )
36
121
 
37
- assert true # for now everything ok if we get here
122
+ pp stats.history_str ## pp history pretty printed to string (buffer)
38
123
  end
39
124
 
40
125
  end # class TestStats
@@ -0,0 +1,44 @@
1
+ ###
2
+ # to run use
3
+ # ruby -I ./lib -I ./test test/test_stats_tmp.rb
4
+
5
+
6
+ require 'helper'
7
+
8
+
9
+ class TestStatsTmp < MiniTest::Test
10
+
11
+ def setup
12
+ @gh = Hubba::Github.new
13
+ end
14
+
15
+ def test_stats
16
+ repos = [
17
+ 'poole/hyde',
18
+ 'jekyll/minima'
19
+ ]
20
+
21
+
22
+ repos.each do |repo|
23
+ stats = Hubba::Stats.new( repo )
24
+
25
+ Hubba.config.data_dir = "#{Hubba.root}/test/stats"
26
+ stats.read()
27
+
28
+ puts "stars before fetch: #{stats.stars}"
29
+ puts "size before fetch: #{stats.size} kb"
30
+
31
+ ## note/todo: enable for "live" online testing
32
+ ## @gh.update( stats )
33
+
34
+ puts "stars after fetch: #{stats.stars}"
35
+ puts "size after fetch: #{stats.size} kb"
36
+
37
+ Hubba.config.data_dir = './tmp'
38
+ stats.write()
39
+ end
40
+
41
+ assert true # for now everything ok if we get here
42
+ end
43
+
44
+ end # class TestStatsTmp
metadata CHANGED
@@ -1,83 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-08 00:00:00.000000000 Z
11
+ date: 2020-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: logutils
14
+ name: webclient
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.1.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.1.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '7'
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '4.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '7'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: hoe
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '3.16'
53
+ version: '3.22'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '3.16'
55
- description: hubba - (yet) another (lite) GitHub HTTP API client / library
60
+ version: '3.22'
61
+ description: hubba - (yet) another (lite) GitHub HTTP API client / library
56
62
  email: ruby-talk@ruby-lang.org
57
63
  executables: []
58
64
  extensions: []
59
65
  extra_rdoc_files:
60
- - HISTORY.md
66
+ - CHANGELOG.md
61
67
  - Manifest.txt
62
68
  - README.md
63
69
  files:
64
- - HISTORY.md
70
+ - CHANGELOG.md
65
71
  - Manifest.txt
66
72
  - README.md
67
73
  - Rakefile
68
74
  - lib/hubba.rb
69
- - lib/hubba/cache.rb
70
75
  - lib/hubba/client.rb
76
+ - lib/hubba/config.rb
71
77
  - lib/hubba/github.rb
72
78
  - lib/hubba/stats.rb
73
79
  - lib/hubba/version.rb
74
- - test/cache/users~geraldb~orgs.json
75
- - test/cache/users~geraldb~repos.json
76
80
  - test/helper.rb
77
- - test/test_cache.rb
81
+ - test/stats/jekyll~minima.json
82
+ - test/stats/openblockchains~awesome-blockchains.json
83
+ - test/stats/opendatajson~factbook.json.json
84
+ - test/stats/poole~hyde.json
78
85
  - test/test_config.rb
79
86
  - test/test_stats.rb
80
- homepage: https://github.com/gittiscripts/hubba
87
+ - test/test_stats_tmp.rb
88
+ homepage: https://github.com/rubycoco/git
81
89
  licenses:
82
90
  - Public Domain
83
91
  metadata: {}
@@ -91,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
99
  requirements:
92
100
  - - ">="
93
101
  - !ruby/object:Gem::Version
94
- version: '2.3'
102
+ version: 2.2.2
95
103
  required_rubygems_version: !ruby/object:Gem::Requirement
96
104
  requirements:
97
105
  - - ">="
@@ -102,5 +110,5 @@ rubyforge_project:
102
110
  rubygems_version: 2.5.2
103
111
  signing_key:
104
112
  specification_version: 4
105
- summary: hubba - (yet) another (lite) GitHub HTTP API client / library
113
+ summary: hubba - (yet) another (lite) GitHub HTTP API client / library
106
114
  test_files: []