pgit 0.0.4 → 1.0.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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/.agignore +3 -0
  3. data/.travis.yml +1 -0
  4. data/README.markdown +32 -9
  5. data/Rakefile +12 -0
  6. data/bin/pgit +167 -25
  7. data/lib/pgit.rb +40 -10
  8. data/lib/pgit/bilateral/handle_back.rb +22 -0
  9. data/lib/pgit/bilateral/handle_choose_story.rb +31 -0
  10. data/lib/pgit/bilateral/story.rb +44 -0
  11. data/lib/pgit/command.rb +83 -0
  12. data/lib/pgit/command/add.rb +36 -0
  13. data/lib/pgit/command/application.rb +21 -0
  14. data/lib/pgit/command/edit.rb +36 -0
  15. data/lib/pgit/command/remove.rb +36 -0
  16. data/lib/pgit/command/run.rb +32 -0
  17. data/lib/pgit/command/show.rb +53 -0
  18. data/lib/pgit/configuration.rb +27 -3
  19. data/lib/pgit/current_project.rb +9 -45
  20. data/lib/pgit/current_project/validator.rb +2 -1
  21. data/lib/pgit/error/external.rb +11 -0
  22. data/lib/pgit/error/user.rb +12 -0
  23. data/lib/pgit/helpers/heredoc.rb +17 -0
  24. data/lib/pgit/helpers/query_methods.rb +63 -0
  25. data/lib/pgit/helpers/string_extensions.rb +29 -0
  26. data/lib/pgit/installer/bash_auto_completion.rb +57 -0
  27. data/lib/pgit/pivotal/collection_request.rb +21 -0
  28. data/lib/pgit/pivotal/individual_request.rb +47 -0
  29. data/lib/pgit/pivotal/iteration.rb +6 -0
  30. data/lib/pgit/pivotal/iterations.rb +15 -0
  31. data/lib/pgit/pivotal/project.rb +6 -0
  32. data/lib/pgit/pivotal/projects.rb +20 -0
  33. data/lib/pgit/pivotal/query.rb +8 -0
  34. data/lib/pgit/pivotal/request.rb +33 -0
  35. data/lib/pgit/pivotal/request/query.rb +25 -0
  36. data/lib/pgit/pivotal/story.rb +38 -0
  37. data/lib/pgit/pivotal_request_validator.rb +1 -1
  38. data/lib/pgit/project.rb +78 -0
  39. data/lib/pgit/project/add.rb +28 -0
  40. data/lib/pgit/project/application.rb +21 -0
  41. data/lib/pgit/project/interactive_adder.rb +41 -0
  42. data/lib/pgit/project/remove.rb +41 -0
  43. data/lib/pgit/project/reuse_api_token_adder.rb +48 -0
  44. data/lib/pgit/response_handler.rb +16 -0
  45. data/lib/pgit/root.rb +5 -0
  46. data/lib/pgit/status.rb +16 -0
  47. data/lib/pgit/story_branch/application.rb +3 -3
  48. data/lib/pgit/{name_parser.rb → story_branch/name_parser.rb} +0 -0
  49. data/lib/pgit/story_branch/story_id_parser.rb +11 -0
  50. data/lib/pgit/validators/project_validator.rb +20 -0
  51. data/lib/pgit/version.rb +1 -1
  52. data/lib/pivotal +0 -0
  53. data/pgit.gemspec +5 -0
  54. data/spec/fixtures/iterations +1 -0
  55. data/spec/pgit/bilateral/handle_back_spec.rb +29 -0
  56. data/spec/pgit/bilateral/handle_choose_story_spec.rb +17 -0
  57. data/spec/pgit/bilateral/story_spec.rb +178 -0
  58. data/spec/pgit/command/add_spec.rb +68 -0
  59. data/spec/pgit/command/application_spec.rb +110 -0
  60. data/spec/pgit/command/edit_spec.rb +61 -0
  61. data/spec/pgit/command/remove_spec.rb +76 -0
  62. data/spec/pgit/command/run_spec.rb +49 -0
  63. data/spec/pgit/command/show_spec.rb +95 -0
  64. data/spec/pgit/command_spec.rb +299 -0
  65. data/spec/pgit/configuration_spec.rb +121 -18
  66. data/spec/pgit/current_project/validator_spec.rb +2 -1
  67. data/spec/pgit/current_project_spec.rb +20 -71
  68. data/spec/pgit/{external_error_spec.rb → error/external_spec.rb} +3 -3
  69. data/spec/pgit/error/user_spec.rb +17 -0
  70. data/spec/pgit/helpers/heredoc_spec.rb +33 -0
  71. data/spec/pgit/helpers/query_methods_spec.rb +24 -0
  72. data/spec/pgit/helpers/string_extensions_spec.rb +49 -0
  73. data/spec/pgit/installer/bash_auto_completion_spec.rb +134 -0
  74. data/spec/pgit/pivotal/individual_request_spec.rb +32 -0
  75. data/spec/pgit/pivotal/iteration_spec.rb +19 -0
  76. data/spec/pgit/pivotal/iterations_spec.rb +37 -0
  77. data/spec/pgit/pivotal/project_spec.rb +9 -0
  78. data/spec/pgit/pivotal/projects_spec.rb +48 -0
  79. data/spec/pgit/pivotal/request/query_spec.rb +24 -0
  80. data/spec/pgit/pivotal/story_spec.rb +113 -0
  81. data/spec/pgit/pivotal_request_validator_spec.rb +3 -3
  82. data/spec/pgit/project/add_spec.rb +52 -0
  83. data/spec/pgit/project/application_spec.rb +69 -0
  84. data/spec/pgit/project/interactive_adder_spec.rb +45 -0
  85. data/spec/pgit/project/remove_spec.rb +86 -0
  86. data/spec/pgit/project/reuse_api_token_adder_spec.rb +41 -0
  87. data/spec/pgit/project_spec.rb +513 -0
  88. data/spec/pgit/status_spec.rb +40 -0
  89. data/spec/pgit/story_branch/application_spec.rb +5 -8
  90. data/spec/pgit/story_branch/name_parser_spec.rb +3 -3
  91. data/spec/pgit/story_branch/story_id_parser_spec.rb +17 -0
  92. data/spec/pgit/validators/project_validator_spec.rb +39 -0
  93. metadata +146 -21
  94. data/lib/pgit/configuration/layout_error.rb +0 -9
  95. data/lib/pgit/configuration/missing_attributes_error.rb +0 -10
  96. data/lib/pgit/configuration/not_found_error.rb +0 -10
  97. data/lib/pgit/configuration/project_missing_error.rb +0 -10
  98. data/lib/pgit/configuration/validator.rb +0 -41
  99. data/lib/pgit/current_project/no_paths_match_working_dir_error.rb +0 -10
  100. data/lib/pgit/external_error.rb +0 -9
  101. data/lib/pgit/installer/configuration.rb +0 -34
  102. data/lib/pgit/story.rb +0 -44
  103. data/spec/pgit/configuration/missing_attributes_error_spec.rb +0 -30
  104. data/spec/pgit/configuration/not_found_error_spec.rb +0 -17
  105. data/spec/pgit/configuration/project_missing_error_spec.rb +0 -30
  106. data/spec/pgit/configuration/validator_spec.rb +0 -79
  107. data/spec/pgit/current_project/no_paths_match_working_dir_error_spec.rb +0 -17
  108. data/spec/pgit/installer/configuration_spec.rb +0 -162
  109. data/spec/pgit/story_spec.rb +0 -35
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe PGit::Status do
4
+ describe 'when there is no associated story' do
5
+ it 'should raise an error' do
6
+ story_id = nil
7
+ options = double('options')
8
+ global_options = double('global_options')
9
+ args = double('args')
10
+ current_branch = instance_double('PGit::CurrentBranch', story_id: story_id)
11
+ allow(PGit::CurrentBranch).to receive(:new).and_return(current_branch)
12
+ status = PGit::Status.new(global_options, options, args)
13
+
14
+ expect{status.execute!}.to raise_error(PGit::Error::User, 'The current branch is not associated with a story. Does not have a story id.')
15
+ end
16
+ end
17
+
18
+ describe 'when there is an associated story' do
19
+ it 'should puts info about the story' do
20
+ story_id = 12345
21
+ options = double('options')
22
+ global_options = double('global_options')
23
+ args = double('args')
24
+ current_branch = instance_double('PGit::CurrentBranch', story_id: story_id)
25
+ allow(PGit::CurrentBranch).to receive(:new).and_return(current_branch)
26
+ story_hash = {'kind' => 'story'}
27
+ story = double('PGit::Story', get!: story_hash)
28
+ allow(PGit::Pivotal::Story).to receive(:new).with(current_branch.story_id).and_return(story)
29
+ table = double('table')
30
+ allow(table).to receive(:rows=).with(story_hash.to_a)
31
+ allow(Terminal::Table).to receive(:new).and_yield(table).and_return(table)
32
+ status = PGit::Status.new(global_options, options, args)
33
+ allow(status).to receive(:puts).with(table)
34
+
35
+ status.execute!
36
+ expect(table).to have_received(:rows=).with(story_hash.to_a)
37
+ expect(status).to have_received(:puts).with(table)
38
+ end
39
+ end
40
+ end
@@ -9,19 +9,16 @@ describe 'PGit::StoryBranch::Application' do
9
9
  opts = { start: 1234 }
