forest_liana 1.0.0.pre.beta.4 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,8 @@ module ForestLiana
40
40
  assert schema.fields.include?({
41
41
  field: 'has_one_field',
42
42
  type: 'Number',
43
- reference: 'has_one_fields.id'
43
+ reference: 'has_one_fields.id',
44
+ inverseOf: 'belongs_to_field'
44
45
  })
45
46
  end
46
47
 
@@ -64,15 +65,6 @@ module ForestLiana
64
65
  })
65
66
  end
66
67
 
67
- test 'belongsTo relationhip with specified class_name' do
68
- schema = SchemaAdapter.new(BelongsToClassNameField).perform
69
- assert schema.fields.include?({
70
- field: 'foo',
71
- type: 'Number',
72
- reference: 'has_one_fields.id'
73
- })
74
- end
75
-
76
68
  test 'hasMany relationhip with specified class_name' do
77
69
  schema = SchemaAdapter.new(HasManyClassNameField).perform
78
70
  assert schema.fields.include?({
@@ -83,5 +75,15 @@ module ForestLiana
83
75
  })
84
76
  end
85
77
 
78
+ test 'belongsTo relationhip with specified class_name' do
79
+ schema = SchemaAdapter.new(BelongsToClassNameField).perform
80
+ assert schema.fields.include?({
81
+ field: 'foo',
82
+ type: 'Number',
83
+ reference: 'has_one_fields.id',
84
+ inverseOf: 'belongs_to_class_name_field'
85
+ })
86
+ end
87
+
86
88
  end
87
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.4
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-04 00:00:00.000000000 Z
11
+ date: 2015-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -90,16 +90,15 @@ files:
90
90
  - app/services/forest_liana/resource_getter.rb
91
91
  - app/services/forest_liana/resources_getter.rb
92
92
  - app/services/forest_liana/schema_adapter.rb
93
+ - app/services/forest_liana/schema_utils.rb
93
94
  - app/services/forest_liana/search_query_builder.rb
94
95
  - app/views/layouts/forest_liana/application.html.erb
95
96
  - config/initializers/mimetype.rb
96
- - config/initializers/rails32_http_patch_support_initializer.rb
97
97
  - config/routes.rb
98
98
  - lib/forest_liana.rb
99
99
  - lib/forest_liana/engine.rb
100
100
  - lib/forest_liana/version.rb
101
101
  - lib/generators/forest_liana/install_generator.rb
102
- - lib/patches/add_patch_method.rb
103
102
  - lib/tasks/forest_tasks.rake
104
103
  - test/dummy/README.rdoc
105
104
  - test/dummy/Rakefile
@@ -144,7 +143,6 @@ files:
144
143
  - test/dummy/config/locales/en.yml
145
144
  - test/dummy/config/routes.rb
146
145
  - test/dummy/config/secrets.yml
147
- - test/dummy/db/development.sqlite3
148
146
  - test/dummy/db/migrate/20150608130516_create_date_field.rb
149
147
  - test/dummy/db/migrate/20150608131430_create_integer_field.rb
150
148
  - test/dummy/db/migrate/20150608131603_create_decimal_field.rb
@@ -184,9 +182,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
182
  version: '0'
185
183
  required_rubygems_version: !ruby/object:Gem::Requirement
186
184
  requirements:
187
- - - ">"
185
+ - - ">="
188
186
  - !ruby/object:Gem::Version
189
- version: 1.3.1
187
+ version: '0'
190
188
  requirements: []
191
189
  rubyforge_project:
192
190
  rubygems_version: 2.4.5
@@ -235,7 +233,6 @@ test_files:
235
233
  - test/dummy/config/routes.rb
236
234
  - test/dummy/config/secrets.yml
237
235
  - test/dummy/config.ru
238
- - test/dummy/db/development.sqlite3
239
236
  - test/dummy/db/migrate/20150608130516_create_date_field.rb
240
237
  - test/dummy/db/migrate/20150608131430_create_integer_field.rb
241
238
  - test/dummy/db/migrate/20150608131603_create_decimal_field.rb
@@ -1 +0,0 @@
1
- require_dependency ForestLiana::Engine.root.join("lib/patches/add_patch_method").to_s
@@ -1,124 +0,0 @@
1
- # Rails 3.2 support for HTTP PATCH.
2
- if Rails::VERSION::MAJOR < 4
3
- # see http://weblog.rubyonrails.org/2012/2/26/edge-rails-patch-is-the-new-primary-http-method-for-updates/
4
- # https://github.com/rails/rails/pull/505
5
-
6
- ActionDispatch::Routing::Mapper::HttpHelpers.module_eval do
7
- # Define a route that only recognizes HTTP PATCH.
8
- # For supported arguments, see <tt>Base#match</tt>.
9
- #
10
- # Example:
11
- #
12
- # patch 'bacon', :to => 'food#bacon'
13
- def patch(*args, &block)
14
- map_method(:patch, *args, &block)
15
- end
16
-
17
- def put(*args, &block)
18
- map_method(:put, *args, &block)
19
- map_method(:patch, *args, &block)
20
- end
21
- end
22
-
23
- # Be very conservative not to monkey-patch any methods until
24
- # the relevant files are loaded.
25
- ActiveSupport.on_load(:action_controller) do
26
- ActionDispatch::Request.module_eval do
27
- # Is this a PATCH request?
28
- # Equivalent to <tt>request.request_method == :patch</tt>.
29
- def patch?
30
- HTTP_METHOD_LOOKUP[request_method] == :patch
31
- end
32
- end
33
- module ActionDispatch::Routing
34
- HTTP_METHODS << :patch unless HTTP_METHODS.include?(:patch)
35
- end
36
- ActionDispatch::Integration::RequestHelpers.module_eval do
37
- # Performs a PATCH request with the given parameters. See +#get+ for more
38
- # details.
39
- def patch(path, parameters = nil, headers = nil)
40
- process :patch, path, parameters, headers
41
- end
42
-
43
- # Performs a PATCH request, following any subsequent redirect.
44
- # See +request_via_redirect+ for more information.
45
- def patch_via_redirect(path, parameters = nil, headers = nil)
46
- request_via_redirect(:patch, path, parameters, headers)
47
- end
48
- end
49
- ActionDispatch::Integration::Runner.class_eval do
50
- %w(patch).each do |method|
51
- define_method(method) do |*args|
52
- reset! unless integration_session
53
- # reset the html_document variable, but only for new get/post calls
54
- @html_document = nil unless method.in?(["cookies", "assigns"])
55
- integration_session.__send__(method, *args).tap do
56
- copy_session_variables!
57
- end
58
- end
59
- end
60
- end
61
- module ActionController::TestCase::Behavior
62
- def patch(action, parameters = nil, session = nil, flash = nil)
63
- process(action, parameters, session, flash, "PATCH")
64
- end
65
- end
66
- class ActionController::Responder
67
- ACTIONS_FOR_VERBS.update(:patch => :edit)
68
- delegate :patch?, :to => :request
69
- end
70
- ActionView::Helpers::FormHelper.module_eval do
71
- # = Action View Form Helpers
72
- def apply_form_for_options!(record, object, options) #:nodoc:
73
- object = convert_to_model(object)
74
-
75
- as = options[:as]
76
- action, method = object.respond_to?(:persisted?) && object.persisted? ? [:edit, :patch] : [:new, :post]
77
- options[:html].reverse_merge!(
78
- :class => as ? "#{action}_#{as}" : dom_class(object, action),
79
- :id => as ? "#{action}_#{as}" : [options[:namespace], dom_id(object, action)].compact.join("_").presence,
80
- :method => method
81
- )
82
-
83
- options[:url] ||= polymorphic_path(record, :format => options.delete(:format))
84
- end
85
- private :apply_form_for_options!
86
- end
87
- module ActionDispatch::Routing::Mapper::Resources
88
- class SingletonResource
89
- def resource(*resources, &block)
90
- options = resources.extract_options!.dup
91
-
92
- if apply_common_behavior_for(:resource, resources, options, &block)
93
- return self
94
- end
95
-
96
- resource_scope(:resource, SingletonResource.new(resources.pop, options)) do
97
- yield if block_given?
98
-
99
- collection do
100
- post :create
101
- end if parent_resource.actions.include?(:create)
102
-
103
- new do
104
- get :new
105
- end if parent_resource.actions.include?(:new)
106
-
107
- member do
108
- get :edit if parent_resource.actions.include?(:edit)
109
- get :show if parent_resource.actions.include?(:show)
110
- if parent_resource.actions.include?(:update)
111
- # all that for this PATCH
112
- patch :update
113
- put :update
114
- end
115
- delete :destroy if parent_resource.actions.include?(:destroy)
116
- end
117
- end
118
-
119
- self
120
- end
121
- end
122
- end
123
- end
124
- end
Binary file