tracker_deliveries 0.1.9 → 1.0.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: 6755efea31d188ae01312d023d7dd8490492a12f
4
- data.tar.gz: 1b6bfa2ff643e7e8070cd86e711812c2c668718e
3
+ metadata.gz: a3009563d0b297464d4de9ef7a1bb383ad41eeb8
4
+ data.tar.gz: '0729d0990542799323f21c99fdfdf18b0cc26851'
5
5
  SHA512:
6
- metadata.gz: dd8cd9af29575dd8ece7c27998303ad79354e5103e4ce72b53016c9e437b00275f995e4050b531b178c98ab6a0229edc477f338502c0386bd4681c2d671e1c87
7
- data.tar.gz: 602ecee6fd4d1a52599df4cf5b9dc2311d42c9ec5f21f8e12cf1d3ccbfc5d8ec745f8f7aadc029f6fa1c3a8549ce48baec26c68a4a014f514006dda5fd365d12
6
+ metadata.gz: c14697e7adaf55e8d27e28f13dd5e33317297ac4932d887cce86b2a3f5e52db4dc404015dc3b12b504687cb6cecb9279571b5ac9c4eda13a657bbf5e12c29f49
7
+ data.tar.gz: f89d108d9c59a6380ad2a3ee45c0df98c7909dc6acac6d5fc993a9e0b34c15980ed97c8bfed864de678731a51b856d0d82f22f4840176965f004b25267173e8d
data/.circleci/config.yml CHANGED
@@ -20,12 +20,13 @@ jobs:
20
20
  - run:
21
21
  name: run tests
22
22
  command: |
23
- mkdir /tmp/test-results
23
+ mkdir -p /tmp/test-results
24
24
  TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
25
25
  bundle exec rspec --format documentation \
26
26
  --format RspecJunitFormatter \
27
27
  --out /tmp/test-results/rspec.xml \
28
- "${TEST_FILES}"
28
+ -- $(sed -e 's/\n/\\n/' -e 's/ /\ /' <<< "${TEST_FILES}")
29
+
29
30
  - store_test_results:
30
31
  path: /tmp/test-results
31
32
  - store_artifacts:
data/README.md CHANGED
@@ -6,9 +6,10 @@
6
6
 
7
7
  # TrackerDeliveries
8
8
 
9
- Generates a list of currently delivered tracker stories.
9
+ A command-line tool (and ruby gem) to generate a list of Pivotal Tracker
10
+ stories that are delivered for a project.
10
11
 
11
- Made to assist automatically generating release notes
12
+ It was made to assist automatically generating release notes
12
13
  for continuous delivery.
13
14
 
14
15
  ## Installation
@@ -17,69 +18,45 @@ for continuous delivery.
17
18
  gem install tracker_deliveries
18
19
  ```
19
20
 
20
- ## Usage
21
-
22
- Define these environment variables:
23
-
24
- - `TRACKER_DELIVERIES_API_TOKEN` - tracker API token
25
- - `TRACKER_DELIVERIES_PROJECT_ID` - tracker project ID
26
-
27
- Run:
21
+ ## Usage:
28
22
 
29
23
  ```
30
- tracker_deliveries
24
+ tracker_deliveries [options]
31
25
  ```
32
26
 
33
- Output current delivered stories ids & story titles as plaintext e.g.:
27
+ options:
34
28
 
35
29
  ```
