cardiac 0.2.0.pre8 → 0.2.0.pre9
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/lib/cardiac/model/declarations.rb +4 -2
- data/lib/cardiac/railtie.rb +10 -0
- data/lib/cardiac/resource/builder.rb +4 -0
- data/lib/cardiac/util.rb +3 -2
- data/lib/cardiac/version.rb +1 -1
- data/spec/rails-3.2/Gemfile.lock +11 -11
- data/spec/rails-3.2/app_root/app/models/dummy.rb +7 -0
- data/spec/rails-3.2/app_root/log/test.log +11165 -0
- data/spec/rails-4.2/Gemfile +9 -0
- data/spec/rails-4.2/Gemfile.lock +157 -0
- data/spec/{rails-4.0 → rails-4.2}/Rakefile +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/app/assets/javascripts/application.js +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/app/assets/stylesheets/application.css +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/app/controllers/application_controller.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/app/helpers/application_helper.rb +0 -0
- data/spec/rails-4.2/app_root/app/models/dummy.rb +7 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/app/views/layouts/application.html.erb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/application.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/boot.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/database.yml +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/environment.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/environments/development.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/environments/production.rb +1 -1
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/environments/test.rb +1 -1
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/initializers/inflections.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/initializers/mime_types.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/initializers/secret_token.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/initializers/session_store.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/initializers/wrap_parameters.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/locales/en.yml +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/config/routes.rb +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/db/test.sqlite3 +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/log/development.log +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/log/test.log +11097 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/public/404.html +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/public/422.html +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/public/500.html +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/public/favicon.ico +0 -0
- data/spec/{rails-4.0 → rails-4.2}/app_root/script/rails +0 -0
- data/spec/{rails-4.0 → rails-4.2}/spec/spec_helper.rb +0 -0
- data/spec/shared/cardiac/model/base_spec.rb +3 -360
- data/spec/shared/cardiac/model/declarations_spec.rb +74 -0
- data/spec/shared/cardiac/model/persistence_spec.rb +179 -0
- data/spec/shared/cardiac/model/querying_spec.rb +144 -0
- metadata +76 -66
- data/spec/rails-4.0/Gemfile +0 -9
- data/spec/rails-4.0/Gemfile.lock +0 -132
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fb4366a0918ce0607b3ebcfd481618c9433cb72
|
4
|
+
data.tar.gz: 4bdf1442aad5d3ffb9722dabf6c0a6a4cd6d03fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32faed90e5e2b90998026ebe79db65382bace7fde17a8a8af382fc43ff8fe291f8e2f293e76e2ef265135c120c855881ae1341aaa8ed47cc5ea1a6a832b9c9c8
|
7
|
+
data.tar.gz: 5a370a11eeccff0d0a53aee2bdd99d05493b3e2d1531eee4c15ad364992591355f95a16d0075aaffcf1ca97ec4ae724b2f2fde267b228ad3d54b94378f0a7144
|
@@ -22,10 +22,12 @@ module Cardiac
|
|
22
22
|
|
23
23
|
##
|
24
24
|
# :method: identify
|
25
|
+
#
|
25
26
|
# This member identifies a singular subresource by converting the given argument
|
26
|
-
# to a parameter and appending it to the path.
|
27
|
+
# to a parameter and appending it to the path. Parameters are properly CGI escaped.
|
28
|
+
#
|
27
29
|
# This member is used by all query/persistence methods that operate on existing records.
|
28
|
-
subresource :identify, lambda{|id_or_model| path(id_or_model.to_param) } do
|
30
|
+
subresource :identify, lambda{|id_or_model| path(Array(id_or_model).map{|v| CGI.escape(v.to_param)}.to_param) } do
|
29
31
|
|
30
32
|
##
|
31
33
|
# :method: update_instance
|
data/lib/cardiac/railtie.rb
CHANGED
@@ -80,6 +80,16 @@ module Cardiac
|
|
80
80
|
self.logger ||= ::Rails.logger
|
81
81
|
end
|
82
82
|
end
|
83
|
+
|
84
|
+
# Rails 4.2+, or when the GlobalID gem is explicitly loaded.
|
85
|
+
initializer 'cardiac_model.global_id' do
|
86
|
+
ActiveSupport.on_load(:cardiac_model) do
|
87
|
+
if defined? ::GlobalID
|
88
|
+
require 'global_id/identification'
|
89
|
+
send :include, ::GlobalID::Identification
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
83
93
|
|
84
94
|
# Make sure that the model layer is already available when running a script.
|
85
95
|
runner do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
|
1
3
|
module Cardiac
|
2
4
|
class ResourceBuilder < Proxy
|
3
5
|
|
@@ -6,6 +8,8 @@ module Cardiac
|
|
6
8
|
@base, @extensions, @extension_block = base, extensions, extension_block
|
7
9
|
@extensions.compact!
|
8
10
|
end
|
11
|
+
|
12
|
+
delegate :to_url, :to_uri, :to_relative_uri, :to_relative_url, to: :__subresource__
|
9
13
|
|
10
14
|
# Returns a copy of our subresource.
|
11
15
|
def to_resource
|
data/lib/cardiac/util.rb
CHANGED
@@ -28,12 +28,13 @@ module Cardiac
|
|
28
28
|
# Base proxy class.
|
29
29
|
#
|
30
30
|
# On Ruby 2.0 and above, we can use ActiveSupport's ProxyObject, otherwise we must use BlankSlate.
|
31
|
-
class Proxy < (RUBY_VERSION>='2.0' && defined?(::ActiveSupport::ProxyObject) ? ::ActiveSupport::ProxyObject : ::BlankSlate)
|
31
|
+
class Proxy < (::RUBY_VERSION>='2.0' && defined?(::ActiveSupport::ProxyObject) ? ::ActiveSupport::ProxyObject : ::BlankSlate)
|
32
32
|
|
33
33
|
# We at least would like some basics here.
|
34
|
-
%w(kind_of? is_a? inspect class method send).each do |k|
|
34
|
+
%w(kind_of? is_a? inspect class method send Array).each do |k|
|
35
35
|
define_method k, ::Kernel.instance_method(k)
|
36
36
|
end
|
37
|
+
define_method :Hash, ::Kernel.instance_method(:Hash) if ::RUBY_VERSION>='2.0'
|
37
38
|
%w(class extend send object_id public_send).each do |k|
|
38
39
|
define_method :"__#{k}__", ::Kernel.instance_method(k)
|
39
40
|
end
|
data/lib/cardiac/version.rb
CHANGED
data/spec/rails-3.2/Gemfile.lock
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
cardiac (0.2.0.
|
5
|
-
active_attr (>= 0.8.2)
|
6
|
-
activemodel (>= 3.2, <
|
7
|
-
activesupport (>= 3.2, <
|
4
|
+
cardiac (0.2.0.pre9)
|
5
|
+
active_attr (~> 0.8, >= 0.8.2)
|
6
|
+
activemodel (>= 3.2, < 5.0)
|
7
|
+
activesupport (>= 3.2, < 5.0)
|
8
8
|
i18n (~> 0.6, >= 0.6.4)
|
9
|
-
json (> 1.8.0)
|
10
|
-
mime-types (> 1.1)
|
9
|
+
json (~> 1.8, > 1.8.0)
|
10
|
+
mime-types (~> 1.1, > 1.1)
|
11
11
|
multi_json (~> 1.0)
|
12
|
-
rack (>= 1.4.5)
|
12
|
+
rack (~> 1.4, >= 1.4.5)
|
13
13
|
rack-cache (~> 1.2)
|
14
|
-
rack-client (~> 0.4.2)
|
14
|
+
rack-client (~> 0.4, >= 0.4.2)
|
15
15
|
|
16
16
|
GEM
|
17
17
|
remote: http://rubygems.org/
|
@@ -29,9 +29,9 @@ GEM
|
|
29
29
|
rack-cache (~> 1.2)
|
30
30
|
rack-test (~> 0.6.1)
|
31
31
|
sprockets (~> 2.2.1)
|
32
|
-
active_attr (0.8.
|
33
|
-
activemodel (>= 3.0.2, <
|
34
|
-
activesupport (>= 3.0.2, <
|
32
|
+
active_attr (0.8.5)
|
33
|
+
activemodel (>= 3.0.2, < 5.0)
|
34
|
+
activesupport (>= 3.0.2, < 5.0)
|
35
35
|
activemodel (3.2.19)
|
36
36
|
activesupport (= 3.2.19)
|
37
37
|
builder (~> 3.0.0)
|