10
10
  args = {}
11
11
  fake_story_branch = instance_double('PGit::StoryBranch')
12
- fake_config_yaml = double('config_yaml')
13
- fake_configuration = instance_double('PGit::Configuration', to_yaml: fake_config_yaml)
12
+ fake_configuration = instance_double('PGit::Configuration')
14
13
  allow(fake_story_branch).to receive(:start)
15
- fake_get_request_results = double('json_response')
16
14
  fake_story_id = double('fake_story_id')
17
15
 
18
- fake_story = double('PGit::Story', id: fake_story_id)
19
- fake_story_class = class_double('PGit::Story', get: fake_get_request_results)
20
- fake_current_project = double('current_project')
16
+ fake_story = double('PGit::Pivotal::Story', id: fake_story_id, get!: fake_story)
17
+ fake_current_project = double('current_project', id: 1, api_token: 'someapitoken')
21
18
  fake_name_parser = instance_double(PGit::StoryBranch::NameParser)
22
- allow(PGit::CurrentProject).to receive(:new).with(fake_config_yaml).and_return(fake_current_project)
19
+ allow(PGit::CurrentProject).to receive(:new).with(fake_configuration).and_return(fake_current_project)
23
20
  allow(PGit::StoryBranch::NameParser).to receive(:new).with(fake_story).and_return(fake_name_parser)
