washout_builder 1.5.6 → 1.6.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e3c51f9c9c6b9f89f2751314e19e761a8794da9
4
- data.tar.gz: b46342cef7b824929dd587f4fab23fb8a36ddbaf
3
+ metadata.gz: 0d0f00926e145efd9e05172728a2d3e90cbb118e
4
+ data.tar.gz: d50062a30205f3322e27636417ed926c4d314050
5
5
  SHA512:
6
- metadata.gz: aff745505776cfd51038096251641d716321e138b847c166300a6ace452a7abfcc1d77a70da58ccf672c4092a158061c5ccee47e597643b198fd427c82371560
7
- data.tar.gz: 6776b09cebc3ecf34a999fa71ba6a097963af1f72d1f3ead4127503ca5f96de296291a9994b4a4e2584932e5c773d141722e9f70bf6b0c1e7714abe8638b64bd
6
+ metadata.gz: a967c2fcb7ad06118ad73f46134dfdef86dff5b90f6e85ff842ae5af0db7c331544f60640a2a432ba1ed1522f420fbd2e42c792b4e5304c52f28d4ea7bb6b551
7
+ data.tar.gz: c5387118f460fe3b9f407f612aa8b85a1e1abf6d56f1ee6aab64eb17b0e4378482f08a10f8a715f1b43dc78f736d592811b6f3244c9b6b62aa56e4afab3b1d03
data/.codeclimate.yml ADDED
@@ -0,0 +1,33 @@
1
+ ---
2
+ engines:
3
+ brakeman:
4
+ enabled: true
5
+ duplication:
6
+ enabled: true
7
+ config:
8
+ languages:
9
+ - ruby
10
+ - javascript
11
+ - python
12
+ - php
13
+ fixme:
14
+ enabled: true
15
+ rubocop:
16
+ enabled: true
17
+ ratings:
18
+ paths:
19
+ - Gemfile.lock
20
+ - "**.erb"
21
+ - "**.haml"
22
+ - "**.rb"
23
+ - "**.rhtml"
24
+ - "**.slim"
25
+ - "**.inc"
26
+ - "**.js"
27
+ - "**.jsx"
28
+ - "**.module"
29
+ - "**.php"
30
+ - "**.py"
31
+ exclude_paths:
32
+ - config/
33
+ - spec/
data/.gitignore CHANGED
@@ -1,7 +1,9 @@
1
- s.rbx/
1
+ .rbx/
2
2
  .bundle/
3
3
  *.gem
4
4
  .idea/
5
+ .ruby-gemset
6
+ .ruby-version
5
7
  .rvmrc
6
8
  *.swp
