capistrano-changelog 0.3.0 → 0.4.0

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 (35) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +1 -1
  3. data/Gemfile +5 -4
  4. data/README.md +10 -5
  5. data/capistrano-changelog.gemspec +8 -9
  6. data/lib/capistrano-changelog.rb +16 -22
  7. data/lib/capistrano/changelog.rb +7 -0
  8. data/lib/capistrano/v2/hooks.rb +12 -0
  9. data/lib/capistrano/v2/recipes.rb +47 -0
  10. data/lib/capistrano/v3/tasks/changelog.rake +22 -0
  11. data/lib/changelog/git.rb +72 -0
  12. data/lib/changelog/history.rb +86 -0
  13. data/lib/changelog/release.rb +47 -0
  14. data/lib/changelog/stories_tracker.rb +39 -0
  15. data/lib/changelog/story.rb +29 -0
  16. data/lib/changelog/trackers/pivotal.rb +54 -0
  17. data/lib/{capistrano-changelog/release.rb → changelog/version.rb} +4 -3
  18. data/spec/lib/capistrano-changelog/git_spec.rb +117 -0
  19. data/spec/lib/capistrano-changelog/history_spec.rb +49 -0
  20. data/spec/lib/capistrano-changelog/release_spec.rb +65 -0
  21. data/spec/lib/capistrano-changelog/version_spec.rb +44 -0
  22. data/spec/spec_helper.rb +1 -1
  23. data/templates/changelog.erb +27 -11
  24. metadata +48 -74
  25. data/lib/capistrano-changelog/capistrno.rb +0 -15
  26. data/lib/capistrano-changelog/change_log.rb +0 -22
  27. data/lib/capistrano-changelog/git/lib.rb +0 -10
  28. data/lib/capistrano-changelog/git/tags_list.rb +0 -29
  29. data/lib/capistrano-changelog/pivotal/api.rb +0 -44
  30. data/lib/capistrano-changelog/pivotal/story.rb +0 -37
  31. data/lib/capistrano-changelog/version.rb +0 -3
  32. data/lib/capistrano-changelog/wrappers/changelog.rb +0 -21
  33. data/lib/capistrano-changelog/wrappers/release.rb +0 -35
  34. data/spec/lib/capistrano-changelog/wrappers/changelog_rspec.rb +0 -16
  35. data/spec/lib/capistrano-changelog/wrappers/release_spec.rb +0 -29
metadata CHANGED
@@ -1,128 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dmitry Larkin
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-07-18 00:00:00.000000000 Z
11
+ date: 2014-10-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
- name: git
42
+ name: oj
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
- version: 1.2.6
47
+ version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
- version: 1.2.6
54
+ version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: capistrano
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "<"
68
60
  - !ruby/object:Gem::Version
69
- version: '2.0'
61
+ version: '3.0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "<"
76
67
  - !ruby/object:Gem::Version
77
- version: '2.0'
68
+ version: '3.0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: faraday
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ~>
84
- - !ruby/object:Gem::Version
85
- version: '0.8'
86
- type: :runtime
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ~>
92
- - !ruby/object:Gem::Version
93
- version: '0.8'
94
- - !ruby/object:Gem::Dependency
95
- name: faraday_middleware
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
72
  requirements:
99
- - - ~>
73
+ - - "~>"
100
74
  - !ruby/object:Gem::Version
101
75
  version: '0.9'
102
76
  type: :runtime
103
77
  prerelease: false
104
78
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
79
  requirements:
107
- - - ~>
80
+ - - "~>"
108
81
  - !ruby/object:Gem::Version
109
82
  version: '0.9'
110
83
  - !ruby/object:Gem::Dependency
111
- name: capistrano
84
+ name: faraday-http-cache
112
85
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
86
  requirements:
115
- - - <
87
+ - - "~>"
116
88
  - !ruby/object:Gem::Version
117
- version: '3.0'
89
+ version: '0.4'
118
90
  type: :runtime
119
91
  prerelease: false
120
92
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
93
  requirements:
123
- - - <
94
+ - - "~>"
124
95
  - !ruby/object:Gem::Version
125
- version: '3.0'
96
+ version: '0.4'
126
97
  description: Uses git commits to recognize tracker stories and generates ChangeLog.
127
98
  email:
128
99
  - dmitry.larkin@gmail.com
@@ -130,57 +101,60 @@ executables: []
130
101
  extensions: []
131
102
  extra_rdoc_files: []
132
103
  files:
133
- - .gitignore
134
- - .rspec
104
+ - ".gitignore"
105
+ - ".rspec"
135
106
  - Gemfile
136
107
  - LICENSE.txt
137
108
  - README.md
138
109
  - Rakefile
139
110
  - capistrano-changelog.gemspec
140
111
  - lib/capistrano-changelog.rb
141
- - lib/capistrano-changelog/capistrno.rb
142
- - lib/capistrano-changelog/change_log.rb
143
- - lib/capistrano-changelog/git/lib.rb
144
- - lib/capistrano-changelog/git/tags_list.rb
145
- - lib/capistrano-changelog/pivotal/api.rb
146
- - lib/capistrano-changelog/pivotal/story.rb
147
- - lib/capistrano-changelog/release.rb
148
- - lib/capistrano-changelog/version.rb
149
- - lib/capistrano-changelog/wrappers/changelog.rb
150
- - lib/capistrano-changelog/wrappers/release.rb
151
- - spec/lib/capistrano-changelog/wrappers/changelog_rspec.rb
152
- - spec/lib/capistrano-changelog/wrappers/release_spec.rb
112
+ - lib/capistrano/changelog.rb
113
+ - lib/capistrano/v2/hooks.rb
114
+ - lib/capistrano/v2/recipes.rb
115
+ - lib/capistrano/v3/tasks/changelog.rake
116
+ - lib/changelog/git.rb
117
+ - lib/changelog/history.rb
118
+ - lib/changelog/release.rb
119
+ - lib/changelog/stories_tracker.rb
120
+ - lib/changelog/story.rb
121
+ - lib/changelog/trackers/pivotal.rb
122
+ - lib/changelog/version.rb
123
+ - spec/lib/capistrano-changelog/git_spec.rb
124
+ - spec/lib/capistrano-changelog/history_spec.rb
125
+ - spec/lib/capistrano-changelog/release_spec.rb
126
+ - spec/lib/capistrano-changelog/version_spec.rb
153
127
  - spec/lib/capistrano_changelog_spec.rb
154
128
  - spec/spec_helper.rb
155
129
  - templates/changelog.erb
156
130
  homepage: https://github.com/dml/capistrano-changelog
157
131
  licenses:
158
132
  - MIT
133
+ metadata: {}
159
134
  post_install_message:
160
135
  rdoc_options: []
161
136
  require_paths:
162
137
  - lib
163
138
  required_ruby_version: !ruby/object:Gem::Requirement
164
- none: false
165
139
  requirements:
166
- - - ! '>='
140
+ - - ">="
167
141
  - !ruby/object:Gem::Version
168
142
  version: '0'
169
143
  required_rubygems_version: !ruby/object:Gem::Requirement
170
- none: false
171
144
  requirements:
172
- - - ! '>='
145
+ - - ">="
173
146
  - !ruby/object:Gem::Version
174
147
  version: '0'
175
148
  requirements: []
176
149
  rubyforge_project:
177
- rubygems_version: 1.8.25
150
+ rubygems_version: 2.2.2
178
151
  signing_key:
179
- specification_version: 3
152
+ specification_version: 4
180
153
  summary: Uses git commits to recognize tracker stories and generates ChangeLog.
181
154
  test_files:
182
- - spec/lib/capistrano-changelog/wrappers/changelog_rspec.rb
183
- - spec/lib/capistrano-changelog/wrappers/release_spec.rb
155
+ - spec/lib/capistrano-changelog/git_spec.rb
156
+ - spec/lib/capistrano-changelog/history_spec.rb
157
+ - spec/lib/capistrano-changelog/release_spec.rb
158
+ - spec/lib/capistrano-changelog/version_spec.rb
184
159
  - spec/lib/capistrano_changelog_spec.rb
185
160
  - spec/spec_helper.rb
