githop 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -0
- data/bin/githop +1 -18
- data/lib/githop/command.rb +24 -0
- data/lib/githop/version.rb +1 -1
- data/lib/githop.rb +10 -6
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b0602a3d04493f7bc0a6cb6edce8ff53a1ac355
|
4
|
+
data.tar.gz: 2c4be77cbf81bd11e80072d95591b515ee0e8b8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2790df340ee9faaa793bb2a0312b4e04e029a6b7d5353215e3bb96644e698b6aba797b153f3e7eeba74f191b709acc2c644ae60b1a50d994d45b3955743e97f4
|
7
|
+
data.tar.gz: 97c8ea236ec5a08c06ea47c1b840a3cfb6ce594e9e2c34fdb31ba99452b0b7ff58d45eab2443c62bb561a3e849a42a5334afa4645e13e252b83c299f06bf5951
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -25,6 +25,9 @@ At 2014-05-24 10:15:34, jpsim watched the repo shahruz/Sketch-Toolbox
|
|
25
25
|
At 2014-05-24 10:18:35, jpsim watched the repo heardrwt/RHObjectiveBeagle
|
26
26
|
```
|
27
27
|
|
28
|
+
For the real lazy, it is also available on the web: <https://githop-yolo.herokuapp.com/orta>, specify
|
29
|
+
the desired GitHub user as path.
|
30
|
+
|
28
31
|
## Installation
|
29
32
|
|
30
33
|
Use
|
data/bin/githop
CHANGED
@@ -9,21 +9,4 @@ end
|
|
9
9
|
|
10
10
|
require 'githop'
|
11
11
|
|
12
|
-
|
13
|
-
other_user = ARGV.first
|
14
|
-
|
15
|
-
result = GitHop.hop(config, other_user)
|
16
|
-
|
17
|
-
if result['rows'].nil?
|
18
|
-
$stderr.puts "GitHub Archive query for #{other_user || config['github_user']} had no results."
|
19
|
-
$stderr.puts result.inspect
|
20
|
-
exit(1)
|
21
|
-
end
|
22
|
-
|
23
|
-
result = GitHop.pretty_print(result, other_user)
|
24
|
-
|
25
|
-
if result.count == 0
|
26
|
-
puts "No events found, but #{other_user || 'you'} surely had an awesome day nevertheless :)"
|
27
|
-
else
|
28
|
-
puts result
|
29
|
-
end
|
12
|
+
GitHop::Command.run(ARGV.first)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'active_support/time'
|
2
|
+
|
3
|
+
module GitHop
|
4
|
+
class Command
|
5
|
+
def self.run(other_user, date = 1.year.ago)
|
6
|
+
config = YAML.load(File.read("#{ENV['HOME']}/.githop.yml"))
|
7
|
+
result = GitHop.hop(config, other_user, date)
|
8
|
+
|
9
|
+
if result['rows'].nil?
|
10
|
+
$stderr.puts "GitHub Archive query for #{other_user || config['github_user']} had no results."
|
11
|
+
$stderr.puts result.inspect
|
12
|
+
exit(1)
|
13
|
+
end
|
14
|
+
|
15
|
+
result = GitHop.pretty_print(result, other_user)
|
16
|
+
|
17
|
+
if result.count == 0
|
18
|
+
puts "No events found, but #{other_user || 'you'} surely had an awesome day nevertheless :)"
|
19
|
+
else
|
20
|
+
puts result
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/githop/version.rb
CHANGED
data/lib/githop.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'githop/command'
|
1
2
|
require 'githop/version'
|
2
3
|
|
3
4
|
require 'active_support/time'
|
@@ -8,8 +9,7 @@ require 'yaml'
|
|
8
9
|
module GitHop
|
9
10
|
private
|
10
11
|
|
11
|
-
def self.build_query_2014(gh_user)
|
12
|
-
end_date = 1.year.ago
|
12
|
+
def self.build_query_2014(gh_user, end_date)
|
13
13
|
month = end_date.strftime('%Y%m')
|
14
14
|
end_date = end_date.strftime('%Y-%m-%d')
|
15
15
|
|
@@ -24,8 +24,7 @@ END
|
|
24
24
|
query
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.build_query_2015(gh_user)
|
28
|
-
end_date = 1.year.ago
|
27
|
+
def self.build_query_2015(gh_user, end_date)
|
29
28
|
start_date = (end_date - 1.day).strftime('%Y-%m-%d')
|
30
29
|
end_date = end_date.strftime('%Y-%m-%d')
|
31
30
|
|
@@ -50,9 +49,9 @@ END
|
|
50
49
|
opts
|
51
50
|
end
|
52
51
|
|
53
|
-
def self.hop(config, user = nil)
|
52
|
+
def self.hop(config, user = nil, date = 1.year.ago)
|
54
53
|
bq = BigQuery::Client.new(client_options(config))
|
55
|
-
query = build_query_2014(user || config['github_user'])
|
54
|
+
query = build_query_2014(user || config['github_user'], date)
|
56
55
|
result = bq.query(query)
|
57
56
|
|
58
57
|
# File.open('bigquery-sample.marshal', 'w') { |to_file| Marshal.dump(result, to_file) }
|
@@ -65,6 +64,7 @@ END
|
|
65
64
|
def self.labels
|
66
65
|
{
|
67
66
|
'CreateEvent' => 'created the',
|
67
|
+
'DeleteEvent' => 'deleted the',
|
68
68
|
'ForkEvent' => 'forked the repo',
|
69
69
|
'IssueCommentEvent' => 'commented an issue on',
|
70
70
|
'IssuesEvent' => 'created an issue on',
|
@@ -93,6 +93,10 @@ END
|
|
93
93
|
action += " #{ref} on" if ref_type != 'repository'
|
94
94
|
end
|
95
95
|
|
96
|
+
if type == 'DeleteEvent'
|
97
|
+
action += " #{ref_type} #{ref} on"
|
98
|
+
end
|
99
|
+
|
96
100
|
if type == 'PushEvent'
|
97
101
|
next if pushed_repos.include?(target)
|
98
102
|
pushed_repos << target
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: githop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Bügling
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- bin/githop
|
85
85
|
- githop.gemspec
|
86
86
|
- lib/githop.rb
|
87
|
+
- lib/githop/command.rb
|
87
88
|
- lib/githop/version.rb
|
88
89
|
homepage: https://github.com/neonichu/githop
|
89
90
|
licenses:
|