7
9
  log/*.log
@@ -9,10 +11,7 @@ pkg/
9
11
  spec/dummy/db/*.sqlite3
10
12
  spec/dummy/log/*.log
11
13
  spec/dummy/tmp/
14
+ gemfiles/*.lock
12
15
  coverage
13
16
  tags
14
17
  Gemfile.lock
15
- /nbproject/
16
- /.git-rewrite/
17
- /bin/**
18
- gemfiles
data/.travis.yml CHANGED
@@ -1,26 +1,31 @@
1
+ language: ruby
1
2
  sudo: false
3
+
2
4
  cache: bundler
3
- language: ruby
5
+
6
+ bundler_args: --no-deployment --binstubs=./bin
7
+
4
8
  before_install:
5
9
  - "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
6
10
  - gem install bundler
11
+ - gem update bundler
12
+
13
+ install:
14
+ - bundle install --path vendor/bundle
15
+
16
+ script:
17
+ - echo $BUNDLE_GEMFILE
18
+ - bundle exec rake
19
+
20
+ gemfile:
21
+ - gemfiles/rails_4.0.0.gemfile
22
+ - gemfiles/rails_4.1.1.gemfile
23
+ - gemfiles/rails_4.2.0.gemfile
24
+ - gemfiles/rails_5.0.0.gemfile
7
25
  rvm:
8
- - 2.0.0
9
- - 2.1.5
10
- - 2.1.8
11
26
  - 2.2.2
12
- - 2.2.3
13
- - 2.3.0
27
+ - 2.2.5
14
28
  - 2.3.1
15
- matrix:
16
- exclude:
17
- - rvm: 2.0.0
18
- gemfile: gemfiles/rails_5.0.0.gemfile
19
- - rvm: 2.1.5
20
- gemfile: gemfiles/rails_5.0.0.gemfile
21
- - rvm: 2.1.8
22
- gemfile: gemfiles/rails_5.0.0.gemfile
23
- env:
24
- - RAILS_ENV=test RACK_ENV=test
25
29
  notifications:
26
30
  email: false
31
+
data/Appraisals CHANGED
@@ -2,55 +2,15 @@ appraise "rails-4.0.0" do
2
2
  gem "rails", "4.0.0"
3
3
  end
4
4
 
5
- appraise "rails-4.0.2" do
6
- gem "rails", "4.0.2"
7
- end
8
-
9
5
  appraise "rails-4.1.1" do
10
6
  gem "rails", "4.1.1"
11
7
  end
12
8
 
13
- appraise "rails-4.1.4" do
14
- gem "rails", "4.1.4"
15
- end
16
-
17
- appraise "rails-4.1.9" do
18
- gem "rails", "4.1.9"
19
- end
20
-
21
9
  appraise "rails-4.2.0" do
22
10
  gem "rails", "4.2.0"
23
11
  end
24
12
 
25
- appraise "rails-4.2.1" do
26
- gem "rails", "4.2.1"
27
- end
28
-
29
- appraise "rails-4.2.2" do
30
- gem "rails", "4.2.2"
31
- end
32
-
33
- appraise "rails-4.2.3" do
34
- gem "rails", "4.2.3"
13
+ appraise "rails-5.0.0" do
14
+ gem "rails", "5.0.0"
15
+ gem 'rails-controller-testing'
35
16
  end
36
-
37
- appraise "rails-4.2.4" do
38
- gem "rails", "4.2.4"
39
- end
40
-
41
- appraise "rails-4.2.4" do
42
- gem "rails", "4.2.4"
43
- end
44
-
45
- appraise "rails-4.2.5" do
46
- gem "rails", "4.2.5"
47
- end
48
-
49
- appraise "rails-4.2.6" do
50
- gem "rails", "4.2.6"
51
- end
52
-
53
- # waiting on this https://github.com/inossidabile/wash_out/pull/211 getting approved first
54
- # appraise "rails-5.0.0" do
55
- # gem "rails", "5.0.0"
56
- # end
data/Gemfile CHANGED
@@ -1,3 +1,11 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'wash_out', github: 'inossidabile/wash_out'
6
+
7
+ if RUBY_VERSION >= "2.2.0"
8
+ gem 'activesupport', '>= 4.0', '>= 4.0'
9
+ else
10
+ gem 'activesupport', '>= 4.0', '< 5.0'
11
+ end
data/Rakefile CHANGED
@@ -18,7 +18,15 @@ task default: [:all]
18
18
  desc 'Test the plugin under all supported Rails versions.'
19
19
  task :all do |_t|
20
20
  if ENV['TRAVIS']
21
- exec(' bundle exec appraisal install && bundle exec rake appraisal spec && bundle exec rake coveralls:push')
21
+ # require 'json'
22
+ # puts JSON.pretty_generate(ENV.to_hash)
23
+ if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
24
+ appraisal_name = ENV['BUNDLE_GEMFILE'].scan(/rails\_(.*)\.gemfile/).flatten.first
25
+ command_prefix = "appraisal rails-#{appraisal_name}"
26
+ exec ("#{command_prefix} bundle install && #{command_prefix} bundle exec rspec && bundle exec rake coveralls:push ")
27
+ else
28
+ exec(' bundle exec appraisal install && bundle exec rake appraisal spec && bundle exec rake coveralls:push')
29
+ end
22
30
  else
23
31
  exec('bundle exec appraisal install && bundle exec rake appraisal spec')
24
32
  end
@@ -17,7 +17,7 @@ module WashoutBuilder
17
17
  #
18
18
  # @api public
19
19
  def all
20
- params[:name] = params[:defaults][:name] if params[:defaults].present?
20
+ params[:name] = env_controller_path if env_controller_path.present?
21
21
  find_all_routes
22
22
  route_details = params[:name].present? ? controller_is_a_service?(params[:name]) : nil
23
23
  if route_details.present? && defined?(controller_class(params[:name]))
@@ -33,6 +33,10 @@ module WashoutBuilder
33
33
 
34
34
  private
35
35
 
36
+ def env_controller_path
37
+ request.env['washout_builder.controller_path']
38
+ end
39
+
36
40
  # tries to find all services by searching through the rails controller
37
41
  # and returns their namespace, endpoint and a documentation url
38
42
  # @see map_controllers
@@ -58,7 +62,7 @@ module WashoutBuilder
58
62
  'documentation_url' => service_documentation_url(hash, controller_name)
59
63
  }
60
64
  end
61
- end
65
+ end.uniq{|hash| hash['service_name'] }
62
66
  end
63
67
 
64
68
  def generate_wsdl_action
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "wash_out", :github => "inossidabile/wash_out"
6
+ gem "activesupport", ">= 4.0", ">= 4.0"
7
+ gem "rails", "4.0.0"
8
+
9
+ gemspec :path => "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "wash_out", :github => "inossidabile/wash_out"
6
+ gem "activesupport", ">= 4.0", ">= 4.0"
7
+ gem "rails", "4.1.1"
8
+
9
+ gemspec :path => "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "wash_out", :github => "inossidabile/wash_out"
6
+ gem "activesupport", ">= 4.0", ">= 4.0"
7
+ gem "rails", "4.2.0"
8
+
9
+ gemspec :path => "../"
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "wash_out", :github => "inossidabile/wash_out"
6
+ gem "activesupport", ">= 4.0", ">= 4.0"
7
+ gem "rails", "5.0.0"
8
+ gem "rails-controller-testing"
9
+
10
+ gemspec :path => "../"
@@ -8,7 +8,6 @@ require 'active_support/core_ext/string/starts_ends_with'
8
8
 
9
9
  Gem.find_files('washout_builder/**/*.rb').each { |path| require path }
10
10
 
11
-
12
11
  ActionDispatch::Routing::Mapper.class_eval do
13
12
  alias_method :original_wash_out, :wash_out
14
13
  # Adds the routes for a SOAP endpoint at +controller+.
@@ -25,9 +24,7 @@ ActionDispatch::Routing::Mapper.class_eval do
25
24
  else
26
25
  controller_class_name = controller_name.to_s.underscore
27
26
  end
28
-
29
- match "#{controller_name}/soap_doc" => WashoutBuilder::Engine, via: :get,
30
- defaults: { name: "#{controller_class_name}" },
27
+ match "#{controller_name}/soap_doc" => WashoutBuilder::Router.new(controller_class_name), via: :get,
31
28
  format: false,
32
29
  as: "#{controller_class_name}_soap_doc"
33
30
  end
@@ -0,0 +1,16 @@
1
+ module WashoutBuilder
2
+ # This class is a Rack middleware used to route SOAP requests to a proper
3
+ # action of a given SOAP controller.
4
+ class Router
5
+
6
+ def initialize(controller_path)
7
+ @controller_path = controller_path
8
+ end
9
+
10
+ def call(env)
11
+ env['washout_builder.controller_path'] = @controller_path
12
+ WashoutBuilderController.action(:all).call(env)
13
+ end
14
+
15
+ end
16
+ end
@@ -10,9 +10,9 @@ module WashoutBuilder
10
10
  # the major version of the gem
11
11
  MAJOR = 1
12
12
  # the minor version of the gem
13
- MINOR = 5
13
+ MINOR = 6
14
14
  # the tiny version of the gem
15
- TINY = 6
15
+ TINY = 1
16
16
  # if the version should be a prerelease
17
17
  PRE = nil
18
18
 