36
- 132412351 - Add widget service request to order form
37
- 123412144 - Display widget detail view UI
38
- 131412414 - Update widget quantity in shopping cart
39
- 132412155 - Localize cart in Pirate speak, arr.
30
+ --tracker:token=TOKEN PivotalTracker API Token
31
+ --tracker:project=PROJECT_ID PivotalTracker project id
32
+ --format:FORMAT plaintext|html|markdown (default: plaintext)
40
33
  ```
41
34
 
42
- ### Formatting output
35
+ Environment variables can be used for `TOKEN` or `PROJECT_ID`.
43
36
 
44
- Generate the list with alternative formatting as Markdown or HTML (with built in links to the tracker stories):
37
+ `TRACKER_DELIVERIES_PROJECT_ID`
38
+ `TRACKER_DELIVERIES_API_TOKEN`
45
39
 
46
- ```
47
- tracker_deliveries --markdown
48
- ```
40
+ Show the current delivered stories as id and title.
49
41
 
50
- ```
51
- - [132412351](https://pivotaltracker.com/story/show/132412351) - Add widget service request to order form
52
- - [123412144](https://pivotaltracker.com/story/show/123412144) - Display widget detail view UI
53
- - [131412414](https://pivotaltracker.com/story/show/131412414) - Update widget quantity in shopping cart
54
- - [132412155](https://pivotaltracker.com/story/show/132412155) - Localize cart in Pirate speak, arr.
55
- ```
42
+ Story ids will link back to PivotalTracker when using
43
+ `--format:markdown` or `--format:html`
56
44
 
57
- or
45
+ * * *
58
46
 
59
- ```
60
- tracker_deliveries --html
61
- ```
47
+ # Example output (plaintext format)
62
48
 
63
49
  ```
64
- <ul>
65
- <li><a href="https://pivotaltracker.com/story/show/132412351">132412351</a> - Add widget service request to order form</li>
66
- <li><a href="https://pivotaltracker.com/story/show/123412144">123412144</a> - Display widget detail view UI</li>
67
- <li><a href="https://pivotaltracker.com/story/show/131412414">131412414</a> - Update widget quantity in shopping cart</li>
68
- <li><a href="https://pivotaltracker.com/story/show/132412155">132412155</a> - Localize cart in Pirate speak, arr.</li>
69
- </ul>
50
+ 132412351 - Add widget service request to order form
51
+ 123412144 - Display widget detail view UI
52
+ 131412414 - Update widget quantity in shopping cart
53
+ 132412155 - Localize cart in Pirate speak, arr.
70
54
  ```
71
55
 
72
- Rendering as:
73
-
74
- - [132412351](https://pivotaltracker.com/story/show/132412351) - Add widget service request to order form
75
- - [123412144](https://pivotaltracker.com/story/show/123412144) - Display widget detail view UI
76
- - [131412414](https://pivotaltracker.com/story/show/131412414) - Update widget quantity in shopping cart
77
- - [132412155](https://pivotaltracker.com/story/show/132412155) - Localize cart in Pirate speak, arr.
78
-
79
- ## Get hold of the Pivotal Tracker API Token / Project ID
56
+ ## How do I get the Pivotal Tracker API Token & Project ID?
80
57
 
81
- On https://www.pivotaltracker.com/profile (while logged in) the API
82
- token is at the bottom of the page.
58
+ Login to PivotalTracker and visit https://www.pivotaltracker.com/profile
59
+ The API token is at the bottom of the page.
83
60
 
84
61
  Visit your PivotalTracker project the `project_id` last part of
85
62
  the URL, e.g. `https://www.pivotaltracker.com/n/projects/1234567` the
@@ -1,12 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- mode: ruby -*-
3
3
 
4
- require 'tracker_deliveries'
4
+ require 'tracker_deliveries_command'
5
5
 
6
- if ARGV[0] == '--markdown'
7
- puts TrackerDeliveries::Main.new(format: :markdown).delivered_stories
8
- elsif ARGV[0] == '--html'
9
- puts TrackerDeliveries::Main.new(format: :html).delivered_stories
10
- else
11
- puts TrackerDeliveries::Main.new().delivered_stories
12
- end
6
+ TrackerDeliveriesCommand.new().main ARGV.join(' ')
@@ -0,0 +1,29 @@
1
+ require 'sinatra'
2
+ require 'json'
3
+
4
+ def status_message id
5
+ STDERR.puts '<== requested =============================================================================>'
6
+ STDERR.puts "- Project ID: #{id}"
7
+ STDERR.puts "- API Token: #{request.env['HTTP_X_TRACKERTOKEN']}"
8
+ STDERR.puts '<==========================================================================================>'
9
+ end
10
+
11
+ stories = [
12
+ {id: '123456', name: 'Story one'},
13
+ {id: '654321', name: 'Story two'}
14
+ ]
15
+
16
+ get '/projects/403/stories' do
17
+ status_message 403
18
+ 403
19
+ end
20
+
21
+ get '/projects/404/stories' do
22
+ status_message 404
23
+ 404
24
+ end
25
+
26
+ get '/projects/1234/stories' do
27
+ status_message 1234
28
+ stories.to_json
29
+ end
@@ -0,0 +1,127 @@
1
+ require 'spec_helper'
2
+ require 'open3'
3
+
4
+ include TrackerDeliveries
5
+
6
+ def capture_shell(command)
7
+ stdout, stderr, status = Open3.capture3 command
8
+ {stdout: stdout, stderr: stderr, status: status}
9
+ end
10
+
11
+ describe 'tracker_deliveries' do
12
+ describe 'runtime errors' do
13
+ let(:env) { '' }
14
+ let(:options) { '' }
15
+ let(:command) { "#{env} ruby -Ilib exe/tracker_deliveries #{options}" }
16
+
17
+ it 'aborts with an API_TOKEN error and usage notes when no mandatory options or usable environment is provided' do
18
+ expect(capture_shell(command)[:stdout]).to eq ''
19
+ expect(capture_shell(command)[:stderr]).to include Main::FATAL_MESSAGE_API_TOKEN
20
+ expect(capture_shell(command)[:stderr]).to include 'Tracker Deliveries'
21
+ expect(capture_shell(command)[:stderr]).to include 'Usage'
22
+ expect(capture_shell(command)[:stderr]).to include ''
23
+ end
24
+
25
+ context 'only api_token' do
26
+ context 'in environment' do
27
+ let(:env) { 'TRACKER_DELIVERIES_API_TOKEN=FAKE_TOKEN' }
28
+ it 'aborts with a PROJECT_ID error and usage notes when no mandatory options or usable environment is provided' do
29
+ expect(capture_shell(command)[:stdout]).to eq ''
30
+ expect(capture_shell(command)[:stderr]).to include Main::FATAL_MESSAGE_PROJECT_ID
31
+ expect(capture_shell(command)[:stderr]).to include 'Tracker Deliveries'
32
+ expect(capture_shell(command)[:stderr]).to include 'Usage'
33
+ expect(capture_shell(command)[:stderr]).to include ''
34
+ end
35
+ end
36
+
37
+ context 'in option switch' do
38
+ let(:options) { '--tracker:token=fake_token' }
39
+ it 'aborts with a PROJECT_ID error and usage notes when no mandatory options or usable environment is provided' do
40
+ expect(capture_shell(command)[:stdout]).to eq ''
41
+ expect(capture_shell(command)[:stderr]).to include Main::FATAL_MESSAGE_PROJECT_ID
42
+ expect(capture_shell(command)[:stderr]).to include 'Tracker Deliveries'
43
+ expect(capture_shell(command)[:stderr]).to include 'Usage'
44
+ expect(capture_shell(command)[:stderr]).to include ''
45
+ end
46
+ end
47
+ end
48
+
49
+ context 'only project_id' do
50
+ context 'in environment' do
51
+ let(:env) { 'TRACKER_DELIVERIES_PROJECT_ID=1234' }
52
+ it 'aborts with a PROJECT_ID error and usage notes when no mandatory options or usable environment is provided' do
53
+ expect(capture_shell(command)[:stdout]).to eq ''
54
+ expect(capture_shell(command)[:stderr]).to include Main::FATAL_MESSAGE_API_TOKEN
55
+ expect(capture_shell(command)[:stderr]).to include 'Tracker Deliveries'
56
+ expect(capture_shell(command)[:stderr]).to include 'Usage'
57
+ expect(capture_shell(command)[:stderr]).to include ''
58
+ end
59
+ end
60
+
61
+ context 'in option switch' do
62
+ context 'with =' do
63
+ let(:options) { '--tracker:project=1234' }
64
+ it 'aborts with a PROJECT_ID error and usage notes when no mandatory options or usable environment is provided' do
65
+ expect(capture_shell(command)[:stdout]).to eq ''
66
+ expect(capture_shell(command)[:stderr]).to include Main::FATAL_MESSAGE_API_TOKEN
67
+ expect(capture_shell(command)[:stderr]).to include 'Tracker Deliveries'
68
+ expect(capture_shell(command)[:stderr]).to include 'Usage'
69
+ expect(capture_shell(command)[:stderr]).to include ''
70
+ end
71
+ end
72
+
73
+ context 'with space' do
74
+ let(:options) { '--tracker:project 1234' }
75
+ it 'aborts with a PROJECT_ID error and usage notes when no mandatory options or usable environment is provided' do
76
+ expect(capture_shell(command)[:stdout]).to eq ''
77
+ expect(capture_shell(command)[:stderr]).to include Main::FATAL_MESSAGE_API_TOKEN
78
+ expect(capture_shell(command)[:stderr]).to include 'Tracker Deliveries'
79
+ expect(capture_shell(command)[:stderr]).to include 'Usage'
80
+ expect(capture_shell(command)[:stderr]).to include ''
81
+ end
82
+ end
83
+ end
84
+ end
85
+
86
+ context 'both api token and project id (testing against wiremock)' do
87
+ before :all do
88
+ ENV['TRACKER_DELIVERIES_DEBUG_API_URL'] = 'http://localhost:4567'
89
+ end
90
+
91
+ after :all do
92
+ ENV['TRACKER_DELIVERIES_DEBUG_API_URL'] = nil
93
+ end
94
+
95
+ context 'env' do
96
+ let(:env) { 'TRACKER_DELIVERIES_PROJECT_ID=1234 TRACKER_DELIVERIES_API_TOKEN=FAKE' }
97
+ it 'Connects to Pivotal Tracker with project and api token' do
98
+ expect((capture_shell(command)[:stderr]).chomp).to eq ''
99
+ expect((capture_shell(command)[:stdout]).chomp).to eq "123456 - Story one\n654321 - Story two"
100
+ end
101
+ end
102
+
103
+ context 'options' do
104
+ let(:options) { '--tracker:project=1234 --tracker:token=FAKE' }
105
+ it 'Connects to Pivotal Tracker with project and api token' do
106
+ expect((capture_shell(command)[:stderr]).chomp).to eq ''
107
+ expect((capture_shell(command)[:stdout]).chomp).to eq "123456 - Story one\n654321 - Story two"
108
+ end
109
+ end
110
+
111
+ context 'project not found' do
112
+ let(:options) { '--tracker:project=404 --tracker:token=FAKE' }
113
+ it 'Connects to Pivotal Tracker and passes back a 404 error' do
114
+ expect((capture_shell(command)[:stderr]).chomp).to eq 'PivotalTracker responded with: 404 (Not Found) project: 404, api_token: FAKE'
115
+ expect((capture_shell(command)[:stdout]).chomp).to eq ''
116
+ end
117
+ end
118
+ context 'no access to project' do
119
+ let(:options) { '--tracker:project=403 --tracker:token=FAKE' }
120
+ it 'Connects to Pivotal Tracker and passes back a 403 error' do
121
+ expect((capture_shell(command)[:stderr]).chomp).to eq 'PivotalTracker responded with: 403 (Forbidden) project: 403, api_token: FAKE'
122
+ expect((capture_shell(command)[:stdout]).chomp).to eq ''
123
+ end
124
+ end
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,11 @@
1
+ class TrackerDeliveries::Formatters::Html < TrackerDeliveries::Formatters::StoryFormat
2
+ def format s
3
+ link = %Q{<a href="#{story_url s}">#{s.id}</a>}
4
+ %Q{<li>#{link} - #{s.name}</li>}
5
+ end
6
+
7
+ def wrapper stories
8
+ formatted = super stories
9
+ %Q{<ul>\n#{formatted}\n</ul>}
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class TrackerDeliveries::Formatters::Markdown < TrackerDeliveries::Formatters::StoryFormat
2
+ def format s
3
+ link = %Q{[#{s.id}](#{story_url s})}
4
+ %Q{- #{link} - #{s.name}}
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class TrackerDeliveries::Formatters::Plaintext < TrackerDeliveries::Formatters::StoryFormat
2
+ def format story
3
+ %Q{#{story.id} - #{story.name}}
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module TrackerDeliveries
2
+ module Formatters
3
+ end
4
+ end
@@ -0,0 +1,19 @@
1
+ class TrackerDeliveries::Formatters::StoryFormat
2
+ def initialize base_url
3
+ @base_url = base_url
4
+ end
5
+
6
+ def story_url story
7
+ @base_url + story.id
8
+ end
9
+
10
+ def format story
11
+ raise Error 'Abstract method: not implemented'
12
+ end
13
+
14
+ def wrapper stories
15
+ stories
16
+ .map{|s| self.format s }
17
+ .join("\n")
18
+ end
19
+ end
@@ -2,35 +2,48 @@ require 'blanket'
2
2
 
3
3
  module TrackerDeliveries
4
4
  class PivotalTracker
5
- PIVOTAL_API_URL = 'https://www.pivotaltracker.com/services/v5/'
5
+ STORY_URL = 'https://pivotaltracker.com/story/show/'
6
+ API_URL='https://www.pivotaltracker.com/services/v5/'
6
7
 
7
8
  attr_accessor :api
8
9
 
9
- def initialize project_id, api_key, options = {}
10
- @api_key = api_key
11
- @project_id = project_id
12
- @format_tools = TrackerDeliveries::FormatTools.new options[:format] || :plaintext
13
- @api = Blanket.wrap PIVOTAL_API_URL,
14
- headers: { 'X-TrackerToken' => @api_key }
15
- end
10
+ def initialize options = {}
11
+ @api_token = options[:api_token]
12
+ @project_id = options[:project_id]
13
+ @api_url = options[:api] || API_URL
16
14
 
17
- def delivered_stories
18
- options = {with_state: "delivered"}
19
- wrap_output(api
20
- .projects(@project_id)
21
- .stories
22
- .get(params: options)
23
- .payload
24
- .map{|s| story_formatter s }
25
- .join("\n"))
26
- end
15
+ @formatter = StoryFormatter.new(
16
+ options[:format] || :plaintext,
17
+ STORY_URL
18
+ )
27
19
 
28
- def wrap_output output
29
- @format_tools.wrap_output output
20
+ @api = Blanket.wrap(
21
+ @api_url,
22
+ headers: {
23
+ 'X-TrackerToken' => @api_token
24
+ }
25
+ )
30
26
  end
31
27
 
32
- def story_formatter story
33
- @format_tools.story_formatter story
28
+ def delivered_stories
29
+ params = {
30
+ params:
31
+ {
32
+ with_state: "delivered"
33
+ }
34
+ }
35
+
36
+ begin
37
+ @formatter.format(
38
+ api
39
+ .projects(@project_id)
40
+ .stories.get(params).payload
41
+ )
42
+ rescue Blanket::Forbidden
43
+ STDERR.puts "PivotalTracker responded with: 403 (Forbidden) project: #{@project_id}, api_token: #{@api_token}"
44
+ rescue Blanket::ResourceNotFound
45
+ STDERR.puts "PivotalTracker responded with: 404 (Not Found) project: #{@project_id}, api_token: #{@api_token}"
46
+ end
34
47
  end
35
48
  end
36
49
  end
@@ -0,0 +1,18 @@
1
+ module TrackerDeliveries
2
+ class StoryFormatter
3
+ def initialize format, base_url
4
+ @formatter = get_formatter(format, base_url)
5
+ @format = format
6
+ end
7
+
8
+ def get_formatter(format, base_url)
9
+ TrackerDeliveries::Formatters
10
+ .const_get(format.capitalize)
11
+ .new(base_url)
12
+ end
13
+
14
+ def format stories
15
+ @formatter.wrapper(stories)
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module TrackerDeliveries
2
- VERSION = "0.1.9"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -1,24 +1,34 @@
1
1
  require 'tracker_deliveries/version'
2
2
  require 'tracker_deliveries/pivotal_tracker'
3
- require 'tracker_deliveries/format_tools'
3
+ require 'tracker_deliveries/story_formatter'
4
+ require 'tracker_deliveries/formatters/formatters'
5
+ require 'tracker_deliveries/formatters/story_format'
6
+ require 'tracker_deliveries/formatters/format/html'
7
+ require 'tracker_deliveries/formatters/format/markdown'
8
+ require 'tracker_deliveries/formatters/format/plaintext'
4
9
 
5
10
  module TrackerDeliveries
6
11
  class Main
7
- PROJECT_ID_ENV = 'TRACKER_DELIVERIES_PROJECT_ID'
8
12
  API_TOKEN_ENV = 'TRACKER_DELIVERIES_API_TOKEN'
13
+ PROJECT_ID_ENV = 'TRACKER_DELIVERIES_PROJECT_ID'
14
+ DEBUG_URL = 'TRACKER_DELIVERIES_DEBUG_API_URL'
9
15
 
10
- attr_accessor :project_id,
11
- :api_token,
12
- :pivotal_tracker
16
+ FATAL_MESSAGE_API_TOKEN = "Fatal: PivotalTracker API Token environment variable not set (#{API_TOKEN_ENV})"
17
+ FATAL_MESSAGE_PROJECT_ID = "Fatal: Project ID environment variable not set (#{PROJECT_ID_ENV})"
13
18
 
14
19
  def initialize(options = {})
15
- @project_id = ENV[PROJECT_ID_ENV]
16
- @api_token = ENV[API_TOKEN_ENV]
20
+ options.merge!({
21
+ api_token: ENV[API_TOKEN_ENV],
22
+ project_id: ENV[PROJECT_ID_ENV],
23
+ api: ENV[DEBUG_URL]
24
+ }) do |_, default, option|
25
+ default || option
26
+ end
17
27
 
18
- abort "Fatal: Project ID environment variable not set (#{PROJECT_ID_ENV})" unless @project_id
19
- abort "Fatal: PivotalTracker API Token environment variable not set (#{API_TOKEN_ENV})" unless @api_token
28
+ abort(FATAL_MESSAGE_API_TOKEN) unless options[:api_token]
29
+ abort(FATAL_MESSAGE_PROJECT_ID) unless options[:project_id]
20
30
 
21
- @pivotal_tracker = TrackerDeliveries::PivotalTracker.new(@project_id, @api_token, options)
31
+ @pivotal_tracker = TrackerDeliveries::PivotalTracker.new(options)
22
32
  end
23
33
 
24
34
  def delivered_stories
@@ -0,0 +1,39 @@
1
+ require 'tracker_deliveries'
2
+
3
+ class TrackerDeliveriesCommand
4
+ def initialize(tracker_deliveries = TrackerDeliveries::Main)
5
+ @tracker_deliveries = tracker_deliveries
6
+ end
7
+
8
+ def path_to_resources
9
+ File.join(File.dirname(File.expand_path(__FILE__)), '../')
10
+ end
11
+
12
+ def main args = nil
13
+ project_id = args.match(
14
+ /--tracker:project[= ] ?([0-9]*)/
15
+ )[1] rescue nil
16
+
17
+ api_token = args.match(
18
+ /--tracker:token[= ]?([^ ]*)/
19
+ )[1] rescue nil
20
+
21
+ format = args.match(
22
+ /--(format: *)?(markdown|html)/
23
+ )[2] rescue "plaintext" # default
24
+
25
+ begin
26
+ STDOUT.puts @tracker_deliveries
27
+ .new({format: format, project_id: project_id, api_token: api_token})
28
+ .delivered_stories
29
+ rescue SystemExit
30
+ readme = File.read File.join(path_to_resources, "README.md")
31
+
32
+ STDERR.puts "\nTracker Deliveries\n------------------\n\n",
33
+ readme
34
+ .match(/(Usage:\n.*?\n)\* \* \*/m)[1]
35
+ .delete('`')
36
+ .gsub(/\n{3,}/,"\n\n")
37
+ end
38
+ end
39
+ end
@@ -35,6 +35,5 @@ for continuous delivery.
35
35
  spec.add_development_dependency "rake", "~> 10.0"
36
36
  spec.add_development_dependency "rspec", "~> 3.0"
37
37
  spec.add_development_dependency "rspec_junit_formatter", "~> 0.3"
38
- spec.add_development_dependency "pry-byebug", "~> 3.5"
39
-
38
+ spec.add_development_dependency "sinatra", "~> 2.0"
40
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracker_deliveries
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Milkins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-03 00:00:00.000000000 Z
11
+ date: 2017-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blanket_wrapper
@@ -81,19 +81,19 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.3'
83
83
  - !ruby/object:Gem::Dependency
84
- name: pry-byebug
84
+ name: sinatra
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.5'
89
+ version: '2.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.5'
96
+ version: '2.0'
97
97
  description: "Tracker Deliveries\n\nGenerates a list of currently delivered tracker
98
98
  stories.\n\nMade to assist automatically generating release notes\nfor continuous
99
99
  delivery.\n "
@@ -115,10 +115,18 @@ files:
115
115
  - bin/console
116
116
  - bin/setup
117
117
  - exe/tracker_deliveries
118
+ - integration_spec/fake_pivotal_tracker.rb
119
+ - integration_spec/tracker_deliveries_integration_spec.rb
118
120
  - lib/tracker_deliveries.rb
119
- - lib/tracker_deliveries/format_tools.rb
121
+ - lib/tracker_deliveries/formatters/format/html.rb
122
+ - lib/tracker_deliveries/formatters/format/markdown.rb
123
+ - lib/tracker_deliveries/formatters/format/plaintext.rb
124
+ - lib/tracker_deliveries/formatters/formatters.rb
125
+ - lib/tracker_deliveries/formatters/story_format.rb
120
126
  - lib/tracker_deliveries/pivotal_tracker.rb
127
+ - lib/tracker_deliveries/story_formatter.rb
121
128
  - lib/tracker_deliveries/version.rb
129
+ - lib/tracker_deliveries_command.rb
122
130
  - tracker_deliveries.gemspec
123
131
  homepage: https://github.com/ocodo/tracker_deliveries
124
132
  licenses:
@@ -140,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
148
  version: '0'
141
149
  requirements: []
142
150
  rubyforge_project:
143
- rubygems_version: 2.5.1
151
+ rubygems_version: 2.6.11
144
152
  signing_key:
145
153
  specification_version: 4
146
154
  summary: Generate a plaintext summary of Pivotal Tracker delivered stories
@@ -1,36 +0,0 @@
1
- module TrackerDeliveries
2
- class FormatTools
3
- PIVOTAL_TRACKER_STORY_URL = 'https://pivotaltracker.com/story/show/'
4
-
5
- def initialize format
6
- @format = format
7
- end
8
-
9
- def pivotal_tracker_link s
10
- %Q{#{PIVOTAL_TRACKER_STORY_URL}#{s.id}}
11
- end
12
-
13
- def story_formatter s
14
- return send(@format, s)
15
- end
16
-
17
- def wrap_output output
18
- return %Q{<ul>\n#{output}\n</ul>} if @format == :html
19
- output
20
- end
21
-
22
- def plaintext s
23
- %Q{#{s.id} - #{s.name}}
24
- end
25
-
26
- def markdown s
27
- link = %Q{[#{s.id}](#{pivotal_tracker_link s})}
28
- %Q{- #{link} - #{s.name}}
29
- end
30
-
31
- def html s
32
- link = %Q{<a href="#{pivotal_tracker_link s}">#{s.id}</a>}
33
- %Q{<li>#{link} - #{s.name}</li>}
34
- end
35
- end
36
- end