24
- allow(PGit::Story).to receive(:get).with(1234, fake_current_project).and_return(fake_story)
21
+ allow(PGit::Pivotal::Story).to receive(:new).with(1234).and_return(fake_story)
25
22
  allow(PGit::StoryBranch).to receive(:new).with(fake_name_parser).and_return(fake_story_branch)
26
23
  allow(PGit::Configuration).to receive(:new).and_return(fake_configuration)
27
24
 
@@ -7,7 +7,7 @@ describe 'PGit::StoryBranch::NameParser' do
7
7
 
8
8
  unparsed_name = "Deemphasize the Clue on the stimulus screen of multi-screen exercises."
9
9
  story_id = '12345'
10
- fake_story = double('PGit::Story', id: story_id, name: unparsed_name)
10
+ fake_story = double('PGit::Pivotal::Story', id: story_id, name: unparsed_name)
11
11
 
12
12
  name_parser = PGit::StoryBranch::NameParser.new(fake_story)
13
13
  parsed = name_parser.name
@@ -19,7 +19,7 @@ describe 'PGit::StoryBranch::NameParser' do
19
19
  unparsed_name = "Some don't like putin's dictatorship"
20
20
  story_id = '29292'
21
21
 
22
- fake_story = double('PGit::Story', id: story_id, name: unparsed_name)
22
+ fake_story = double('PGit::Pivotal::Story', id: story_id, name: unparsed_name)
23
23
 
24
24
  name_parser = PGit::StoryBranch::NameParser.new(fake_story)
25
25
  parsed = name_parser.name
@@ -31,7 +31,7 @@ describe 'PGit::StoryBranch::NameParser' do
31
31
  unparsed_name = "Some *@# don't like ,putin's dictator-ship"
32
32
  story_id = '29292'
33
33
 
34
- fake_story = double('PGit::Story', id: story_id, name: unparsed_name)
34
+ fake_story = double('PGit::Pivotal::Story', id: story_id, name: unparsed_name)
35
35
 
36
36
  name_parser = PGit::StoryBranch::NameParser.new(fake_story)
37
37
  parsed = name_parser.name
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe PGit::StoryBranch::StoryIdParser do
4
+ describe 'if it exists' do
5
+ it 'parse should give us the id' do
6
+ parser = PGit::StoryBranch::StoryIdParser.new("pgit-status-shows-information-about-current-story-if-there-is-one-97997060")
7
+ expect(parser.parse).to eq "97997060"
8
+ end
9
+ end
10
+
11
+ describe 'if does not exist' do
12
+ it 'should raise an error' do
13
+ parser = PGit::StoryBranch::StoryIdParser.new("pgit-status-shows-information-about-current-story-if-there-is-one")
14
+ expect{parser.parse}.to raise_error(PGit::Error::User, 'The current branch is not associated with a story. Does not have a story id.')
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,39 @@
1
+ require 'pgit'
2
+
3
+ describe 'PGit::Validators::ProjectValidator' do
4
+ describe '#valid?' do
5
+ it 'should not be valid when the request for stories fails' do
6
+ class SomeFakeProjectWithKindError
7
+ include ActiveModel::Validations
8
+ validates_with PGit::Validators::ProjectValidator
9
+ def get!
10
+ end
11
+
12
+ def kind
13
+ 'error'
14
+ end
15
+ end
16
+ project = SomeFakeProjectWithKindError.new
17
+ validator = PGit::Validators::ProjectValidator.new
18
+ validator.validate(project)
19
+
20
+ expect(project).not_to be_valid
21
+ end
22
+
23
+ it 'should not be valid if the project does not have a kind' do
24
+ class SomeFakeProjectWithNoKind
25
+ include ActiveModel::Validations
26
+ validates_with PGit::Validators::ProjectValidator
27
+
28
+ def get!
29
+ end
30
+ end
31
+
32
+ project = SomeFakeProjectWithNoKind.new
33
+ validator = PGit::Validators::ProjectValidator.new
34
+ validator.validate(project)
35
+
36
+ expect(project).not_to be_valid
37
+ end
38
+ end
39
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edderic Ugaddan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-18 00:00:00.000000000 Z
11
+ date: 2015-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.0.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.0.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.5.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 3.5.1
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: gli
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +108,48 @@ dependencies:
80
108
  - - '='
81
109
  - !ruby/object:Gem::Version
82
110
  version: 2.12.2
111
+ - !ruby/object:Gem::Dependency
112
+ name: activemodel
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 4.2.0
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 4.2.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rainbow
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 2.0.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 2.0.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: interactive
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.6.0
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.6.0
83
153
  description:
84
154
  email: edderic@gmail.com
85
155
  executables:
@@ -88,6 +158,7 @@ extensions: []
88
158
  extra_rdoc_files:
89
159
  - README.markdown
90
160
  files:
161
+ - ".agignore"
91
162
  - ".coveralls.yml"
92
163
  - ".gitignore"
93
164
  - ".rspec"
@@ -98,47 +169,101 @@ files:
98
169
  - Rakefile
99
170
  - bin/pgit
100
171
  - lib/pgit.rb
172
+ - lib/pgit/bilateral/handle_back.rb
173
+ - lib/pgit/bilateral/handle_choose_story.rb
174
+ - lib/pgit/bilateral/story.rb
175
+ - lib/pgit/command.rb
176
+ - lib/pgit/command/add.rb
177
+ - lib/pgit/command/application.rb
178
+ - lib/pgit/command/edit.rb
179
+ - lib/pgit/command/remove.rb
180
+ - lib/pgit/command/run.rb
181
+ - lib/pgit/command/show.rb
101
182
  - lib/pgit/configuration.rb
102
- - lib/pgit/configuration/layout_error.rb
103
- - lib/pgit/configuration/missing_attributes_error.rb
104
- - lib/pgit/configuration/not_found_error.rb
105
- - lib/pgit/configuration/project_missing_error.rb
106
- - lib/pgit/configuration/validator.rb
107
183
  - lib/pgit/current_branch.rb
108
184
  - lib/pgit/current_project.rb
109
- - lib/pgit/current_project/no_paths_match_working_dir_error.rb
110
185
  - lib/pgit/current_project/validator.rb
111
186
  - lib/pgit/error.rb
112
- - lib/pgit/external_error.rb
113
- - lib/pgit/installer/configuration.rb
114
- - lib/pgit/name_parser.rb
187
+ - lib/pgit/error/external.rb
188
+ - lib/pgit/error/user.rb
189
+ - lib/pgit/helpers/heredoc.rb
190
+ - lib/pgit/helpers/query_methods.rb
191
+ - lib/pgit/helpers/string_extensions.rb
192
+ - lib/pgit/installer/bash_auto_completion.rb
193
+ - lib/pgit/pivotal/collection_request.rb
194
+ - lib/pgit/pivotal/individual_request.rb
195
+ - lib/pgit/pivotal/iteration.rb
196
+ - lib/pgit/pivotal/iterations.rb
197
+ - lib/pgit/pivotal/project.rb
198
+ - lib/pgit/pivotal/projects.rb
199
+ - lib/pgit/pivotal/query.rb
200
+ - lib/pgit/pivotal/request.rb
201
+ - lib/pgit/pivotal/request/query.rb
202
+ - lib/pgit/pivotal/story.rb
115
203
  - lib/pgit/pivotal_request_validator.rb
116
- - lib/pgit/story.rb
204
+ - lib/pgit/project.rb
205
+ - lib/pgit/project/add.rb
206
+ - lib/pgit/project/application.rb
207
+ - lib/pgit/project/interactive_adder.rb
208
+ - lib/pgit/project/remove.rb
209
+ - lib/pgit/project/reuse_api_token_adder.rb
210
+ - lib/pgit/response_handler.rb
211
+ - lib/pgit/root.rb
212
+ - lib/pgit/status.rb
117
213
  - lib/pgit/story_branch.rb
118
214
  - lib/pgit/story_branch/application.rb
215
+ - lib/pgit/story_branch/name_parser.rb
216
+ - lib/pgit/story_branch/story_id_parser.rb
217
+ - lib/pgit/validators/project_validator.rb
119
218
  - lib/pgit/version.rb
219
+ - lib/pivotal
120
220
  - man/pgit.1
121
221
  - man/pgit.1.html
122
222
  - man/pgit.1.ronn
123
223
  - pgit.gemspec
124
224
  - pgit.rdoc
125
- - spec/pgit/configuration/missing_attributes_error_spec.rb
126
- - spec/pgit/configuration/not_found_error_spec.rb
127
- - spec/pgit/configuration/project_missing_error_spec.rb
128
- - spec/pgit/configuration/validator_spec.rb
225
+ - spec/fixtures/iterations
226
+ - spec/pgit/bilateral/handle_back_spec.rb
227
+ - spec/pgit/bilateral/handle_choose_story_spec.rb
228
+ - spec/pgit/bilateral/story_spec.rb
229
+ - spec/pgit/command/add_spec.rb
230
+ - spec/pgit/command/application_spec.rb
231
+ - spec/pgit/command/edit_spec.rb
232
+ - spec/pgit/command/remove_spec.rb
233
+ - spec/pgit/command/run_spec.rb
234
+ - spec/pgit/command/show_spec.rb
235
+ - spec/pgit/command_spec.rb
129
236
  - spec/pgit/configuration_spec.rb
130
237
  - spec/pgit/current_branch_spec.rb
131
- - spec/pgit/current_project/no_paths_match_working_dir_error_spec.rb
132
238
  - spec/pgit/current_project/validator_spec.rb
133
239
  - spec/pgit/current_project_spec.rb
134
- - spec/pgit/external_error_spec.rb
135
- - spec/pgit/installer/configuration_spec.rb
240
+ - spec/pgit/error/external_spec.rb
241
+ - spec/pgit/error/user_spec.rb
242
+ - spec/pgit/helpers/heredoc_spec.rb
243
+ - spec/pgit/helpers/query_methods_spec.rb
244
+ - spec/pgit/helpers/string_extensions_spec.rb
245
+ - spec/pgit/installer/bash_auto_completion_spec.rb
136
246
  - spec/pgit/pgit_spec.rb
