errbit_unfuddle_plugin 0.1.0

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: 3cb2378541cb8e12824fa5a41a033b0a140c1efd
4
+ data.tar.gz: f324ca93a7a88dd118bfb614202100a9c354051d
5
+ SHA512:
6
+ metadata.gz: e07d277f91fa67c5d920efb582db40f29561a2f621a4f2893283f9970e08a78b7fe6295755120b091acb47d88b6c570f91935f89f65c76c3ce3bc68aca6bc6e6
7
+ data.tar.gz: a62b0bf10d0ed98b87d20d8a608ee0c557b116ab0af8bda71862d6eb2d2677d8fe35c1f46a463d50cf9790727822819784c8dce4555bbee8cd91f6d88c42359d
@@ -0,0 +1,18 @@
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
+ .ruby-version
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -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.
@@ -0,0 +1,29 @@
1
+ # ErrbitUnfuddlePlugin
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'errbit_unfuddle_plugin'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install errbit_unfuddle_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
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'errbit_unfuddle_plugin/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "errbit_unfuddle_plugin"
8
+ spec.version = ErrbitUnfuddlePlugin::VERSION
9
+ spec.authors = ["Stephen Crosby"]
10
+ spec.email = ["stevecrozz@gmail.com"]
11
+ spec.description = %q{Unfuddle integration for Errbit}
12
+ spec.summary = %q{Unfuddle integration for Errbit}
13
+ spec.homepage = "https://github.com/brandedcrate/errbit_unfuddle_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_runtime_dependency 'errbit_plugin', '~> 0.4', '>= 0.4.0'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake', '~> 0'
25
+ end
@@ -0,0 +1,12 @@
1
+ require 'errbit_unfuddle_plugin/version'
2
+ require 'errbit_unfuddle_plugin/unfuddle'
3
+ require 'errbit_unfuddle_plugin/issue_tracker'
4
+ require 'errbit_unfuddle_plugin/rails'
5
+
6
+ module ErrbitUnfuddlePlugin
7
+ def self.root
8
+ File.expand_path '../..', __FILE__
9
+ end
10
+ end
11
+
12
+ ErrbitPlugin::Registry.add_issue_tracker(ErrbitUnfuddlePlugin::IssueTracker)
@@ -0,0 +1,98 @@
1
+ module ErrbitUnfuddlePlugin
2
+ class IssueTracker < ErrbitPlugin::IssueTracker
3
+ LABEL = 'unfuddle'
4
+
5
+ NOTE = ''
6
+
7
+ FIELDS = [
8
+ [:account, {
9
+ :placeholder => "account-name (from account-name.unfuddle.com)"
10
+ }],
11
+ [:username, {
12
+ :placeholder => "Your username"
13
+ }],
14
+
15
+ [:password, {
16
+ :placeholder => "Your password"
17
+ }],
18
+ [:project_id, {
19
+ :label => "Ticket Project ID",
20
+ :placeholder => "Project where tickets will be created"
21
+ }],
22
+ [:milestone_id, {
23
+ :optional => true,
24
+ :label => "Ticket Milestone ID",
25
+ :placeholder => "Milestone where tickets will be created"
26
+ }]
27
+ ]
28
+
29
+ def self.label
30
+ LABEL
31
+ end
32
+
33
+ def self.note
34
+ NOTE
35
+ end
36
+
37
+ def self.fields
38
+ FIELDS
39
+ end
40
+
41
+ def self.body_template
42
+ @body_template ||= ERB.new(File.read(
43
+ File.join(
44
+ ErrbitUnfuddlePlugin.root, 'views', 'unfuddle_issues_body.txt.erb'
45
+ )
46
+ ))
47
+ end
48
+
49
+ def url
50
+ sprintf(
51
+ "https://%s.unfuddle.com/projects/%s",
52
+ params['account'],
53
+ params['project_id']
54
+ )
55
+ end
56
+
57
+ def configured?
58
+ errors.empty?
59
+ end
60
+
61
+ def comments_allowed?; false; end
62
+
63
+ def errors
64
+ errors = []
65
+ if self.class.fields.detect {|f| !f[1][:optional] && params[f[0].to_s].blank? }
66
+ errors << [:base, 'You must specify your Account, Username, Password and Project ID']
67
+ end
68
+ errors
69
+ end
70
+
71
+ def create_issue(problem, reported_by = nil)
72
+ ErrbitUnfuddlePlugin.config(params['account'], params['username'], params['password'])
73
+ begin
74
+ issue_options = {
75
+ :project_id => params['project_id'],
76
+ :summary => "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}",
77
+ :priority => '5',
78
+ :status => "new",
79
+ :description => self.class.body_template.result(binding),
80
+ 'description-format' => 'textile'
81
+ }
82
+
83
+ if params['milestone_id'].present?
84
+ issue_options[:milestone_id] = params['milestone_id']
85
+ end
86
+
87
+ issue = ErrbitUnfuddlePlugin::Ticket.create(issue_options)
88
+ problem.update_attributes(
89
+ :issue_link => File.join("#{url}/tickets/#{issue.id}"),
90
+ :issue_type => self.class.label
91
+ )
92
+ rescue ActiveResource::UnauthorizedAccess
93
+ raise ActiveResource::UnauthorizedAccess,
94
+ "Could not authenticate with Unfuddle. Please check your username and password."
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,8 @@
1
+ if defined?(Rails)
2
+ module ErrbitUnfuddlePlugin
3
+ module Rails
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ require 'active_resource'
2
+
3
+ module ErrbitUnfuddlePlugin
4
+ class Ticket < ActiveResource::Base
5
+ self.format = :xml
6
+ end
7
+
8
+ def self.config(account, username, password)
9
+ ErrbitUnfuddlePlugin::Ticket.site = "https://#{account}.unfuddle.com/api/v1/projects/:project_id"
10
+ ErrbitUnfuddlePlugin::Ticket.user = username
11
+ ErrbitUnfuddlePlugin::Ticket.password = password
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module ErrbitUnfuddlePlugin
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,44 @@
1
+ <% if notice = problem.notices.first %>
2
+ h1. <%= notice.message %>
3
+
4
+ h3. "See this exception on Errbit":<%= problem.url %>
5
+
6
+ h2. Summary
7
+ <% if notice.request['url'].present? %>
8
+ h3. URL
9
+
10
+ "<%= notice.request['url'] %>":<%= notice.request['url'] %>
11
+ <% end %>
12
+ h3. Where
13
+
14
+ <%= notice.where %>
15
+
16
+ h3. Occurred
17
+
18
+ <%= notice.created_at.to_s(:micro) %>
19
+
20
+ h3. Similar
21
+
22
+ <%= (notice.problem.notices_count - 1).to_s %>
23
+
24
+ h2. Params
25
+
26
+ <pre><%= pretty_hash(notice.params) %></pre>
27
+
28
+ h2. Session
29
+
30
+ <pre><%= pretty_hash(notice.session) %></pre>
31
+
32
+ h2. Backtrace
33
+
34
+ | Line | File | Method |
35
+ <% notice.backtrace_lines.each do |line| %>| <%= line.number %> | <%= line.file_relative %> | *<%= line.method %>* |
36
+ <% end %>
37
+
38
+ h2. Environment
39
+
40
+ <% for key, val in notice.env_vars %>| <%= key %> | <%= val %> |
41
+ <% end %>
42
+
43
+ <% end %>
44
+
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: errbit_unfuddle_plugin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Stephen Crosby
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-14 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.4'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.4.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.4'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.4.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.3'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.3'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ description: Unfuddle integration for Errbit
62
+ email:
63
+ - stevecrozz@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - ".gitignore"
69
+ - Gemfile
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - errbit_unfuddle_plugin.gemspec
74
+ - lib/errbit_unfuddle_plugin.rb
75
+ - lib/errbit_unfuddle_plugin/issue_tracker.rb
76
+ - lib/errbit_unfuddle_plugin/rails.rb
77
+ - lib/errbit_unfuddle_plugin/unfuddle.rb
78
+ - lib/errbit_unfuddle_plugin/version.rb
79
+ - vendor/assets/images/unfuddle_create.png
80
+ - vendor/assets/images/unfuddle_goto.png
81
+ - vendor/assets/images/unfuddle_inactive.png
82
+ - views/unfuddle_issues_body.txt.erb
83
+ homepage: https://github.com/brandedcrate/errbit_unfuddle_plugin
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.2.2
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Unfuddle integration for Errbit
107
+ test_files: []
108
+ has_rdoc: