hubba 0.5.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,25 +0,0 @@
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
- }
@@ -1,27 +0,0 @@
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
- }
@@ -1,39 +0,0 @@
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
- }
@@ -1,21 +0,0 @@
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,43 +0,0 @@
1
- ###
2
- # to run use
3
- # ruby -I ./lib -I ./test test/test_cache.rb
4
-
5
-
6
- require 'helper'
7
-
8
-
9
- class TestCache < MiniTest::Test
10
-
11
- def setup
12
- @cache = Hubba::Cache.new( "#{Hubba.root}/test/cache" )
13
- end
14
-
15
- def test_basename
16
- mappings = [['/users/geraldb', 'users~geraldb'],
17
- ['/users/geraldb/repos', 'users~geraldb~repos'],
18
- ['/users/geraldb/repos?per_page=100', 'users~geraldb~repos'],
19
- ['/users/geraldb/orgs', 'users~geraldb~orgs'],
20
- ['/users/geraldb/orgs?per_page=100', 'users~geraldb~orgs'],
21
- ['/orgs/wikiscript/repos', 'orgs~wikiscript~repos'],
22
- ['/orgs/planetjekyll/repos', 'orgs~planetjekyll~repos'],
23
- ['/orgs/vienna-rb/repos', 'orgs~vienna-rb~repos']]
24
-
25
- mappings.each do |mapping|
26
- assert_equal mapping[1], @cache.request_uri_to_basename( mapping[0] )
27
- end
28
- end # method test_basename
29
-
30
- def test_cache
31
- orgs = @cache.get( '/users/geraldb/orgs' )
32
- assert_equal 4, orgs.size
33
-
34
- repos = @cache.get( '/users/geraldb/repos' )
35
- assert_equal 3, repos.size
36
- end # method test_cache
37
-
38
- def test_cache_miss
39
- assert_nil @cache.get( '/test/hello' )
40
- assert_nil @cache.get( '/test/hola' )
41
- end # method test_cache_miss
42
-
43
- end # class TestCache
@@ -1,122 +0,0 @@
1
- ###
2
- # to run use
3
- # ruby -I ./lib -I ./test test/test_stats.rb
4
-
5
-
6
- require 'helper'
7
-
8
-
9
- class TestStats < MiniTest::Test
10
-
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
- stats.read( data_dir: "#{Hubba.root}/test/stats" )
21
-
22
- assert_equal 321, stats.size
23
- assert_equal 717, stats.stars
24
- assert_equal 717, stats.history[0].stars
25
- assert_equal 1, stats.history.size
26
-
27
- assert_equal Date.new(2018, 2, 12 ), stats.history[0].date
28
-
29
- assert_nil stats.history[0].diff_days
30
-
31
- assert_equal Date.new(2018, 2, 21 ), stats.committed
32
- assert_equal Date.new(2016, 5, 20 ), stats.created
33
- assert_equal Date.new(2018, 2, 11 ), stats.updated
34
- assert_equal Date.new(2018, 2, 7 ), stats.pushed
35
-
36
- assert_equal DateTime.new(2018, 2, 21, 19, 35, 59 ), stats.committed_at
37
- assert_equal DateTime.new(2016, 5, 20, 23, 7, 56 ), stats.created_at
38
- assert_equal DateTime.new(2018, 2, 11, 16, 13, 33 ), stats.updated_at
39
- assert_equal DateTime.new(2018, 2, 7, 22, 14, 11 ), stats.pushed_at
40
-
41
-
42
- pp stats.last_commit
43
- pp stats.last_commit_message
44
- pp stats.history_str ## pp history pretty printed to string (buffer)
45
- end
46
-
47
-
48
-
49
- def test_awesome_blockchains
50
-
51
- stats = Hubba::Stats.new( 'openblockchains/awesome-blockchains' )
52
-
53
- assert_equal 0, stats.size
54
- assert_equal 0, stats.stars
55
- assert_nil stats.history
56
-
57
- stats.read( data_dir: "#{Hubba.root}/test/stats" )
58
-
59
- assert_equal 1620, stats.size
60
- assert_equal 1526, stats.stars
61
- assert_equal 1526, stats.history[0].stars
62
- assert_equal 1411, stats.history[1].stars
63
- assert_equal 1084, stats.history[2].stars
64
- assert_equal 1084, stats.history[-1].stars
65
- assert_equal 3, stats.history.size
66
-
67
- assert_equal Date.new(2018, 2, 8 ), stats.history[0].date
68
- assert_equal Date.new(2018, 1, 28 ), stats.history[1].date
69
- assert_equal Date.new(2017, 12, 10 ), stats.history[2].date
70
-
71
- assert_equal 11, stats.history[0].diff_days
72
- assert_equal 49, stats.history[1].diff_days
73
- assert_nil stats.history[2].diff_days
74
-
75
- assert_equal 115, stats.history[0].diff_stars
76
- assert_equal 327, stats.history[1].diff_stars
77
- assert_nil stats.history[2].diff_stars
78
-
79
- assert_equal 221.0, stats.calc_diff_stars ## defaults to samples: 3, days: 30
80
- assert_equal 51.566, stats.calc_diff_stars( samples: 5, days: 7 )
81
-
82
- pp stats.history_str ## pp history pretty printed to string (buffer)
83
- end
84
-
85
-
86
- def test_factbook_json
87
-
88
- stats = Hubba::Stats.new( 'opendatajson/factbook.json' )
89
-
90
- assert_equal 0, stats.size
91
- assert_equal 0, stats.stars
92
- assert_nil stats.history
93
-
94
- stats.read( data_dir: "#{Hubba.root}/test/stats" )
95
-
96
- assert_equal 7355, stats.size
97
- assert_equal 539, stats.stars
98
- assert_equal 539, stats.history[0].stars
99
- assert_equal 536, stats.history[1].stars
100
- assert_equal 533, stats.history[2].stars
101
- assert_equal 457, stats.history[-1].stars
102
- assert_equal 7, stats.history.size
103
-
104
- assert_equal Date.new(2018, 2, 8 ), stats.history[0].date
105
- assert_equal Date.new(2018, 1, 28 ), stats.history[1].date
106
- assert_equal Date.new(2017, 12, 10 ), stats.history[2].date
107
-
108
- assert_equal 11, stats.history[0].diff_days
109
- assert_equal 49, stats.history[1].diff_days
110
- assert_nil stats.history[-1].diff_days
111
-
112
- assert_equal 3, stats.history[0].diff_stars
113
- assert_equal 3, stats.history[1].diff_stars
114
- assert_nil stats.history[-1].diff_stars
115
-
116
- assert_equal 3.0, stats.calc_diff_stars ## defaults to samples: 3, days: 30
117
- assert_equal 1.012, stats.calc_diff_stars( samples: 5, days: 7 )
118
-
119
- pp stats.history_str ## pp history pretty printed to string (buffer)
120
- end
121
-
122
- end # class TestStats
@@ -1,41 +0,0 @@
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( cache_dir: "#{Hubba.root}/test/cache" )
13
- end
14
-
15
- def test_stats
16
- repos = [
17
- 'poole/hyde',
18
- 'jekyll/minima'
19
- ]
20
-
21
- repos.each do |repo|
22
- stats = Hubba::Stats.new( repo )
23
- # stats.read( data_dir: './tmp' )
24
- stats.read( data_dir: "#{Hubba.root}/test/stats" )
25
-
26
- puts "stars before fetch: #{stats.stars}"
27
- puts "size before fetch: #{stats.size} kb"
28
-
29
- ## note/todo: enable for "live" online testing
30
- ## stats.fetch( @gh )
31
-
32
- puts "stars after fetch: #{stats.stars}"
33
- puts "size after fetch: #{stats.size} kb"
34
-
35
- stats.write( data_dir: './tmp' )
36
- end
37
-
38
- assert true # for now everything ok if we get here
39
- end
40
-
41
- end # class TestStatsTmp