247
+ - spec/pgit/pivotal/individual_request_spec.rb
248
+ - spec/pgit/pivotal/iteration_spec.rb
249
+ - spec/pgit/pivotal/iterations_spec.rb
250
+ - spec/pgit/pivotal/project_spec.rb
251
+ - spec/pgit/pivotal/projects_spec.rb
252
+ - spec/pgit/pivotal/request/query_spec.rb
253
+ - spec/pgit/pivotal/story_spec.rb
137
254
  - spec/pgit/pivotal_request_validator_spec.rb
255
+ - spec/pgit/project/add_spec.rb
256
+ - spec/pgit/project/application_spec.rb
257
+ - spec/pgit/project/interactive_adder_spec.rb
258
+ - spec/pgit/project/remove_spec.rb
259
+ - spec/pgit/project/reuse_api_token_adder_spec.rb
260
+ - spec/pgit/project_spec.rb
261
+ - spec/pgit/status_spec.rb
138
262
  - spec/pgit/story_branch/application_spec.rb
139
263
  - spec/pgit/story_branch/name_parser_spec.rb
264
+ - spec/pgit/story_branch/story_id_parser_spec.rb
140
265
  - spec/pgit/story_branch_spec.rb
141
- - spec/pgit/story_spec.rb
266
+ - spec/pgit/validators/project_validator_spec.rb
142
267
  - spec/spec_helper.rb
143
268
  homepage: https://github.com/Edderic/pgit
144
269
  licenses:
@@ -177,7 +302,7 @@ requirements:
177
302
  - At least one project that uses Pivotal Tracker and Git
178
303
  - cURL, at least 7.35.0
179
304
  rubyforge_project:
180
- rubygems_version: 2.2.2
305
+ rubygems_version: 2.4.5
181
306
  signing_key:
182
307
  specification_version: 4
183
308
  summary: Optimize your Pivotal Tracker and Github workflow
@@ -1,9 +0,0 @@
1
- module PGit
2
- class Configuration
3
- class LayoutError < PGit::Error
4
- def prepend_general_message(message)
5
- "#{message}\nPlease have the following layout:\n" + YAML.dump(PGit::Configuration.default_options)
6
- end
7
- end
8
- end
9
- end
@@ -1,10 +0,0 @@
1
- module PGit
2
- class Configuration
3
- class MissingAttributesError < PGit::Configuration::LayoutError
4
- def initialize(path)
5
- @message = prepend_general_message "#{path} must have a path, id, and api_token for each project."
6
- super(@message)
7
- end
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- module PGit
2
- class Configuration
3
- class NotFoundError < PGit::Error
4
- def initialize(config_path)
5
- @message = "#{config_path} configuration file does not exist. Please run `pgit install`"
6
- super(@message)
7
- end
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- module PGit
2
- class Configuration
3
- class ProjectMissingError < PGit::Configuration::LayoutError
4
- def initialize(path)
5
- @message = prepend_general_message "#{path} needs at least one project."
6
- super(@message)
7
- end
8
- end
9
- end
10
- end
@@ -1,41 +0,0 @@
1
- module PGit
2
- class Configuration
3
- class Validator
4
- attr_reader :yaml
5
-
6
- def initialize(config_path)
7
- @expanded_path = File.expand_path(config_path)
8
- if File.exists? @expanded_path
9
- config_file = File.open(@expanded_path, 'r')
10
- @yaml = YAML.load(config_file)
11
-
12
- validate_existence_of_at_least_one_project
13
- validate_presence_of_items_in_each_project
14
- else
15
- raise PGit::Configuration::NotFoundError.new(@expanded_path)
16
- end
17
- end
18
-
19
- private
20
-
21
- def validate_presence_of_items_in_each_project
22
- projects = @yaml["projects"]
23
- all_present = projects.all? do |project|
24
- project["api_token"] &&
25
- project["path"] &&
26
- project["id"]
27
- end
28
-
29
- unless all_present
30
- raise PGit::Configuration::MissingAttributesError.new(@expanded_path)
31
- end
32
- end
33
-
34
- def validate_existence_of_at_least_one_project
35
- unless @yaml["projects"]
36
- raise PGit::Configuration::ProjectMissingError.new(@expanded_path)
37
- end
38
- end
39
- end
40
- end
41
- end