washout_builder 0.14.1 → 0.15.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -2
- data/.rubocop.yml +68 -0
- data/.travis.yml +1 -1
- data/Appraisals +9 -1
- data/Gemfile +2 -3
- data/Rakefile +17 -20
- data/app/controllers/washout_builder/washout_builder_controller.rb +79 -79
- data/app/helpers/washout_builder_complex_type_helper.rb +16 -23
- data/app/helpers/washout_builder_fault_type_helper.rb +12 -13
- data/app/helpers/washout_builder_method_arguments_helper.rb +24 -26
- data/app/helpers/washout_builder_method_list_helper.rb +16 -11
- data/app/helpers/washout_builder_method_return_type_helper.rb +14 -12
- data/app/views/wash_with_html/doc.builder +2 -2
- data/bin/appraisal +16 -0
- data/bin/autospec +16 -0
- data/bin/bundler +16 -0
- data/bin/cdiff +16 -0
- data/bin/coderay +16 -0
- data/bin/colortab +16 -0
- data/bin/coveralls +16 -0
- data/bin/decolor +16 -0
- data/bin/erubis +16 -0
- data/bin/guard +16 -0
- data/bin/htmldiff +16 -0
- data/bin/ldiff +16 -0
- data/bin/listen +16 -0
- data/bin/nokogiri +16 -0
- data/bin/phare +16 -0
- data/bin/pry +16 -0
- data/bin/rackup +16 -0
- data/bin/rails +16 -0
- data/bin/rake +16 -0
- data/bin/restclient +16 -0
- data/bin/rspec +16 -0
- data/bin/rubocop +16 -0
- data/bin/ruby-parse +16 -0
- data/bin/ruby-rewrite +16 -0
- data/bin/sass +16 -0
- data/bin/sass-convert +16 -0
- data/bin/scss +16 -0
- data/bin/scss-lint +16 -0
- data/bin/term_display +16 -0
- data/bin/term_mandel +16 -0
- data/bin/thor +16 -0
- data/bin/uuid +16 -0
- data/config/routes.rb +3 -3
- data/init.rb +1 -1
- data/lib/washout_builder.rb +20 -29
- data/lib/washout_builder/document/complex_type.rb +70 -75
- data/lib/washout_builder/document/exception_model.rb +46 -51
- data/lib/washout_builder/document/generator.rb +56 -66
- data/lib/washout_builder/document/shared_complex_type.rb +2 -4
- data/lib/washout_builder/engine.rb +1 -2
- data/lib/washout_builder/soap.rb +6 -10
- data/lib/washout_builder/type.rb +9 -23
- data/lib/washout_builder/version.rb +5 -5
- data/spec/app/controllers/washout_builder_controller_spec.rb +26 -28
- data/spec/app/helpers/washout_builder_complex_type_helper_spec.rb +37 -45
- data/spec/app/helpers/washout_builder_fault_type_helper_spec.rb +65 -77
- data/spec/app/helpers/washout_builder_method_arguments_helper_spec.rb +65 -76
- data/spec/app/helpers/washout_builder_method_list_helper_spec.rb +30 -35
- data/spec/app/helpers/washout_builder_method_return_type_helper_spec.rb +25 -27
- data/spec/dummy/config/application.rb +4 -4
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/environments/development.rb +2 -3
- data/spec/dummy/config/environments/test.rb +3 -3
- data/spec/dummy/config/initializers/secret_token.rb +1 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/dummy/config/routes.rb +0 -1
- data/spec/dummy/script/rails +2 -2
- data/spec/integration/washout_builder_all_services_spec.rb +2 -5
- data/spec/integration/washout_builder_service_spec.rb +2 -5
- data/spec/lib/washout_builder/document/complex_type_spec.rb +98 -118
- data/spec/lib/washout_builder/document/exception_model_spec.rb +49 -54
- data/spec/lib/washout_builder/document/generator_spec.rb +93 -118
- data/spec/lib/washout_builder/type_spec.rb +17 -29
- data/spec/lib/washout_builder_spec.rb +293 -308
- data/spec/spec_helper.rb +24 -30
- data/spec/support/complex_types/fluffy.rb +3 -3
- data/spec/support/complex_types/fluffy_container.rb +3 -3
- data/spec/support/complex_types/project_type.rb +4 -5
- data/spec/support/complex_types/test_type.rb +4 -4
- data/washout_builder.gemspec +5 -2
- metadata +78 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bf03886cb1c9afca96b057708fef231782db00a
|
4
|
+
data.tar.gz: 432614b7d5788c094053614d678c530e33520bc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f82065358b685fd0be21b39209f538a62094727d2a21426445fea15df6007524dec39e34f47dab97caeb3b7bd94fb827586f5453e9cafa285257630ed94d603
|
7
|
+
data.tar.gz: 8fc71e4d273114de1552e743ce6a3c8f6cd242d5256eee671597a3579d56f9986dccb2886912d719681e5369a3f0947b05f47dd28f7cf422a23037635d547e52
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- washout_builder.gemspec
|
4
|
+
- bin/**/*
|
5
|
+
- Guardfile
|
6
|
+
|
7
|
+
Documentation:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Encoding:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
LineLength:
|
14
|
+
Max: 200
|
15
|
+
|
16
|
+
AccessModifierIndentation:
|
17
|
+
EnforcedStyle: outdent
|
18
|
+
|
19
|
+
IfUnlessModifier:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
CaseIndentation:
|
23
|
+
IndentWhenRelativeTo: case
|
24
|
+
IndentOneStep: true
|
25
|
+
|
26
|
+
MethodLength:
|
27
|
+
CountComments: false
|
28
|
+
Max: 20
|
29
|
+
|
30
|
+
SignalException:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
ColonMethodCall:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
AsciiComments:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
RegexpLiteral:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
AssignmentInCondition:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
ParameterLists:
|
46
|
+
CountKeywordArgs: false
|
47
|
+
|
48
|
+
SingleLineBlockParams:
|
49
|
+
Methods:
|
50
|
+
- reduce:
|
51
|
+
- memo
|
52
|
+
- item
|
53
|
+
|
54
|
+
Metrics/AbcSize:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/CollectionMethods:
|
58
|
+
Enabled: true
|
59
|
+
|
60
|
+
Style/SymbolArray:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
Style/ExtraSpacing:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Style/FileName:
|
67
|
+
Enabled: false
|
68
|
+
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -6,41 +6,38 @@ require 'coveralls/rake/task'
|
|
6
6
|
Coveralls::RakeTask.new
|
7
7
|
|
8
8
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
9
|
-
|
9
|
+
spec.rspec_opts = ['--backtrace '] if ENV['DEBUG']
|
10
10
|
end
|
11
11
|
|
12
|
-
#desc "Prepare dummy application"
|
13
|
-
#task :prepare do
|
12
|
+
# desc "Prepare dummy application"
|
13
|
+
# task :prepare do
|
14
14
|
# ENV["RAILS_ENV"] ||= 'test'
|
15
|
-
#
|
16
15
|
# require File.expand_path("./spec/dummy/config/environment", File.dirname(__FILE__))
|
17
16
|
# Dummy::Application.load_tasks
|
18
|
-
#
|
19
17
|
# Rake::Task["db:test:prepare"].invoke
|
20
|
-
#end
|
18
|
+
# end
|
21
19
|
|
22
|
-
unless ENV[
|
20
|
+
unless ENV['TRAVIS']
|
23
21
|
require 'rvm-tester'
|
24
22
|
RVM::Tester::TesterTask.new(:suite) do |t|
|
25
23
|
t.rubies = %w(1.9.3 2.0.0 2.1.0) # which versions to test (required!)
|
26
|
-
t.bundle_install = true
|
27
|
-
t.use_travis = true
|
28
|
-
t.command =
|
29
|
-
t.env = {
|
30
|
-
t.num_workers = 5
|
31
|
-
t.verbose = true
|
24
|
+
t.bundle_install = true # updates Gemfile.lock, default is true
|
25
|
+
t.use_travis = true # looks for Rubies in .travis.yml (on by default)
|
26
|
+
t.command = 'bundle exec rake' # runs plain "rake" by default
|
27
|
+
t.env = { 'VERBOSE' => '1', 'RAILS_ENV' => 'test', 'RACK_ENV' => 'test' } # set any ENV vars
|
28
|
+
t.num_workers = 5 # defaults to 3
|
29
|
+
t.verbose = true # shows more output, off by default
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
|
-
|
36
|
-
|
37
|
-
task :default => [:all]
|
33
|
+
desc 'Default: run the unit tests.'
|
34
|
+
task default: [:all]
|
38
35
|
|
39
36
|
desc 'Test the plugin under all supported Rails versions.'
|
40
|
-
task :all
|
41
|
-
if ENV[
|
42
|
-
exec(' bundle exec appraisal install && bundle exec rake appraisal spec && bundle exec rake coveralls:push')
|
37
|
+
task :all do |_t|
|
38
|
+
if ENV['TRAVIS']
|
39
|
+
exec(' bundle exec phare && bundle exec appraisal install && bundle exec rake appraisal spec && bundle exec rake coveralls:push')
|
43
40
|
else
|
44
|
-
exec(' bundle exec appraisal install && bundle exec rake appraisal spec')
|
41
|
+
exec(' bundle exec phare && bundle exec appraisal install && bundle exec rake appraisal spec')
|
45
42
|
end
|
46
43
|
end
|
@@ -1,89 +1,89 @@
|
|
1
|
-
require_relative
|
2
|
-
|
3
|
-
|
1
|
+
require_relative '../../../lib/washout_builder/document/generator'
|
2
|
+
module WashoutBuilder
|
3
|
+
class WashoutBuilderController < ActionController::Base
|
4
|
+
protect_from_forgery
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
# Will show all api services if no name parameter is receiverd
|
7
|
+
# If a name parameter is present wiill try to use that and find a controller
|
8
|
+
# that was that name by camelcasing the name .
|
9
|
+
# IF a name is provided will show the documentation page for that controller
|
10
|
+
def all
|
11
|
+
route = params[:name].present? ? controller_is_a_service?(params[:name]) : nil
|
12
|
+
if route.present?
|
13
|
+
@document = WashoutBuilder::Document::Generator.new(route.defaults[:controller])
|
14
|
+
render template: 'wash_with_html/doc', layout: false,
|
15
|
+
content_type: 'text/html'
|
16
|
+
else
|
17
|
+
all_services
|
18
|
+
end
|
17
19
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
|
21
21
|
private
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
22
|
+
|
23
|
+
# tries to find all services by searching through the rails controller
|
24
|
+
# and returns their namespace, endpoint and a documentation url
|
25
|
+
def all_services
|
26
|
+
@map_controllers = map_controllers { |route| route.defaults[:controller] }
|
27
|
+
@services = @map_controllers.blank? ? [] : @map_controllers.map do |controller_name|
|
28
|
+
{
|
29
|
+
'service_name' => controller_naming(controller_name),
|
30
|
+
'namespace' => service_namespace(controller_name),
|
31
|
+
'endpoint' => service_endpoint(controller_name),
|
32
|
+
'documentation_url' => service_documentation_url(controller_name)
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
render template: 'wash_with_html/all_services', layout: false,
|
37
|
+
content_type: 'text/html'
|
34
38
|
end
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
res = Rails.application.routes.routes.send(action) do |route|
|
54
|
-
if route_can_generate_wsdl?(route)
|
55
|
-
yield route if block_given?
|
39
|
+
|
40
|
+
# the way of converting from controller string in downcase in camelcase
|
41
|
+
def controller_naming(controller)
|
42
|
+
controller.camelize
|
43
|
+
end
|
44
|
+
|
45
|
+
# checking if a route has the action for generating WSDL
|
46
|
+
def route_can_generate_wsdl?(route)
|
47
|
+
route.defaults[:action] == '_generate_wsdl'
|
48
|
+
end
|
49
|
+
|
50
|
+
# method for getting all controllers that have the generate wsdl action or finding out
|
51
|
+
# if a single controller is a soap service
|
52
|
+
def map_controllers(action = 'map')
|
53
|
+
res = Rails.application.routes.routes.send(action) do |route|
|
54
|
+
if route_can_generate_wsdl?(route)
|
55
|
+
yield route if block_given?
|
56
|
+
end
|
56
57
|
end
|
58
|
+
res = res.uniq.compact if action == 'map'
|
59
|
+
res
|
57
60
|
end
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
map_controllers("detect") do |route|
|
65
|
-
controller_naming(route.defaults[:controller]) == controller_naming(controller)
|
61
|
+
|
62
|
+
# checking if a controller is a soap service
|
63
|
+
def controller_is_a_service?(controller)
|
64
|
+
map_controllers('detect') do |route|
|
65
|
+
controller_naming(route.defaults[:controller]) == controller_naming(controller)
|
66
|
+
end
|
66
67
|
end
|
67
|
-
end
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
# the endpoint is based on the namespace followed by /action suffix
|
80
|
-
def service_endpoint(controller_name)
|
81
|
-
service_namespace(controller_name).gsub("/wsdl", "/action")
|
82
|
-
end
|
83
|
-
|
84
|
-
# constructs the documentation url for a specific web service
|
85
|
-
def service_documentation_url(controller_name)
|
86
|
-
"#{washout_builder.root_url}#{controller_naming(controller_name)}"
|
87
|
-
end
|
69
|
+
# getting the controller class from the controller string
|
70
|
+
def controller_class(controller)
|
71
|
+
controller_naming("#{controller}_controller").constantize
|
72
|
+
end
|
73
|
+
|
74
|
+
# retrieves the service namespace
|
75
|
+
def service_namespace(controller_name)
|
76
|
+
controller_class(controller_name).soap_config.namespace
|
77
|
+
end
|
88
78
|
|
79
|
+
# the endpoint is based on the namespace followed by /action suffix
|
80
|
+
def service_endpoint(controller_name)
|
81
|
+
service_namespace(controller_name).gsub('/wsdl', '/action')
|
82
|
+
end
|
83
|
+
|
84
|
+
# constructs the documentation url for a specific web service
|
85
|
+
def service_documentation_url(controller_name)
|
86
|
+
"#{washout_builder.root_url}#{controller_naming(controller_name)}"
|
87
|
+
end
|
88
|
+
end
|
89
89
|
end
|
@@ -1,30 +1,23 @@
|
|
1
1
|
module WashoutBuilderComplexTypeHelper
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
# otherwise will call another method for printing the complex attribute
|
2
|
+
# this method is for printing the attributes of a complex type
|
3
|
+
# if the attributes are primitives this will show the attributes with blue color
|
4
|
+
# otherwise will call another method for printing the complex attribute
|
6
5
|
def create_element_type_html(pre, element)
|
7
|
-
element.type =
|
8
|
-
element.type =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
element.type = 'string' if element.type == 'text'
|
7
|
+
element.type = 'integer' if element.type == 'int'
|
8
|
+
if WashoutBuilder::Type::BASIC_TYPES.include?(element.type)
|
9
|
+
pre << "<span class='blue'>#{element.type}</span> <span class='bold'>#{element.name}</span>"
|
10
|
+
else
|
11
|
+
create_complex_element_type_html(pre, element)
|
12
|
+
end
|
14
13
|
end
|
15
|
-
|
16
|
-
|
14
|
+
|
17
15
|
# checks if a complex attribute of a complex type is a array or not
|
18
|
-
# and retrieves the complex class name of the attribute and prints it
|
16
|
+
# and retrieves the complex class name of the attribute and prints it
|
19
17
|
def create_complex_element_type_html(pre, element)
|
20
|
-
complex_class = element.
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
18
|
+
complex_class = element.find_complex_class_name
|
19
|
+
return if complex_class.nil?
|
20
|
+
complex_class_content = element.multiplied == false ? "#{complex_class}" : "Array of #{complex_class}"
|
21
|
+
pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class_content}</span></a> <span class='bold'>#{element.name}</span>"
|
25
22
|
end
|
26
|
-
|
27
23
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module WashoutBuilderFaultTypeHelper
|
2
|
-
|
3
2
|
# checks if a complex attribute of a complex type SoapFault is array or not
|
4
3
|
# if the attribute is an array will print also the type of the elements contained in the array
|
5
4
|
# otherwise will show the complex class of the attribute
|
@@ -7,35 +6,35 @@ module WashoutBuilderFaultTypeHelper
|
|
7
6
|
attribute_primitive = array == true ? "Array of #{attr_primitive}" : "#{attr_primitive}"
|
8
7
|
pre << "<a href='##{attr_primitive}'><span class='lightBlue'> #{attribute_primitive}</span></a> <span class='bold'>#{attribute}</span>"
|
9
8
|
end
|
10
|
-
|
9
|
+
|
11
10
|
# if the attribute is an array this method is used to identify the type of the elements inside the array
|
12
11
|
def member_type_is_basic?(attr_details)
|
13
12
|
WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:member_type].to_s.downcase) ? attr_details[:member_type].to_s.downcase : attr_details[:member_type]
|
14
13
|
end
|
15
14
|
# checks is the attribute has a primitive value or a complex value
|
16
15
|
def primitive_type_is_basic?(attr_details)
|
17
|
-
WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:primitive].to_s.downcase)
|
16
|
+
WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:primitive].to_s.downcase)
|
18
17
|
end
|
19
18
|
|
20
|
-
# if the attribute value is of type nil the documentation will show string
|
19
|
+
# if the attribute value is of type nil the documentation will show string
|
21
20
|
# otherwise the primitive value
|
22
21
|
def get_primitive_type_string(attr_details)
|
23
|
-
attr_details[:primitive].to_s.downcase ==
|
24
|
-
end
|
25
|
-
|
22
|
+
attr_details[:primitive].to_s.downcase == 'nilclass' ? 'string' : attr_details[:primitive].to_s.downcase
|
23
|
+
end
|
24
|
+
|
26
25
|
# if the attribute is of type array the method identifies the type of the elements inside the array
|
27
26
|
def get_member_type_string(attr_details)
|
28
|
-
attr_details[:primitive].to_s.downcase ==
|
27
|
+
attr_details[:primitive].to_s.downcase == 'array' ? member_type_is_basic?(attr_details) : attr_details[:primitive]
|
29
28
|
end
|
30
|
-
|
31
|
-
# this method is used to print all attributes of a SoapFault element
|
29
|
+
|
30
|
+
# this method is used to print all attributes of a SoapFault element
|
32
31
|
# if the attribute value is a primitve value it will be shown in blue and will also show the type of the primitive
|
33
|
-
# if is a complex type will use another method for finding out the complex class
|
32
|
+
# if is a complex type will use another method for finding out the complex class
|
34
33
|
def create_html_fault_model_element_type(pre, attribute, attr_details)
|
35
|
-
if primitive_type_is_basic?(attr_details) || attr_details[:primitive] ==
|
34
|
+
if primitive_type_is_basic?(attr_details) || attr_details[:primitive] == 'nilclass'
|
36
35
|
pre << "<span class='blue'>#{get_primitive_type_string(attr_details)}</span> <span class='bold'>#{attribute}</span>"
|
37
36
|
else
|
38
|
-
create_fault_model_complex_element_type(pre, get_member_type_string(attr_details), attribute, true
|
37
|
+
create_fault_model_complex_element_type(pre, get_member_type_string(attr_details), attribute, true)
|
39
38
|
end
|
40
39
|
end
|
41
40
|
end
|