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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93a6dca4305adaa02d03e88296cf54b2254ff697
4
- data.tar.gz: 25ea296ac2a581ca697768f5edd419008ce321fb
3
+ metadata.gz: 68f81a845658b73749d7ab2a195563a8cb1ad134
4
+ data.tar.gz: f7b70ba80dc05f8cb13a6b38c14517a20a8297c5
5
5
  SHA512:
6
- metadata.gz: d07139c40d01db16b9bb6fbd3553076dd0561a5627aec363a24f79348a2f103f2c11f63130f11ca1e3328327e5742ac9efa96a6ec831d761b6861dbfc6be9657
7
- data.tar.gz: 4ae1101c944b363da37d933aa1ef2db4ca9db147b8c01655198183a6adb100985040f0cd9dfeff0d4f5e55ff3263b2187ddbe91971af3881043add41fc714d7f
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
- params['project_id'].present? && params['api_token'].present?
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| params[f[0].to_s].blank? }
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(problem, reported_by = nil)
60
- PivotalTracker::Client.token = params['api_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 params['project_id'].to_i
76
+ project = PivotalTracker::Project.find options['project_id'].to_i
63
77
  story = project.stories.create({
64
- :name => "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}",
78
+ :name => title,
65
79
  :story_type => 'bug',
66
- :description => self.class.body_template.result(binding).unpack('C*').pack('U*'),
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
@@ -1,3 +1,3 @@
1
1
  module ErrbitPivotalPlugin
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  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.3.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-06-17 00:00:00.000000000 Z
11
+ date: 2015-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: errbit_plugin