errbit_github_plugin 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: 7741a7f8a95adb5d10a1e7f69a70e59832dc5ec5
4
+ data.tar.gz: 71de08f7e046d4db9f1285787d1daf9d159e4343
5
+ SHA512:
6
+ metadata.gz: ee896db4640ce263089e2e0bd5c0ae6b6f2f3679e1986d16f4429412f6ca630921cd8cee4c32cc4f7cd8f10938099adedcff352e8a383d0bb5845b6f57198221
7
+ data.tar.gz: 32d93bfc6156226fcaa92e469fb26ad875dd1387afd4d556d89a362774ec0a5d1ba1ef093e1c5778d6026871f4f8ebd5e6d9b1a2504440a54d5379f17e1f75c7
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in errbit_github_plugin.gemspec
4
+ gemspec
5
+
6
+ gem 'errbit_plugin', :git => 'https://github.com/errbit/errbit_plugin.git'
7
+ gem 'rspec'
8
+ gem 'guard'
9
+ gem 'guard-rspec'
10
+ gem 'coveralls', :require => false
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Cyril Mougel
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,29 @@
1
+ # ErrbitGithubPlugin
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'errbit_github_plugin'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install errbit_github_plugin
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'errbit_github_plugin/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "errbit_github_plugin"
8
+ spec.version = ErrbitGithubPlugin::VERSION
9
+ spec.authors = ["Stephen Crosby"]
10
+ spec.email = ["stevecrozz@gmail.com"]
11
+ spec.description = %q{GitHub integration for Errbit}
12
+ spec.summary = %q{GitHub integration for Errbit}
13
+ spec.homepage = "https://github.com/brandedcrate/errbit_github_plugin"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "errbit_plugin"
22
+ spec.add_dependency "octokit"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ end
@@ -0,0 +1,9 @@
1
+ require "errbit_github_plugin/version"
2
+ require 'errbit_github_plugin/error'
3
+ require 'errbit_github_plugin/issue_tracker'
4
+ require 'errbit_github_plugin/rails'
5
+
6
+ ErrbitPlugin::Register.add_issue_tracker(
7
+ 'IssueTrackers::GithubIssuesTracker',
8
+ ErrbitGithubPlugin::IssueTracker
9
+ )
@@ -0,0 +1,3 @@
1
+ module ErrbitGithubPlugin
2
+ class AuthenticationError < Exception; end
3
+ end
@@ -0,0 +1,89 @@
1
+ require 'octokit'
2
+
3
+ module ErrbitGithubPlugin
4
+ class IssueTracker < ErrbitPlugin::IssueTracker
5
+
6
+ LABEL = 'github'
7
+
8
+ NOTE = 'Please configure your github repository in the <strong>GITHUB ' <<
9
+ 'REPO</strong> field above.<br/> Instead of providing your ' <<
10
+ 'username & password, you can link your Github account to your ' <<
11
+ 'user profile, and allow Errbit to create issues using your ' <<
12
+ 'OAuth token.'
13
+
14
+ FIELDS = {
15
+ :username => {
16
+ :placeholder => "Your username on GitHub"
17
+ },
18
+ :password => {
19
+ :placeholder => "Password for your account"
20
+ }
21
+ }
22
+
23
+ def self.label
24
+ LABEL
25
+ end
26
+
27
+ def self.note
28
+ NOTE
29
+ end
30
+
31
+ def self.fields
32
+ FIELDS
33
+ end
34
+
35
+ def self.body_template
36
+ @body_template ||= ERB.new(File.read(
37
+ File.join(
38
+ ErrbitGithubPlugin.root, 'views', 'github_issues_body.txt.erb'
39
+ )
40
+ ))
41
+ end
42
+
43
+ attr_accessor :oauth_token
44
+ attr_reader :url
45
+
46
+ def configured?
47
+ project_id.present?
48
+ end
49
+
50
+ def comments_allowed?; false; end
51
+
52
+ def project_id
53
+ app.github_repo
54
+ end
55
+
56
+ def check_params
57
+ errors = []
58
+ if self.class.fields.detect {|f| params[f[0]].blank? }
59
+ errors << [:base, 'You must specify your GitHub username and password']
60
+ end
61
+ errors
62
+ end
63
+
64
+ def create_issue(problem, reported_by = nil)
65
+ # Login using OAuth token, if given.
66
+ if oauth_token
67
+ client = Octokit::Client.new(:login => username, :oauth_token => oauth_token)
68
+ else
69
+ client = Octokit::Client.new(:login => username, :password => password)
70
+ end
71
+
72
+ begin
73
+ issue = client.create_issue(
74
+ project_id,
75
+ issue_title(problem),
76
+ self.class.body_template.result(binding).unpack('C*').pack('U*')
77
+ )
78
+ @url = issue.html_url
79
+ problem.update_attributes(
80
+ :issue_link => issue.html_url,
81
+ :issue_type => self.class.label
82
+ )
83
+
84
+ rescue Octokit::Unauthorized
85
+ raise ErrbitGithubPlugin::AuthenticationError, "Could not authenticate with GitHub. Please check your username and password."
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,8 @@
1
+ if defined?(Rails)
2
+ module ErrbitGithubPlugin
3
+ module Rails
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module ErrbitGithubPlugin
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: errbit_github_plugin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Stephen Crosby
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: errbit_plugin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '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'
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.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
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
+ description: GitHub integration for Errbit
70
+ email:
71
+ - stevecrozz@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - errbit_github_plugin.gemspec
82
+ - lib/errbit_github_plugin.rb
83
+ - lib/errbit_github_plugin/error.rb
84
+ - lib/errbit_github_plugin/issue_tracker.rb
85
+ - lib/errbit_github_plugin/rails.rb
86
+ - lib/errbit_github_plugin/version.rb
87
+ - vendor/assets/images/github_create.png
88
+ - vendor/assets/images/github_inactive.png
89
+ homepage: https://github.com/brandedcrate/errbit_github_plugin
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.2.2
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: GitHub integration for Errbit
113
+ test_files: []
114
+ has_rdoc: