gplan 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 54936e7bc0c10f14a2420e46cfebc0a747a35ae4
4
+ data.tar.gz: 3b0181f9399cd157c784d812e4142b54f847ee50
5
+ SHA512:
6
+ metadata.gz: a5b4d0438f6f371a318a538fc987084bca1a75303679eb0df24640070156d072f624b096573732c9fd368ffe032d73c4f9742ab53c48ff810d3b12d3f620e28d
7
+ data.tar.gz: d7dfb55f4f08731c256e4aa3b970ea7bb18c2f5a2abeac52767580ba8e2259da8ec71c9c000b045b0570e9c34726b89eb74598fdf367c3cbd07f510a8c48e542
data/README.md CHANGED
@@ -85,6 +85,10 @@ Note that this will include everything from the '##' to the next '##' or the end
85
85
 
86
86
  ## Tests
87
87
 
88
+ ### Setup
89
+
90
+ bundle
91
+
88
92
  To run tests:
89
93
 
90
94
  rake test
@@ -2,7 +2,7 @@ require 'printer'
2
2
  require 'github'
3
3
  require 'planbox'
4
4
 
5
- PB_STORY_REGEX=/\[(?:fixes)? *#*([0-9]*)\]/i
5
+ PB_STORY_REGEX=/\[ ?(?:fixes|done)? ?#([0-9]+) ?\]/i
6
6
  GH_PR_REGEX=/Merge pull request #(\d*)/i
7
7
 
8
8
  class Gplan
@@ -20,8 +20,8 @@ class Gplan
20
20
  setup_repository
21
21
  list= `git log #{@target}..`
22
22
 
23
- pb_story_ids = list.scan(PB_STORY_REGEX).flatten.uniq
24
- gh_pr_ids = list.scan(GH_PR_REGEX).flatten.uniq
23
+ pb_story_ids = get_ids(list, PB_STORY_REGEX)
24
+ gh_pr_ids = get_ids(list, GH_PR_REGEX)
25
25
 
26
26
  @gh_release_array = Github.new.get_release_notes_array gh_pr_ids
27
27
  @pb_release_array = Planbox.get_release_notes_array pb_story_ids
@@ -36,6 +36,10 @@ class Gplan
36
36
  end
37
37
  end
38
38
 
39
+ def get_ids list, regex
40
+ list.scan(regex).flatten.uniq
41
+ end
42
+
39
43
  def combine_results
40
44
  @pb_release_array.each do |pb_story|
41
45
  @gh_release_array.each do |gh_pr|
metadata CHANGED
@@ -1,64 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gplan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
5
- prerelease:
4
+ version: 0.1.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jeff Koenig
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-04-06 00:00:00.000000000 Z
11
+ date: 2015-05-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0.13'
22
20
  type: :runtime
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: '0.13'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: haml
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: 4.0.5
33
+ version: '4.0'
38
34
  type: :runtime
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
- version: 4.0.5
46
- - !ruby/object:Gem::Dependency
47
- name: rake
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: 10.4.2
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: 10.4.2
40
+ version: '4.0'
62
41
  description: Creates release notes from the git log and planbox
63
42
  email: jkoenig311@gmail.com
64
43
  executables:
@@ -67,43 +46,34 @@ extensions: []
67
46
  extra_rdoc_files: []
68
47
  files:
69
48
  - README.md
70
- - Rakefile
71
49
  - bin/gplan
72
50
  - bin/releasenotes.html
73
- - fixtures/vcr_cassettes/github_pull_requests.yml
74
- - gplan-0.1.4.gem
75
- - gplan.gemspec
76
51
  - lib/github.rb
77
52
  - lib/gplan.rb
78
53
  - lib/planbox.rb
79
54
  - lib/printer.rb
80
55
  - templates/template.html.haml
81
- - test/integration/release_notes_test.rb
82
- - test/test_helper.rb
83
- - test/unit/dependency_test.rb
84
56
  homepage: https://github.com/el-jefe-/gplan
85
57
  licenses: []
58
+ metadata: {}
86
59
  post_install_message:
87
60
  rdoc_options: []
88
61
  require_paths:
89
62
  - lib
90
63
  required_ruby_version: !ruby/object:Gem::Requirement
91
- none: false
92
64
  requirements:
93
- - - '>='
65
+ - - ">="
94
66
  - !ruby/object:Gem::Version
95
67
  version: '0'
96
68
  required_rubygems_version: !ruby/object:Gem::Requirement
97
- none: false
98
69
  requirements:
99
- - - '>='
70
+ - - ">="
100
71
  - !ruby/object:Gem::Version
101
72
  version: '0'
102
73
  requirements: []
103
74
  rubyforge_project:
104
- rubygems_version: 1.8.28
75
+ rubygems_version: 2.4.3
105
76
  signing_key:
106
- specification_version: 3
77
+ specification_version: 4
107
78
  summary: Creates release notes from the git log and planbox
108
79
  test_files: []
109
- has_rdoc:
data/Rakefile DELETED
@@ -1,12 +0,0 @@
1
- require "rake/testtask"
2
-
3
- Rake::TestTask.new do |t|
4
- t.libs << "test"
5
- t.test_files = FileList['test/**/*_test.rb']
6
- t.verbose = true
7
- # needed for VCR
8
- ENV['GITHUB_TOKEN'] = '123'
9
- ENV['GITHUB_USERNAME'] = 'test'
10
- end
11
-
12
- task :default => :test
@@ -1,161 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.github.com/repos/username/repo/issues/1?access_token=123
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - TheJefe
12
- Content-Type:
13
- - application/json
14
- Accept:
15
- - application/json
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - GitHub.com
23
- Date:
24
- - Sun, 05 Apr 2015 02:55:26 GMT
25
- Content-Type:
26
- - application/json; charset=utf-8
27
- Content-Length:
28
- - '2282'
29
- Status:
30
- - 200 OK
31
- X-Ratelimit-Limit:
32
- - '5000'
33
- X-Ratelimit-Remaining:
34
- - '4984'
35
- X-Ratelimit-Reset:
36
- - '1428204696'
37
- Cache-Control:
38
- - private, max-age=60, s-maxage=60
39
- Last-Modified:
40
- - Fri, 03 Apr 2015 19:40:47 GMT
41
- Etag:
42
- - '"a1ab6d6b8c492b97d573ff676b8a2d4a"'
43
- X-Oauth-Scopes:
44
- - gist, repo
45
- X-Accepted-Oauth-Scopes:
46
- - ''
47
- Vary:
48
- - Accept, Authorization, Cookie, X-GitHub-OTP
49
- - Accept-Encoding
50
- X-Github-Media-Type:
51
- - github.v3
52
- X-Xss-Protection:
53
- - 1; mode=block
54
- X-Frame-Options:
55
- - deny
56
- Content-Security-Policy:
57
- - default-src 'none'
58
- Access-Control-Allow-Credentials:
59
- - 'true'
60
- Access-Control-Expose-Headers:
61
- - ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
62
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
63
- Access-Control-Allow-Origin:
64
- - '*'
65
- X-Github-Request-Id:
66
- - 62EC2E61:6B93:43993F:5520A41E
67
- Strict-Transport-Security:
68
- - max-age=31536000; includeSubdomains; preload
69
- X-Content-Type-Options:
70
- - nosniff
71
- X-Served-By:
72
- - 7f48e2f7761567e923121f17538d7a6d
73
- body:
74
- encoding: UTF-8
75
- string: '{"url":"https://api.github.com/repos/username/repo/issues/1","labels_url":"https://api.github.com/repos/username/repo/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/username/repo/issues/1/comments","events_url":"https://api.github.com/repos/username/repo/issues/1/events","html_url":"https://github.com/username/repo/pull/1","id":66143574,"number":1,"title":"
76
- first pull request","user":{"login":"JohnSmith","id":1527103,"avatar_url":"https://avatars.githubusercontent.com/u/1527103?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnSmith","html_url":"https://github.com/JohnSmith","followers_url":"https://api.github.com/users/JohnSmith/followers","following_url":"https://api.github.com/users/JohnSmith/following{/other_user}","gists_url":"https://api.github.com/users/JohnSmith/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnSmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnSmith/subscriptions","organizations_url":"https://api.github.com/users/JohnSmith/orgs","repos_url":"https://api.github.com/users/JohnSmith/repos","events_url":"https://api.github.com/users/JohnSmith/events{/privacy}","received_events_url":"https://api.github.com/users/JohnSmith/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/username/repo/labels/Has%20Dependency","name":"Has
77
- Dependency","color":"207de5"},{"url":"https://api.github.com/repos/username/repo/labels/in%20progress","name":"in
78
- progress","color":"ededed"},{"url":"https://api.github.com/repos/username/repo/labels/WIP","name":"WIP","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-03T13:08:40Z","updated_at":"2015-04-03T13:08:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/username/repo/pulls/1","html_url":"https://github.com/username/repo/pull/1","diff_url":"https://github.com/username/repo/pull/1.diff","patch_url":"https://github.com/username/repo/pull/1.patch"},"body":"Depends
79
- on #2126 ","closed_by":null}'
80
- http_version:
81
- recorded_at: Sun, 05 Apr 2015 02:55:26 GMT
82
- - request:
83
- method: get
84
- uri: https://api.github.com/repos/username/repo/issues/2?access_token=123
85
- body:
86
- encoding: US-ASCII
87
- string: ''
88
- headers:
89
- User-Agent:
90
- - TheJefe
91
- Content-Type:
92
- - application/json
93
- Accept:
94
- - application/json
95
- response:
96
- status:
97
- code: 200
98
- message: OK
99
- headers:
100
- Server:
101
- - GitHub.com
102
- Date:
103
- - Sun, 05 Apr 2015 02:55:27 GMT
104
- Content-Type:
105
- - application/json; charset=utf-8
106
- Content-Length:
107
- - '2282'
108
- Status:
109
- - 200 OK
110
- X-Ratelimit-Limit:
111
- - '5000'
112
- X-Ratelimit-Remaining:
113
- - '4983'
114
- X-Ratelimit-Reset:
115
- - '1428204696'
116
- Cache-Control:
117
- - private, max-age=60, s-maxage=60
118
- Last-Modified:
119
- - Fri, 03 Apr 2015 19:40:47 GMT
120
- Etag:
121
- - '"a1ab6d6b8c492b97d573ff676b8a2d4a"'
122
- X-Oauth-Scopes:
123
- - gist, repo
124
- X-Accepted-Oauth-Scopes:
125
- - ''
126
- Vary:
127
- - Accept, Authorization, Cookie, X-GitHub-OTP
128
- - Accept-Encoding
129
- X-Github-Media-Type:
130
- - github.v3
131
- X-Xss-Protection:
132
- - 1; mode=block
133
- X-Frame-Options:
134
- - deny
135
- Content-Security-Policy:
136
- - default-src 'none'
137
- Access-Control-Allow-Credentials:
138
- - 'true'
139
- Access-Control-Expose-Headers:
140
- - ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
141
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
142
- Access-Control-Allow-Origin:
143
- - '*'
144
- X-Github-Request-Id:
145
- - 62EC2E61:6B93:4399A5:5520A41F
146
- Strict-Transport-Security:
147
- - max-age=31536000; includeSubdomains; preload
148
- X-Content-Type-Options:
149
- - nosniff
150
- X-Served-By:
151
- - 5aeb3f30c9e3ef6ef7bcbcddfd9a68f7
152
- body:
153
- encoding: UTF-8
154
- string: '{"url":"https://api.github.com/repos/username/repo/issues/2","labels_url":"https://api.github.com/repos/username/repo/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/username/repo/issues/2/comments","events_url":"https://api.github.com/repos/username/repo/issues/2/events","html_url":"https://github.com/username/repo/pull/2","id":66143574,"number":2,"title":"
155
- second pull request","user":{"login":"JohnSmith","id":1527103,"avatar_url":"https://avatars.githubusercontent.com/u/1527103?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnSmith","html_url":"https://github.com/JohnSmith","followers_url":"https://api.github.com/users/JohnSmith/followers","following_url":"https://api.github.com/users/JohnSmith/following{/other_user}","gists_url":"https://api.github.com/users/JohnSmith/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnSmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnSmith/subscriptions","organizations_url":"https://api.github.com/users/JohnSmith/orgs","repos_url":"https://api.github.com/users/JohnSmith/repos","events_url":"https://api.github.com/users/JohnSmith/events{/privacy}","received_events_url":"https://api.github.com/users/JohnSmith/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/username/repo/labels/Has%20Dependency","name":"Has
156
- Dependency","color":"207de5"},{"url":"https://api.github.com/repos/username/repo/labels/in%20progress","name":"in
157
- progress","color":"ededed"},{"url":"https://api.github.com/repos/username/repo/labels/WIP","name":"WIP","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-03T13:08:40Z","updated_at":"2015-04-03T13:08:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/username/repo/pulls/2","html_url":"https://github.com/username/repo/pull/2","diff_url":"https://github.com/username/repo/pull/2.diff","patch_url":"https://github.com/username/repo/pull/2.patch"},"body":"## Depends
158
- on #2126 ","closed_by":null}'
159
- http_version:
160
- recorded_at: Sun, 05 Apr 2015 02:55:26 GMT
161
- recorded_with: VCR 2.9.3
@@ -1,19 +0,0 @@
1
- lib = File.expand_path('../lib/', __FILE__)
2
- $:.unshift lib unless $:.include?(lib)
3
-
4
- Gem::Specification.new do |s|
5
- s.name = 'gplan'
6
- s.version = '0.1.4'
7
- s.date = '2015-04-06'
8
- s.authors = ["Jeff Koenig"]
9
- s.email = 'jkoenig311@gmail.com'
10
- s.homepage = 'https://github.com/el-jefe-/gplan'
11
- s.summary = "Creates release notes from the git log and planbox"
12
- s.description = "Creates release notes from the git log and planbox"
13
- s.executables = ["gplan"]
14
- s.files = `git ls-files`.split($\)
15
- s.require_paths = ['lib']
16
- s.add_runtime_dependency('httparty', "~> 0.13")
17
- s.add_runtime_dependency('haml', "~> 4.0.5")
18
- s.add_runtime_dependency('rake',"~> 10.4.2")
19
- end
@@ -1,43 +0,0 @@
1
- require 'test_helper'
2
- require 'pry'
3
-
4
- class ReleaseNotesTest < UnitTest
5
- describe 'release notes' do
6
-
7
- before do
8
- github = Github.new
9
- @stories = []
10
- VCR.use_cassette("github_pull_requests") do
11
- @stories = github.get_release_notes_array [1,2]
12
- end
13
- end
14
-
15
- it 'can be printed to stdout' do
16
- old_stdout = $stdout
17
- $stdout = StringIO.new
18
- Printer.new.print @stories
19
- output = $stdout.string.split("\n")
20
- $stdout = old_stdout
21
- output.count.must_equal 12
22
- output.last.must_equal "PR #2: Depends on #2126 "
23
- end
24
-
25
- it 'can be printed to an html file' do
26
- output = Printer.new.html @stories
27
- output.first.must_equal "<h2>Release notes</h2>"
28
- output.count.must_equal 55
29
- assert output.to_s.include? "Depends on #2126"
30
- end
31
- end
32
-
33
- # Stubs to fake up repos and outputs
34
- class Github < Github
35
- def get_repo_name
36
- 'username/repo'
37
- end
38
- end
39
-
40
- def File.write file, release_notes
41
- return release_notes.split("\n")
42
- end
43
- end
@@ -1,15 +0,0 @@
1
- gem 'minitest'
2
- gem 'vcr'
3
-
4
- require 'minitest/autorun'
5
- require 'gplan'
6
- require 'printer'
7
- require 'vcr'
8
-
9
- VCR.configure do |config|
10
- config.cassette_library_dir = "fixtures/vcr_cassettes"
11
- config.hook_into :webmock # or :fakeweb
12
- end
13
-
14
- class UnitTest < MiniTest::Test
15
- end
@@ -1,94 +0,0 @@
1
- require 'test_helper'
2
-
3
- class DependencyTest < UnitTest
4
- describe 'dependencies' do
5
-
6
- describe 'show blocks' do
7
-
8
- match_words = %w(
9
- depends
10
- dependent
11
- dependency
12
- dependencies
13
- dependencys
14
- )
15
-
16
- match_words.each do |word|
17
- it 'starting with the word #{word}' do
18
- dependency = "#{word}\n"+
19
- "This is a dependency"
20
- story = stub_story_with_block dependency
21
- Printer.new.get_dependency(story).must_equal dependency
22
- end
23
- end
24
-
25
- it 'starting with the word dependent' do
26
- dependency = "Dependent on\n"+
27
- "This is a dependency"
28
- story = stub_story_with_block dependency
29
- Printer.new.get_dependency(story).must_equal dependency
30
- end
31
-
32
- it 'starting with spaces then the word dependent' do
33
- dependency = " Dependent on\n"+
34
- "This is a dependency"
35
- story = stub_story_with_block dependency
36
- Printer.new.get_dependency(story).must_equal dependency
37
- end
38
-
39
- it 'with hashes and spaces at the beginning' do
40
- dependency = "## Dependency\n"+
41
- "This is a dependency"
42
- story = stub_story_with_block dependency
43
- Printer.new.get_dependency(story).must_equal dependency
44
- end
45
-
46
- it 'starting with depends on' do
47
- dependency = 'Depends on #123'
48
- body = "This is a PR about things and dependencies\n#{dependency}\nmoar stuff"
49
- story = {'body' => body}
50
- Printer.new.get_dependency(story).must_equal dependency
51
- end
52
- end
53
-
54
- describe 'dont show blocks' do
55
- it 'when dependent is not the first word' do
56
- dependency = "not Dependent\n"+
57
- "This is NOT a dependency"
58
- story = stub_story_with_block dependency
59
- Printer.new.get_dependency(story).must_equal nil
60
- end
61
-
62
- it 'when depends is on another line of a block' do
63
- dependency = "## To QA:\n"+
64
- "depends on suff"
65
- story = stub_story_with_block dependency
66
- Printer.new.get_dependency(story).must_equal nil
67
- end
68
- end
69
-
70
- describe 'dependency flag' do
71
-
72
- it 'shown when no block is found' do
73
- label = 'Has Dependency'
74
- story = {
75
- 'labels' => [ label ]
76
- }
77
- Printer.new.get_dependency(story).must_equal "has a dependency label"
78
- end
79
-
80
- it 'not shown when a block is found' do
81
- dependency = "Dependency\n"+
82
- "This is a dependency"
83
- label = 'Has Dependency'
84
- story = stub_story_with_block dependency
85
- story['labels'] = [ label ]
86
- Printer.new.get_dependency(story).must_equal dependency
87
- end
88
- end
89
-
90
- def stub_story_with_block dependency
91
- {'blocks' => [ dependency ]}
92
- end
93
- end
94
- end