errbit_pivotal_plugin 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/errbit_pivotal_plugin.rb +4 -0
- data/lib/errbit_pivotal_plugin/issue_tracker.rb +22 -13
- data/lib/errbit_pivotal_plugin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68f81a845658b73749d7ab2a195563a8cb1ad134
|
4
|
+
data.tar.gz: f7b70ba80dc05f8cb13a6b38c14517a20a8297c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c5200488c95796bb42dc7767caf267294dedf7ee42016271e6ac1e7c77cbe72ebefdb6b51da6f472b0b07f769641fa05f8286d2fa056fdd91290134ebec3122
|
7
|
+
data.tar.gz: bccd605323b488a6da64eba7193ca1d1106ad5c6db1723a57f9286560bd0bf1bda5e4ffbd2eafed3ffb72ea895adddb01de589de2b323b291a0f3cee8339bafc
|
@@ -6,6 +6,10 @@ module ErrbitPivotalPlugin
|
|
6
6
|
def self.root
|
7
7
|
File.expand_path '../..', __FILE__
|
8
8
|
end
|
9
|
+
|
10
|
+
def self.read_static_file(file)
|
11
|
+
File.read(File.join(self.root, 'vendor/assets/images', file))
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
ErrbitPlugin::Registry.add_issue_tracker(ErrbitPivotalPlugin::IssueTracker)
|
@@ -30,6 +30,20 @@ module ErrbitPivotalPlugin
|
|
30
30
|
FIELDS
|
31
31
|
end
|
32
32
|
|
33
|
+
def self.icons
|
34
|
+
@icons ||= {
|
35
|
+
create: [
|
36
|
+
'image/png', ErrbitPivotalPlugin.read_static_file('pivotal_create.png')
|
37
|
+
],
|
38
|
+
goto: [
|
39
|
+
'image/png', ErrbitPivotalPlugin.read_static_file('pivotal_goto.png'),
|
40
|
+
],
|
41
|
+
inactive: [
|
42
|
+
'image/png', ErrbitPivotalPlugin.read_static_file('pivotal_inactive.png'),
|
43
|
+
]
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
33
47
|
def self.body_template
|
34
48
|
@body_template ||= ERB.new(File.read(
|
35
49
|
File.join(
|
@@ -43,38 +57,33 @@ module ErrbitPivotalPlugin
|
|
43
57
|
end
|
44
58
|
|
45
59
|
def configured?
|
46
|
-
|
60
|
+
options['project_id'].present? && options['api_token'].present?
|
47
61
|
end
|
48
62
|
|
49
63
|
def comments_allowed?; false; end
|
50
64
|
|
51
65
|
def errors
|
52
66
|
errors = []
|
53
|
-
if self.class.fields.detect {|f|
|
67
|
+
if self.class.fields.detect {|f| options[f[0]].blank? }
|
54
68
|
errors << [:base, 'You must specify your Pivotal Tracker API token and Project ID']
|
55
69
|
end
|
56
70
|
errors
|
57
71
|
end
|
58
72
|
|
59
|
-
def create_issue(
|
60
|
-
PivotalTracker::Client.token =
|
73
|
+
def create_issue(title, body, user: {})
|
74
|
+
PivotalTracker::Client.token = options['api_token']
|
61
75
|
PivotalTracker::Client.use_ssl = true
|
62
|
-
project = PivotalTracker::Project.find
|
76
|
+
project = PivotalTracker::Project.find options['project_id'].to_i
|
63
77
|
story = project.stories.create({
|
64
|
-
:name =>
|
78
|
+
:name => title,
|
65
79
|
:story_type => 'bug',
|
66
|
-
:description =>
|
67
|
-
:requested_by => reported_by.name
|
80
|
+
:description => body
|
68
81
|
})
|
69
82
|
|
70
83
|
if story.errors.present?
|
71
84
|
raise StandardError, story.errors.first
|
72
|
-
else
|
73
|
-
problem.update_attributes(
|
74
|
-
:issue_link => "https://www.pivotaltracker.com/story/show/#{story.id}",
|
75
|
-
:issue_type => self.class.label
|
76
|
-
)
|
77
85
|
end
|
86
|
+
"https://www.pivotaltracker.com/story/show/#{story.id}"
|
78
87
|
end
|
79
88
|
end
|
80
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: errbit_pivotal_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Crosby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: errbit_plugin
|