dredd-rack 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18df818e221d674ff9790acfbccc8cb2324fcab3
4
- data.tar.gz: 6631de46a43a5dc77506c7b42de90d7ad383142e
3
+ metadata.gz: df0339cc24c130ed3b8ddf0a6c6516b3fde9ed2a
4
+ data.tar.gz: 6f902e77b941e88d0a25d925d6850d2943b678d4
5
5
  SHA512:
6
- metadata.gz: cc4009ccc1e08a1ae033edb244ec1a8db6e50dff78686ea96d249859a9a70ae3fd7225dfb460cbc757add66c77f0a6f7f15dd6eeb8a1a4f666edde24e3a70422
7
- data.tar.gz: 6c940aef0d478e172e73455516944bff12b6de3a5001b674a12ac2238c782bff9df04d02bf9f1415036aca34f2de4816c7de4327f8466f2ed95c4b0328b0de0d
6
+ metadata.gz: f933506885074736e2486d83eb7b4858a73effe7d620119a9e081645f0ed2a5113643986ee190639c95a5e2d75e78e5055740b27a5222b836f4b2576eba29f49
7
+ data.tar.gz: add209b7be5f6ee8413589c40aa2714ebdef5d1bf1ca0fed3e63466e07b86fd62b3c127e16e4a725ee59298e6eeac46678e641d7290e37934c84b935780da1cd
data/CHANGELOG.md CHANGED
@@ -3,11 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [0.9.0] - 2016-06-15
7
+
8
+ ### Added
9
+
10
+ - Add **dredd_command** option - with help from @gottfrois
11
+ - Add configuration handler for convenient initializers
12
+
6
13
  ## [0.8.2] - 2016-06-08
7
14
 
8
15
  ### Fixed
9
16
 
10
- - Fix inaccurate counting of command arguments for local API
17
+ - Fix inaccurate counting of command arguments for local API - @rylnd
11
18
  - Minor fix missing documentation for Dredd v1.0.8 options
12
19
 
13
20
  ## [0.8.1] - 2016-05-07
@@ -72,6 +79,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
72
79
  The original implementation of the Rake task was shared in this [gist][gist].
73
80
 
74
81
  [gist]: https://gist.github.com/gonzalo-bulnes/eec3f73cc7d6605add21
82
+ [0.9.0]: https://github.com/gonzalo-bulnes/dredd-rack/compare/v0.8.2...v0.9.0
75
83
  [0.8.2]: https://github.com/gonzalo-bulnes/dredd-rack/compare/v0.8.1...v0.8.2
76
84
  [0.8.1]: https://github.com/gonzalo-bulnes/dredd-rack/compare/v0.7.1...v0.8.1
77
85
  [0.8.0]: https://github.com/gonzalo-bulnes/dredd-rack/compare/v0.7.1...v0.8.0
data/README.md CHANGED
@@ -28,7 +28,7 @@ Add the gem to your `Gemfile`:
28
28
  ```ruby
29
29
  # Gemfile
30
30
 
31
- gem 'dredd-rack', '0.8.2' # see semver.org
31
+ gem 'dredd-rack', '0.9.0' # see semver.org
32
32
  ```
33
33
 
34
34
  Define which application Dredd::Rack must serve automatically:
@@ -38,10 +38,16 @@ Define which application Dredd::Rack must serve automatically:
38
38
 
39
39
  require 'dredd/rack'
40
40
 
41
- # Allow the automatic setup of a local application server when necessary
42
- #
43
- # Find the name of your application in its `config.ru` file.
44
- Dredd::Rack.app = Example::Application # or Rails.application, Sinatra::Application...
41
+ Dredd::Rack.configure do |config|
42
+ # Allow the automatic setup of a local application server when necessary
43
+ #
44
+ # Find the name of your application in its `config.ru` file.
45
+ config.app = Example::Application # or Rails.application, Sinatra::Application...
46
+
47
+ # Optionally, you can define a custom Dredd command:
48
+ config.dredd_command = 'dredd'
49
+ end
50
+
45
51
  ```
46
52
 
47
53
  Usage
@@ -19,9 +19,26 @@ module Dredd
19
19
  @@app = object
20
20
  end
21
21
 
22
+ # Return the command to be runned to invoke Dredd
23
+ def dredd_command
24
+ @@dredd_command
25
+ end
26
+
27
+ # Set a custom Dredd command
28
+ #
29
+ # command - the command String
30
+ def dredd_command=(command)
31
+ @@dredd_command = command
32
+ end
33
+
22
34
  # Default configuration
23
35
  @@app = nil
36
+ @@dredd_command = 'dredd'
24
37
 
38
+ # Allow the default configuration to be overwritten from initializers
39
+ def configure
40
+ yield self if block_given?
41
+ end
25
42
  end
26
43
  end
27
44
  end
@@ -64,8 +64,7 @@ module Dredd
64
64
  private
65
65
 
66
66
  def dredd_available?
67
- `which dredd`
68
- $?.exitstatus == 0
67
+ system ['which', Dredd::Rack.dredd_command].join(' ')
69
68
  end
70
69
 
71
70
  def dredd_connection_error?(exit_status)
@@ -49,7 +49,7 @@ module Dredd
49
49
  # api_endpoint - the API URL as a String
50
50
  #
51
51
  def initialize(api_endpoint=nil)
52
- @dredd_command = 'dredd'
52
+ @dredd_command = Dredd::Rack.dredd_command
53
53
  @paths_to_blueprints = 'doc/*.apib doc/*.apib.md'
54
54
  @api_endpoint = api_endpoint || ''
55
55
  @command_parts = []
@@ -1,5 +1,5 @@
1
1
  module Dredd
2
2
  module Rack
3
- VERSION = '0.8.2'
3
+ VERSION = '0.9.0'
4
4
  end
5
5
  end
@@ -16,7 +16,7 @@ describe Dredd::Rack::Configuration do
16
16
 
17
17
  let(:subject) { @klass }
18
18
 
19
- describe 'provides #app which' do
19
+ describe 'provides .app which' do
20
20
 
21
21
  it_behaves_like 'a configuration option', 'app'
22
22
 
@@ -24,5 +24,14 @@ describe Dredd::Rack::Configuration do
24
24
  expect(subject.app).to be_nil
25
25
  end
26
26
  end
27
+
28
+ describe 'provides .dredd_command which' do
29
+
30
+ it_behaves_like 'a configuration option', 'dredd_command'
31
+
32
+ it "defauts to 'dredd'", private: true do
33
+ expect(subject.dredd_command).to eq 'dredd'
34
+ end
35
+ end
27
36
  end
28
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dredd-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gonzalo Bulnes Guilpain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-08 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara