apiaryio 0.3.5 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/.gitignore +3 -2
  2. data/.travis.yml +3 -11
  3. data/README.md +7 -10
  4. data/Rakefile +4 -29
  5. data/apiary.gemspec +15 -9
  6. data/appveyor.yml +20 -11
  7. data/bin/apiary +1 -2
  8. data/circle.yml +2 -2
  9. data/features/preview.feature +1 -1
  10. data/features/step_definitions/file_content_step.rb +3 -12
  11. data/features/support/env.rb +2 -4
  12. data/lib/apiary.rb +0 -2
  13. data/lib/apiary/agent.rb +13 -0
  14. data/lib/apiary/cli.rb +5 -7
  15. data/lib/apiary/command/fetch.rb +48 -60
  16. data/lib/apiary/command/preview.rb +27 -46
  17. data/lib/apiary/command/publish.rb +27 -38
  18. data/lib/apiary/file_templates/preview.erb +1 -1
  19. data/lib/apiary/helpers.rb +45 -0
  20. data/lib/apiary/version.rb +1 -1
  21. data/spec/{cli_spec.rb → apiary/cli_spec.rb} +0 -1
  22. data/spec/{command → apiary/command}/fetch_spec.rb +0 -0
  23. data/spec/{command → apiary/command}/preview_spec.rb +1 -1
  24. data/spec/{command → apiary/command}/publish_spec.rb +7 -4
  25. data/spec/apiary/helpers_spec.rb +67 -0
  26. data/spec/fixtures/api_blueprint_and_swagger/apiary.apib +5 -0
  27. data/spec/fixtures/api_blueprint_and_swagger/swagger.yaml +5 -0
  28. data/{features → spec}/fixtures/apiary-invalid.apib +0 -0
  29. data/{features → spec}/fixtures/apiary.apib +0 -0
  30. data/{features → spec}/fixtures/apiary_with_bom.apib +0 -0
  31. data/spec/fixtures/empty_folder/.gitkeep +0 -0
  32. data/spec/fixtures/only_api_blueprint/apiary.apib +5 -0
  33. data/spec/fixtures/only_swagger/swagger.yaml +5 -0
  34. data/spec/spec.opts +1 -0
  35. data/spec/spec_helper.rb +8 -4
  36. data/spec/support/aruba.rb +1 -11
  37. data/spec/support/webmock.rb +1 -0
  38. metadata +70 -53
  39. data/features/support/setup.rb +0 -5
  40. data/lib/apiary/common.rb +0 -29
  41. data/spec/common_spec.rb +0 -29
File without changes
@@ -0,0 +1,5 @@
1
+ FORMAT: 1A
2
+
3
+ # Minimal
4
+
5
+ Minimal API Blueprint
@@ -0,0 +1,5 @@
1
+ swagger: "2.0"
2
+ info:
3
+ version: 1.0.0
4
+ title: Minimal
5
+ description: Minimal Swagger
@@ -0,0 +1 @@
1
+ --color
@@ -1,9 +1,13 @@
1
- require 'rspec'
2
- require 'webmock/rspec'
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ if RUBY_VERSION < '1.9.3'
4
+ ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
5
+ else
6
+ ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
7
+ end
8
+
3
9
  require 'apiary'
4
10
 
5
11
  RSpec.configure do |config|
6
12
  config.filter_run_excluding :api_key => true if ENV['APIARY_API_KEY']
7
13
  end
8
-
9
- Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }
@@ -1,11 +1 @@
1
- require 'aruba/api'
2
- require 'aruba/reporting'
3
-
4
- RSpec.configure do |config|
5
- config.include Aruba::Api
6
-
7
- config.before(:each) do
8
- restore_env
9
- clean_current_dir
10
- end
11
- end
1
+ require 'aruba/rspec'
@@ -0,0 +1 @@
1
+ require 'webmock/rspec'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apiaryio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-21 00:00:00.000000000 Z
12
+ date: 2016-05-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -44,13 +44,13 @@ dependencies:
44
44
  - !ruby/object:Gem::Version
45
45
  version: 1.6.4
46
46
  - !ruby/object:Gem::Dependency
47
- name: rake
47
+ name: thor
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: '10.4'
53
+ version: 0.19.1
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,15 +58,15 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '10.4'
61
+ version: 0.19.1
62
62
  - !ruby/object:Gem::Dependency
63
- name: thor
63
+ name: json
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 0.19.1
69
+ version: '1.8'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,23 +74,39 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 0.19.1
77
+ version: '1.8'
78
78
  - !ruby/object:Gem::Dependency
79
- name: json
79
+ name: bundler
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: '1.8'
86
- type: :runtime
85
+ version: '1.12'
86
+ type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '1.8'
93
+ version: '1.12'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rake
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '10.0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '10.0'
94
110
  - !ruby/object:Gem::Dependency
95
111
  name: rspec
96
112
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +114,7 @@ dependencies:
98
114
  requirements:
99
115
  - - ~>
100
116
  - !ruby/object:Gem::Version
101
- version: 3.2.0
117
+ version: '3.4'
102
118
  type: :development
103
119
  prerelease: false
104
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +122,7 @@ dependencies:
106
122
  requirements:
107
123
  - - ~>
108
124
  - !ruby/object:Gem::Version
109
- version: 3.2.0
125
+ version: '3.4'
110
126
  - !ruby/object:Gem::Dependency
111
127
  name: webmock
112
128
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +130,7 @@ dependencies:
114
130
  requirements:
115
131
  - - ~>
116
132
  - !ruby/object:Gem::Version
117
- version: '1.20'
133
+ version: '2.0'
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +138,7 @@ dependencies:
122
138
  requirements:
123
139
  - - ~>
124
140
  - !ruby/object:Gem::Version
125
- version: '1.20'
141
+ version: '2.0'
126
142
  - !ruby/object:Gem::Dependency
127
143
  name: yard
128
144
  requirement: !ruby/object:Gem::Requirement
@@ -144,23 +160,17 @@ dependencies:
144
160
  requirement: !ruby/object:Gem::Requirement
145
161
  none: false
146
162
  requirements:
147
- - - ! '>='
148
- - !ruby/object:Gem::Version
149
- version: 0.6.2
150
- - - <
163
+ - - ~>
151
164
  - !ruby/object:Gem::Version
152
- version: 0.7.0
165
+ version: '0.14'
153
166
  type: :development
154
167
  prerelease: false
155
168
  version_requirements: !ruby/object:Gem::Requirement
156
169
  none: false
157
170
  requirements:
158
- - - ! '>='
159
- - !ruby/object:Gem::Version
160
- version: 0.6.2
161
- - - <
171
+ - - ~>
162
172
  - !ruby/object:Gem::Version
163
- version: 0.7.0
173
+ version: '0.14'
164
174
  - !ruby/object:Gem::Dependency
165
175
  name: cucumber
166
176
  requirement: !ruby/object:Gem::Requirement
@@ -168,10 +178,7 @@ dependencies:
168
178
  requirements:
169
179
  - - ~>
170
180
  - !ruby/object:Gem::Version
171
- version: '1.3'
172
- - - ! '>='
173
- - !ruby/object:Gem::Version
174
- version: 1.3.19
181
+ version: '2.0'
175
182
  type: :development
176
183
  prerelease: false
177
184
  version_requirements: !ruby/object:Gem::Requirement
@@ -179,10 +186,7 @@ dependencies:
179
186
  requirements:
180
187
  - - ~>
181
188
  - !ruby/object:Gem::Version
182
- version: '1.3'
183
- - - ! '>='
184
- - !ruby/object:Gem::Version
185
- version: 1.3.19
189
+ version: '2.0'
186
190
  description: Apiary.io CLI
187
191
  email:
188
192
  - team@apiary.io
@@ -204,31 +208,38 @@ files:
204
208
  - bin/apiary
205
209
  - circle.yml
206
210
  - features/fetch.feature
207
- - features/fixtures/apiary-invalid.apib
208
- - features/fixtures/apiary.apib
209
- - features/fixtures/apiary_with_bom.apib
210
211
  - features/preview.feature
211
212
  - features/publish.feature
212
213
  - features/step_definitions/file_content_step.rb
213
214
  - features/support/env.rb
214
- - features/support/setup.rb
215
215
  - features/version.feature
216
216
  - lib/apiary.rb
217
+ - lib/apiary/agent.rb
217
218
  - lib/apiary/cli.rb
218
219
  - lib/apiary/command/fetch.rb
219
220
  - lib/apiary/command/preview.rb
220
221
  - lib/apiary/command/publish.rb
221
- - lib/apiary/common.rb
222
222
  - lib/apiary/file_templates/preview.erb
223
+ - lib/apiary/helpers.rb
223
224
  - lib/apiary/helpers/javascript_helper.rb
224
225
  - lib/apiary/version.rb
225
- - spec/cli_spec.rb
226
- - spec/command/fetch_spec.rb
227
- - spec/command/preview_spec.rb
228
- - spec/command/publish_spec.rb
229
- - spec/common_spec.rb
226
+ - spec/apiary/cli_spec.rb
227
+ - spec/apiary/command/fetch_spec.rb
228
+ - spec/apiary/command/preview_spec.rb
229
+ - spec/apiary/command/publish_spec.rb
230
+ - spec/apiary/helpers_spec.rb
231
+ - spec/fixtures/api_blueprint_and_swagger/apiary.apib
232
+ - spec/fixtures/api_blueprint_and_swagger/swagger.yaml
233
+ - spec/fixtures/apiary-invalid.apib
234
+ - spec/fixtures/apiary.apib
235
+ - spec/fixtures/apiary_with_bom.apib
236
+ - spec/fixtures/empty_folder/.gitkeep
237
+ - spec/fixtures/only_api_blueprint/apiary.apib
238
+ - spec/fixtures/only_swagger/swagger.yaml
239
+ - spec/spec.opts
230
240
  - spec/spec_helper.rb
231
241
  - spec/support/aruba.rb
242
+ - spec/support/webmock.rb
232
243
  homepage: http://apiary.io
233
244
  licenses:
234
245
  - MIT
@@ -256,20 +267,26 @@ specification_version: 3
256
267
  summary: Apiary.io CLI
257
268
  test_files:
258
269
  - features/fetch.feature
259
- - features/fixtures/apiary-invalid.apib
260
- - features/fixtures/apiary.apib
261
- - features/fixtures/apiary_with_bom.apib
262
270
  - features/preview.feature
263
271
  - features/publish.feature
264
272
  - features/step_definitions/file_content_step.rb
265
273
  - features/support/env.rb
266
- - features/support/setup.rb
267
274
  - features/version.feature
268
- - spec/cli_spec.rb
269
- - spec/command/fetch_spec.rb
270
- - spec/command/preview_spec.rb
271
- - spec/command/publish_spec.rb
272
- - spec/common_spec.rb
275
+ - spec/apiary/cli_spec.rb
276
+ - spec/apiary/command/fetch_spec.rb
277
+ - spec/apiary/command/preview_spec.rb
278
+ - spec/apiary/command/publish_spec.rb
279
+ - spec/apiary/helpers_spec.rb
280
+ - spec/fixtures/api_blueprint_and_swagger/apiary.apib
281
+ - spec/fixtures/api_blueprint_and_swagger/swagger.yaml
282
+ - spec/fixtures/apiary-invalid.apib
283
+ - spec/fixtures/apiary.apib
284
+ - spec/fixtures/apiary_with_bom.apib
285
+ - spec/fixtures/empty_folder/.gitkeep
286
+ - spec/fixtures/only_api_blueprint/apiary.apib
287
+ - spec/fixtures/only_swagger/swagger.yaml
288
+ - spec/spec.opts
273
289
  - spec/spec_helper.rb
274
290
  - spec/support/aruba.rb
291
+ - spec/support/webmock.rb
275
292
  has_rdoc:
@@ -1,5 +0,0 @@
1
- require 'aruba/cucumber'
2
-
3
- Before('@needs_apiary_api_key') do
4
- @aruba_timeout_seconds = 45
5
- end
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Apiary
4
- # Common function used in commands
5
- class Common
6
-
7
- attr_accessor :error_message
8
-
9
- def initialize()
10
- end
11
-
12
- def get_apib_file(apib_file)
13
- if validate_apib_file(apib_file)
14
- text_without_bom = nil
15
- File.open(apib_file, "r:bom|utf-8") { |file|
16
- text_without_bom = file.read
17
- }
18
- text_without_bom
19
- end
20
- end
21
-
22
- def validate_apib_file(apib_file)
23
- unless File.exist?(apib_file)
24
- raise "Apiary definition file hasn't been found: #{apib_file.inspect}"
25
- end
26
- true
27
- end
28
- end
29
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Apiary::Common do
4
-
5
- describe 'Validate apib files' do
6
-
7
- it 'test existing file' do
8
- common = Apiary::Common.new
9
- expect(common.validate_apib_file('features/fixtures/apiary.apib')).to be_truthy
10
- end
11
-
12
- it 'test non existing file' do
13
- common = Apiary::Common.new
14
- expect {common.validate_apib_file('features/fixtures/apiary.xxx')}.to raise_error(/file hasn't been found/)
15
- end
16
-
17
- end
18
-
19
- describe 'Test get file with and without BOM' do
20
-
21
- it 'get file and compare' do
22
- common = Apiary::Common.new
23
- file1 = common.get_apib_file('features/fixtures/apiary.apib')
24
- file2 = common.get_apib_file('features/fixtures/apiary_with_bom.apib')
25
- expect(file1).to eq(file2)
26
- end
27
- end
28
-
29
- end