186
- has_rdoc:
@@ -1,15 +0,0 @@
1
- require 'capistrano-changelog'
2
-
3
- Capistrano::Configuration.instance(:must_exist).load do
4
- namespace :deploy do
5
- desc "Generates changelog"
6
- task :changelog do
7
- put CapistranoChangelog::ChangeLog.generate, "#{current_path}/public/changelog.html"
8
- end
9
-
10
- desc "Generates version file. RESTART=(true|false) option could be specified (by default is true)"
11
- task :version do
12
- put CapistranoChangelog::Release.generate, "#{release_path}/version.json"
13
- end
14
- end
15
- end
@@ -1,22 +0,0 @@
1
- require 'erb'
2
-
3
- module CapistranoChangelog
4
- class Controller
5
- def initialize
6
- @changelog = CapistranoChangelog::Wrappers::ChangeLog.new
7
- end
8
- def get_binding
9
- binding
10
- end
11
- end
12
-
13
- class ChangeLog
14
- def self.generate
15
- raise GeneralError, "You have to specify Pivotal token with export PIVOTAL_TOKEN=xyz" unless ENV.has_key?('PIVOTAL_TOKEN')
16
-
17
- controller = CapistranoChangelog::Controller.new
18
- template = ERB.new IO.read(File.join(CapistranoChangelog.templates, 'changelog.erb'))
19
- template.result(controller.get_binding)
20
- end
21
- end
22
- end
@@ -1,10 +0,0 @@
1
- module CapistranoChangelog::Git
2
- module Lib
3
- def ordered_tags
4
- command_lines("for-each-ref --sort='*authordate' --format='%(tag)' refs/tags")
5
- end
6
- def first_commit
7
- command("rev-list --max-parents=0 HEAD")
8
- end
9
- end
10
- end
@@ -1,29 +0,0 @@
1
- module CapistranoChangelog
2
- class TagList
3
- include Enumerable
4
-
5
- def initialize(git, since)
6
- @list = git.lib.ordered_tags + ['HEAD']
7
- @since = since
8
- @first_commit = git.lib.first_commit
9
- end
10
-
11
- def each(options = {})
12
- list_after_item = @list[@list.index(@since), @list.size]
13
-
14
- if block_given?
15
- list_after_item.reverse.each { |e| yield(e) }
16
- else
17
- Enumerator.new(list_after_item.reverse, :each)
18
- end
19
- end
20
-
21
- def next_to(name)
22
- @list[@list.index(name) + 1] || 'HEAD'
23
- end
24
-
25
- def prev_to(name)
26
- 0 < @list.index(name) && @list[@list.index(name) - 1] or @first_commit
27
- end
28
- end
29
- end
@@ -1,44 +0,0 @@
1
- require 'faraday'
2
- require 'faraday_middleware'
3
-
4
- module CapistranoChangelog
5
- module Pivotal
6
- class API
7
- class << self
8
- def connection
9
- @connection ||= Faraday.new 'https://www.pivotaltracker.com/services/v5' do |faraday|
10
- faraday.request :json
11
- faraday.response :json, :content_type => /\bjson$/
12
- faraday.adapter Faraday.default_adapter
13
- faraday.headers['X-TrackerToken'] = ENV['PIVOTAL_TOKEN']
14
- faraday.options[:timeout] = 30
15
- faraday.options[:open_timeout] = 30
16
- end
17
- end
18
-
19
- def get(uri)
20
- begin
21
- response = connection.get(uri)
22
-
23
- raise Pivotal::NetworkError unless response.status == 200
24
-
25
- response.body
26
- rescue Pivotal::NetworkError, Faraday::Error::TimeoutError => e
27
- {
28
- 'kind' => 'error',
29
- 'error' => 'Unable to fetch data'
30
- }
31
- end
32
- end
33
-
34
- def story(id)
35
- get("stories/#{id}")
36
- end
37
-
38
- def epic(id)
39
- get("epics/#{id}")
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,37 +0,0 @@
1
- require 'faraday'
2
-
3
- module CapistranoChangelog
4
- module Pivotal
5
- class Story
6
- attr_reader :num
7
-
8
- def initialize(story_id)
9
- @num = story_id
10
- @story = Pivotal::API.story(story_id)
11
- @labels = @story['labels'].map { |label| label['name'] } if @story['labels'].is_a?(Array)
12
- end
13
-
14
- def invalid?
15
- @story['kind'] == 'error'
16
- end
17
-
18
- def valid?
19
- !invalid?
20
- end
21
-
22
- def method_missing(meth)
23
- if @story.has_key?(meth.to_s)
24
- @story[meth.to_s]
25
- else
26
- super
27
- end
28
- end
29
-
30
- def self.get(id)
31
- return @stories[id] if defined?(@stories) and @stories[id]
32
- @stories ||= {}
33
- @stories[id] = new(id)
34
- end
35
- end
36
- end
37
- end
@@ -1,3 +0,0 @@
1
- module CapistranoChangelog
2
- VERSION = "0.3.0"
3
- end
@@ -1,21 +0,0 @@
1
- module CapistranoChangelog::Wrappers
2
- class ChangeLog
3
- attr_reader :git, :tags
4
-
5
- def initialize
6
- @git ||= ::Git.open(Dir.getwd)
7
- @start = ENV['PTLOG_SINCE'] || git.lib.ordered_tags.first
8
- @tags = CapistranoChangelog::TagList.new(@git, @start)
9
- end
10
-
11
- def date
12
- Time.new.utc.strftime('%I:%M%P %D UTC')
13
- end
14
-
15
- def releases
16
- @tags.map do |tag|
17
- CapistranoChangelog::Wrappers::Release.new(tag, self)
18
- end
19
- end
20
- end
21
- end
@@ -1,35 +0,0 @@
1
- module CapistranoChangelog::Wrappers
2
- class Release
3
- def initialize(tag, changelog)
4
- @tag = tag
5
- @initial_commit = changelog.tags.prev_to(tag)
6
- @git = changelog.git
7
- @commit = @git.gcommit(tag)
8
- end
9
-
10
- def title
11
- @tag
12
- end
13
-
14
- def date
15
- @commit.date.utc.strftime('%I:%M%P %D UTC')
16
- end
17
-
18
- def stories
19
- ids = @git.log.between(@initial_commit, @tag).map do |commit|
20
- commit.message.scan(/\#(\d+)/)
21
- end
22
- ids.flatten.uniq.map{ |num| CapistranoChangelog::Pivotal::Story.get(num) }
23
- end
24
-
25
- def commits(num)
26
- @git.log.between(@initial_commit, @tag).select do |commit|
27
- commit.message =~ (/\##{num}/)
28
- end
29
- end
30
-
31
- def get_binding
32
- binding
33
- end
34
- end
35
- end