ellen-github 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f1587809e50c74786a3bef3204c9d2b8b76595b0
4
+ data.tar.gz: 6602da3e0e1f1997d6c0a06e50555b3008430d58
5
+ SHA512:
6
+ metadata.gz: 21e119a14ed2410a2f411f65a3ca6216fdcf464375df94808c4bc5432558ea44cca38d9d00f8a7cf00dd24400471ea33a3292bb2a0ee24ffc14c5c8a19bd25bc
7
+ data.tar.gz: 54d5f3f8832d61e7440cbb00bad04b64a3ad5dd59932b61eababe31d8dc5d1bad6a79b2d30de426843322b01921e9766782ab66f99a892f63e0d65e18c316063
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ellen-github.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ryo Nakamura
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.
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # Ellen::Github
2
+ Manage GitHub via Ellen.
3
+
4
+ ## Install
5
+ ```
6
+ # Gemfile
7
+ gem "ellen-github"
8
+ ```
9
+
10
+ ## Usage
11
+ ```
12
+ @ellen create issue "<title>" on <username>/<repository> - Create a new Issue
13
+ ```
14
+
15
+ ## ENV
16
+ ```
17
+ GITHUB_ACCESS_TOKEN - Github Access Token with `repo` or `public_repo` scope"
18
+ ```
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,25 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'ellen/github/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "ellen-github"
7
+ spec.version = Ellen::Github::VERSION
8
+ spec.authors = ["Ryo Nakamura"]
9
+ spec.email = ["r7kamura@gmail.com"]
10
+ spec.summary = "Manage GitHub via Ellen."
11
+ spec.homepage = "https://github.com/r7kamura/ellen-github"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0")
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_dependency "ellen", ">= 0.1.2"
20
+ spec.add_dependency "octokit"
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec", "2.14.1"
24
+ spec.add_development_dependency "webmock"
25
+ end
@@ -0,0 +1,3 @@
1
+ require "ellen"
2
+ require "ellen/github/version"
3
+ require "ellen/handlers/github"
@@ -0,0 +1,5 @@
1
+ module Ellen
2
+ module Github
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ require "octokit"
2
+
3
+ module Ellen
4
+ module Handlers
5
+ class Github < Base
6
+ on(/create issue "(?<title>.+)" on (?<repo>.+)\z/, name: "create_issue", description: "Create a new issue")
7
+
8
+ env :GITHUB_ACCESS_TOKEN, "Github Access Token with `repo` or `public_repo` scope"
9
+
10
+ def create_issue(message)
11
+ client.create_issue(message[:repo], message[:title], nil)
12
+ end
13
+
14
+ private
15
+
16
+ def client
17
+ @client ||= Octokit::Client.new(access_token: access_token)
18
+ end
19
+
20
+ def access_token
21
+ ENV["GITHUB_ACCESS_TOKEN"]
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,7 @@
1
+ require "spec_helper"
2
+
3
+ describe Ellen::Github do
4
+ it "can be loaded without any errors" do
5
+ should be_true
6
+ end
7
+ end
@@ -0,0 +1,72 @@
1
+ require "spec_helper"
2
+ require "json"
3
+
4
+ describe Ellen::Handlers::Github do
5
+ before do
6
+ ENV["GITHUB_ACCESS_TOKEN"] = github_access_token
7
+ end
8
+
9
+ after do
10
+ ENV["GITHUB_ACCESS_TOKEN"] = nil
11
+ end
12
+
13
+ let(:robot) do
14
+ Ellen::Robot.new
15
+ end
16
+
17
+ let(:github_access_token) do
18
+ "dummy"
19
+ end
20
+
21
+ describe "#initialize" do
22
+ context "without GITHUB_ACCESS_TOKEN" do
23
+ let(:github_access_token) do
24
+ nil
25
+ end
26
+
27
+ it "dies" do
28
+ Ellen.should_receive(:die)
29
+ described_class.new(robot)
30
+ end
31
+ end
32
+
33
+ context "with GITHUB_ACCESS_TOKEN" do
34
+ it "does not die" do
35
+ Ellen.should_not_receive(:die)
36
+ described_class.new(robot)
37
+ end
38
+ end
39
+ end
40
+
41
+ describe "#create_issue" do
42
+ before do
43
+ stub_request(:post, "https://api.github.com/repos/#{user}/#{repository}/issues").
44
+ with(
45
+ body: {
46
+ labels: nil,
47
+ title: title,
48
+ body: nil,
49
+ }.to_json,
50
+ headers: {
51
+ Authorization: "token #{github_access_token}"
52
+ },
53
+ )
54
+ end
55
+
56
+ let(:user) do
57
+ "alice"
58
+ end
59
+
60
+ let(:repository) do
61
+ "test"
62
+ end
63
+
64
+ let(:title) do
65
+ "This is a test issue"
66
+ end
67
+
68
+ it "creates a new issue with given title on given repository" do
69
+ robot.receive(body: %<ellen create issue "#{title}" on #{user}/#{repository}>)
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,8 @@
1
+ require "ellen/github"
2
+ require "webmock/rspec"
3
+
4
+ RSpec.configure do |config|
5
+ config.treat_symbols_as_metadata_keys_with_true_values = true
6
+ config.run_all_when_everything_filtered = true
7
+ config.filter_run :focus
8
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ellen-github
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryo Nakamura
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ellen
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: octokit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 2.14.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 2.14.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - r7kamura@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - ellen-github.gemspec
110
+ - lib/ellen/github.rb
111
+ - lib/ellen/github/version.rb
112
+ - lib/ellen/handlers/github.rb
113
+ - spec/ellen/github_spec.rb
114
+ - spec/ellen/handlers/github_spec.rb
115
+ - spec/spec_helper.rb
116
+ homepage: https://github.com/r7kamura/ellen-github
117
+ licenses:
118
+ - MIT
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.2.2
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Manage GitHub via Ellen.
140
+ test_files:
141
+ - spec/ellen/github_spec.rb
142
+ - spec/ellen/handlers/github_spec.rb
143
+ - spec/spec_helper.rb
144
+ has_rdoc: