github-nippou 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0a177d3478f16e02a684556a4afe402241746088
4
+ data.tar.gz: 8381e16825ba150d2e1d47565f571a3ce77f9049
5
+ SHA512:
6
+ metadata.gz: 9abdb98b8b658e104319c12d525ff6bcd640e66dff97a7746ef0aedacc31b8cb63cbf5c6669c8cb2c69ca5b70d9aa9fcd966f6fca5a0aa4bdb0f7ee288d9fa43
7
+ data.tar.gz: b6afba3a4de325027063fcb3fe2b3ac1eb9a82e82f768c25eb6144a9899696dfb5884b65b785df2c899477b44b9443ce8ba4310b9cf0f31799be1028c80c6a91
@@ -0,0 +1,3 @@
1
+ *.gem
2
+ /.bundle
3
+ /vendor/bundle
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in github-nippou.gemspec
4
+ gemspec
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ github-nippou (0.0.1)
5
+ octokit (~> 3.7)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.3.6)
11
+ diff-lcs (1.2.5)
12
+ faraday (0.9.0)
13
+ multipart-post (>= 1.2, < 3)
14
+ multipart-post (2.0.0)
15
+ octokit (3.7.0)
16
+ sawyer (~> 0.6.0, >= 0.5.3)
17
+ rake (10.4.2)
18
+ rspec (3.1.0)
19
+ rspec-core (~> 3.1.0)
20
+ rspec-expectations (~> 3.1.0)
21
+ rspec-mocks (~> 3.1.0)
22
+ rspec-core (3.1.7)
23
+ rspec-support (~> 3.1.0)
24
+ rspec-expectations (3.1.2)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.1.0)
27
+ rspec-mocks (3.1.3)
28
+ rspec-support (~> 3.1.0)
29
+ rspec-support (3.1.2)
30
+ sawyer (0.6.0)
31
+ addressable (~> 2.3.5)
32
+ faraday (~> 0.8, < 0.10)
33
+
34
+ PLATFORMS
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ bundler (~> 1.7)
39
+ github-nippou!
40
+ rake (~> 10.0)
41
+ rspec (~> 3.1)
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Takashi Masuda
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # Github::Nippou
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'github-nippou'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install github-nippou
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/github-nippou/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'github/nippou/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "github-nippou"
8
+ spec.version = Github::Nippou::VERSION
9
+ spec.authors = ["Takashi Masuda"]
10
+ spec.email = ["masutaka.net@gmail.com"]
11
+ spec.summary = %q{Outputs today's your GitHub action.}
12
+ spec.description = <<-EOS
13
+ This is a helpful tool when you write a daily report in reference to
14
+ GitHub. nippou is a japanese word which means a daily report.
15
+ EOS
16
+ spec.homepage = "https://github.com/masutaka/github-nippou"
17
+ spec.license = "MIT"
18
+
19
+ spec.files = `git ls-files -z`.split("\x0")
20
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "octokit", "~> 3.7"
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.7"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.1"
29
+ end
@@ -0,0 +1,74 @@
1
+ require "github/nippou/version"
2
+ require 'octokit'
3
+
4
+ module Github
5
+ module Nippou
6
+ def self.list
7
+ user = self.user
8
+ client = Octokit::Client.new(login: user, access_token: self.access_token)
9
+ events = client.user_events(user)
10
+
11
+ url_to_detail = {}
12
+
13
+ events.each do |_|
14
+ break unless _.created_at.getlocal.to_date == Time.now.to_date
15
+ case _.type
16
+ when "IssuesEvent"
17
+ url_to_detail[_.payload.issue.html_url] ||= {title: _.payload.issue.title, comments: []}
18
+ when "IssueCommentEvent"
19
+ url_to_detail[_.payload.issue.html_url] ||= {title: _.payload.issue.title, comments: []}
20
+ url_to_detail[_.payload.issue.html_url][:comments] << _.payload.comment.html_url
21
+ when "PullRequestEvent"
22
+ url_to_detail[_.payload.pull_request.html_url] ||= {title: _.payload.pull_request.title, comments: []}
23
+ end
24
+ end
25
+
26
+ url_to_detail.each do |url, detail|
27
+ puts "- #{detail[:title]} #{url}"
28
+ detail[:comments].reverse.each do |comment|
29
+ puts " * #{comment}"
30
+ end
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def self.user
37
+ case
38
+ when ENV['GITHUB_NIPPOU_USER']
39
+ ENV['GITHUB_NIPPOU_USER']
40
+ when !`git config github-nippou.user`.chomp.empty?
41
+ `git config github-nippou.user`.chomp
42
+ else
43
+ puts <<MESSAGE
44
+ ** User required.
45
+
46
+ Please set github-nippou.user to your .gitconfig.
47
+ $ git config --global github-nippou.user [Your GitHub account]
48
+ MESSAGE
49
+ exit!
50
+ end
51
+ end
52
+
53
+ def self.access_token
54
+ case
55
+ when ENV['GITHUB_NIPPOU_ACCESS_TOKEN']
56
+ ENV['GITHUB_NIPPOU_ACCESS_TOKEN']
57
+ when !`git config github-nippou.token`.chomp.empty?
58
+ `git config github-nippou.token`.chomp
59
+ else
60
+ puts <<MESSAGE
61
+ ** Authorization required.
62
+
63
+ Please set github-nippou.token to your .gitconfig.
64
+ $ git config --global github-nippou.token [Your GitHub access token]
65
+
66
+ To get new token, visit
67
+ https://github.com/settings/tokens/new
68
+
69
+ MESSAGE
70
+ exit!
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,5 @@
1
+ module Github
2
+ module Nippou
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Github::Nippou do
4
+ it 'has a version number' do
5
+ expect(Github::Nippou::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'does something useful' do
9
+ expect(false).to eq(true)
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'github/nippou'
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: github-nippou
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Takashi Masuda
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: octokit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.1'
69
+ description: |2
70
+ This is a helpful tool when you write a daily report in reference to
71
+ GitHub. nippou is a japanese word which means a daily report.
72
+ email:
73
+ - masutaka.net@gmail.com
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - ".travis.yml"
81
+ - Gemfile
82
+ - Gemfile.lock
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - github-nippou.gemspec
87
+ - lib/github/nippou.rb
88
+ - lib/github/nippou/version.rb
89
+ - spec/github/nippou_spec.rb
90
+ - spec/spec_helper.rb
91
+ homepage: https://github.com/masutaka/github-nippou
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.4.5
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Outputs today's your GitHub action.
115
+ test_files:
116
+ - spec/github/nippou_spec.rb
117
+ - spec/spec_helper.rb