pivotal_changelog 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/pivotal_changelog.rb +41 -0
  3. metadata +58 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d14a6a6df16f1ab503ca064b1809df96dbae55c6
4
+ data.tar.gz: c94d3ab017137d27da6d90e8a422aa314be033e7
5
+ SHA512:
6
+ metadata.gz: 74d4f1ba660588507f4481e8d6a33e27029814f66868483aa8af9d912cb8b6ee7124d7a69cf78408530005f29a3dc9b28792398d3d65fdebb2194f3b7399c928
7
+ data.tar.gz: 4bbb1328961199e25d2ec6446e23b548c71027cbf3b6d00cc3eeaf413424b155377ff582a8345833d208ea914c1906fb8555f449373b4d386b51e95684a5a9fe
@@ -0,0 +1,41 @@
1
+ require "tracker_api"
2
+
3
+ class PivotalChangelog
4
+ OUTPUT_FMT = " - %<name>s (https://www.pivotaltracker.com/story/show/%<id>s)\n"
5
+ STORY_TYPE_FMT = "**%<type>s**\n"
6
+
7
+ attr_reader :token, :project_id
8
+
9
+ def initialize(token, project_id)
10
+ @token = token
11
+ @project_id = project_id
12
+ end
13
+
14
+ def call
15
+ delivered_stories.each do |story_type, stories|
16
+ ioprint(story_type, stories)
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def client
23
+ @client ||= TrackerApi::Client.new(token: token)
24
+ end
25
+
26
+ def project
27
+ @project ||= client.project(project_id)
28
+ end
29
+
30
+ def ioprint(story_type, stories)
31
+ printf STORY_TYPE_FMT % { type: story_type }
32
+
33
+ stories.each do |st|
34
+ printf OUTPUT_FMT % { name: st.name, id: st.id }
35
+ end
36
+ end
37
+
38
+ def delivered_stories
39
+ project.stories(with_state: :delivered).group_by { |st| st.story_type }
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pivotal_changelog
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - DuyKhoa
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-05-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: ''
28
+ email: duykhoa12t@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/pivotal_changelog.rb
34
+ homepage: ''
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 2.5.1
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: ''
58
+ test_files: []