@@ -11,8 +11,8 @@ describe WashoutBuilder::WashoutBuilderController, type: :controller do
11
11
 
12
12
  let(:soap_config) do
13
13
  OpenStruct.new(
14
- camelize_wsdl: false,
15
- namespace: '/api/wsdl'
14
+ camelize_wsdl: false,
15
+ namespace: '/api/wsdl'
16
16
  )
17
17
  end
18
18
 
@@ -44,7 +44,11 @@ describe WashoutBuilder::WashoutBuilderController, type: :controller do
44
44
  controller.stubs(:controller_class).returns(ApiController)
45
45
  controller.stubs(:controller_is_a_service?).with(params[:name]).returns(route)
46
46
  WashoutBuilder::Document::Generator.expects(:new).with(route, route.defaults[:controller])
47
- get :all, params
47
+ if Rails::VERSION::MAJOR >= 5
48
+ get :all, params: params
49
+ else
50
+ get :all, params
51
+ end
48
52
  expect(response).to render_template 'wash_with_html/doc'
49
53
  end
50
54
  end
@@ -164,7 +164,8 @@ describe WashoutBuilder do
164
164
  render soap: { a: params[:a] }
165
165
  end
166
166
  end
167
- expect(savon(:answer, a: '')[:answer_response][:a][:'@xsi:type']).to eq('xsd:string')
167
+ expect(savon(:answer, a: '')[:answer_response][:a]).to be_nil
168
+ #[:'@xsi:type']).to eq('xsd:string') -- not returning type as per https://github.com/inossidabile/wash_out/issues/212
168
169
  end
169
170
 
170
171
  it 'accept one parameter' do
@@ -409,7 +410,8 @@ describe WashoutBuilder do
409
410
  end
410
411
  end
411
412
 
412
- expect(savon(:rocknroll)[:rocknroll_response][:my_value][:'@xsi:type']).to eq('tns:MyValue')
413
+ expect(savon(:rocknroll)[:rocknroll_response][:my_value]).to be_nil
414
+ #[:'@xsi:type']).to eq('tns:MyValue') # not returning type as per https://github.com/inossidabile/wash_out/issues/212
413
415
  end
414
416
 
415
417
  it 'handles incomplete array response' do
data/spec/spec_helper.rb CHANGED
@@ -133,3 +133,15 @@ class Hash
133
133
  end
134
134
  end
135
135
  end
136
+
137
+ unless defined?(silence_stream) # Rails 5
138
+ def silence_stream(stream)
139
+ old_stream = stream.dup
140
+ stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
141
+ stream.sync = true
142
+ yield
143
+ ensure
144
+ stream.reopen(old_stream)
145
+ old_stream.close
146
+ end
147
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: washout_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.6
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-05 00:00:00.000000000 Z
11
+ date: 2016-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: wash_out
@@ -332,6 +332,7 @@ executables: []
332
332
  extensions: []
333
333
  extra_rdoc_files: []
334
334
  files:
335
+ - ".codeclimate.yml"
335
336
  - ".coveralls.yml"
336
337
  - ".gitignore"
337
338
  - ".rspec"
@@ -355,6 +356,10 @@ files:
355
356
  - app/views/wash_with_html/all_services.builder
356
357
  - app/views/wash_with_html/doc.builder
357
358
  - config/routes.rb
359
+ - gemfiles/rails_4.0.0.gemfile
360
+ - gemfiles/rails_4.1.1.gemfile
361
+ - gemfiles/rails_4.2.0.gemfile
362
+ - gemfiles/rails_5.0.0.gemfile
358
363
  - init.rb
359
364
  - lib/washout_builder.rb
360
365
  - lib/washout_builder/document/complex_type.rb
@@ -364,6 +369,7 @@ files:
364
369
  - lib/washout_builder/engine.rb
365
370
  - lib/washout_builder/env_checker.rb
366
371
  - lib/washout_builder/param.rb
372
+ - lib/washout_builder/router.rb
367
373
  - lib/washout_builder/soap.rb
368
374
  - lib/washout_builder/type.rb
369
375
  - lib/washout_builder/version.rb