hubba-reports 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
+ }
@@ -0,0 +1,123 @@
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
+ def test_jekyll_minima
12
+ stats = Hubba::Stats.new( 'jekyll/minima' )
13
+
14
+ assert_equal 0, stats.size
15
+ assert_equal 0, stats.stars
16
+ assert_nil stats.history
17
+
18
+ Hubba.config.data_dir = "#{HubbaReports.root}/test/stats"
19
+ stats.read
20
+
21
+ assert_equal 321, stats.size
22
+ assert_equal 717, stats.stars
23
+ assert_equal 717, stats.history[0].stars
24
+ assert_equal 1, stats.history.size
25
+
26
+ assert_equal Date.new(2018, 2, 12 ), stats.history[0].date
27
+
28
+ assert_nil stats.history[0].diff_days
29
+
30
+ assert_equal Date.new(2018, 2, 21 ), stats.committed
31
+ assert_equal Date.new(2016, 5, 20 ), stats.created
32
+ assert_equal Date.new(2018, 2, 11 ), stats.updated
33
+ assert_equal Date.new(2018, 2, 7 ), stats.pushed
34
+
35
+ assert_equal DateTime.new(2018, 2, 21, 19, 35, 59 ), stats.committed_at
36
+ assert_equal DateTime.new(2016, 5, 20, 23, 7, 56 ), stats.created_at
37
+ assert_equal DateTime.new(2018, 2, 11, 16, 13, 33 ), stats.updated_at
38
+ assert_equal DateTime.new(2018, 2, 7, 22, 14, 11 ), stats.pushed_at
39
+
40
+
41
+ pp stats.last_commit
42
+ pp stats.last_commit_message
43
+ pp stats.history_str ## pp history pretty printed to string (buffer)
44
+ end
45
+
46
+
47
+
48
+ def test_awesome_blockchains
49
+
50
+ stats = Hubba::Stats.new( 'openblockchains/awesome-blockchains' )
51
+
52
+ assert_equal 0, stats.size
53
+ assert_equal 0, stats.stars
54
+ assert_nil stats.history
55
+
56
+ Hubba.config.data_dir = "#{HubbaReports.root}/test/stats"
57
+ stats.read
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
+ Hubba.config.data_dir = "#{HubbaReports.root}/test/stats"
95
+ stats.read
96
+
97
+ assert_equal 7355, stats.size
98
+ assert_equal 539, stats.stars
99
+ assert_equal 539, stats.history[0].stars
100
+ assert_equal 536, stats.history[1].stars
101
+ assert_equal 533, stats.history[2].stars
102
+ assert_equal 457, stats.history[-1].stars
103
+ assert_equal 7, stats.history.size
104
+
105
+ assert_equal Date.new(2018, 2, 8 ), stats.history[0].date
106
+ assert_equal Date.new(2018, 1, 28 ), stats.history[1].date
107
+ assert_equal Date.new(2017, 12, 10 ), stats.history[2].date
108
+
109
+ assert_equal 11, stats.history[0].diff_days
110
+ assert_equal 49, stats.history[1].diff_days
111
+ assert_nil stats.history[-1].diff_days
112
+
113
+ assert_equal 3, stats.history[0].diff_stars
114
+ assert_equal 3, stats.history[1].diff_stars
115
+ assert_nil stats.history[-1].diff_stars
116
+
117
+ assert_equal 3.0, stats.calc_diff_stars ## defaults to samples: 3, days: 30
118
+ assert_equal 1.012, stats.calc_diff_stars( samples: 5, days: 7 )
119
+
120
+ pp stats.history_str ## pp history pretty printed to string (buffer)
121
+ end
122
+
123
+ 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 = "#{HubbaReports.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 ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hubba-reports
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gerald Bauer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hubba
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.7.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.7.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '7'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '4.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '7'
47
+ - !ruby/object:Gem::Dependency
48
+ name: hoe
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.22'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.22'
61
+ description: hubba-reports - auto-generate github statistics / analytics reports from
62
+ github api data (stars, timeline, traffic, top pages, top referrers, etc.)
63
+ email: ruby-talk@ruby-lang.org
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files:
67
+ - CHANGELOG.md
68
+ - Manifest.txt
69
+ - README.md
70
+ files:
71
+ - CHANGELOG.md
72
+ - Manifest.txt
73
+ - README.md
74
+ - Rakefile
75
+ - lib/hubba/reports.rb
76
+ - lib/hubba/reports/folio.rb
77
+ - lib/hubba/reports/reports/base.rb
78
+ - lib/hubba/reports/reports/catalog.rb
79
+ - lib/hubba/reports/reports/size.rb
80
+ - lib/hubba/reports/reports/stars.rb
81
+ - lib/hubba/reports/reports/summary.rb
82
+ - lib/hubba/reports/reports/timeline.rb
83
+ - lib/hubba/reports/reports/topics.rb
84
+ - lib/hubba/reports/reports/traffic.rb
85
+ - lib/hubba/reports/reports/traffic_pages.rb
86
+ - lib/hubba/reports/reports/traffic_referrers.rb
87
+ - lib/hubba/reports/reports/trending.rb
88
+ - lib/hubba/reports/reports/updates.rb
89
+ - lib/hubba/reports/stats.rb
90
+ - lib/hubba/reports/version.rb
91
+ - test/helper.rb
92
+ - test/stats/j/jekyll~minima.json
93
+ - test/stats/o/openblockchains~awesome-blockchains.json
94
+ - test/stats/o/opendatajson~factbook.json.json
95
+ - test/stats/p/poole~hyde.json
96
+ - test/test_stats.rb
97
+ - test/test_stats_tmp.rb
98
+ homepage: https://github.com/rubycoco/git
99
+ licenses:
100
+ - Public Domain
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options:
104
+ - "--main"
105
+ - README.md
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 2.2.2
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 2.5.2
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: hubba-reports - auto-generate github statistics / analytics reports from
124
+ github api data (stars, timeline, traffic, top pages, top referrers, etc.)
125
+ test_files: []