active_type 0.6.2 → 0.6.3

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: cc7ab992e4c50b6b75f74a62feb7b12c65a46703
4
- data.tar.gz: 4b03beac33f4608904815d836cdf05fc68e2f769
3
+ metadata.gz: ae001f6573873833446638cad632eb52ca6c54e2
4
+ data.tar.gz: fd9903ddb3435cef627cba36dfd68a95a13a09a6
5
5
  SHA512:
6
- metadata.gz: 7cda677b927c7c8af52015bf23f2ebd3bb597ccf793bdecbc793ca3ea7a4da80bee0986d0f9a651b06dfdccdaae7ce2b7066de9aec7f76a5104db8d79918e79c
7
- data.tar.gz: 8e4ce97d57197a2e618774e660a7ad70547ee12d906650d492cafb2f7c2dbf4adb4d12b29d3643d0e8de27917e2a93ac166cc5da000b66ba5d569ef2f1f14721
6
+ metadata.gz: 8a4bc20542bdddd93b52dc0c5e80177425450c32582b429bcd837ea916e2eea52d0e22f1602d5fc757d63a3cb6c1486a17030644e5d41c2737c7f235f12a547f
7
+ data.tar.gz: 3aaf32f0db3df343720e31e6adc4c3f94bb76e804956292f60a54594abc179e3ff929b9214da6b74b473ea9baae35a881a98f9df18af72af786319d28c88d6d9
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ tags
5
5
  .idea
6
6
  tmp
7
7
  spec/support/database.yml
8
+ .bundle
data/.travis.yml CHANGED
@@ -19,7 +19,7 @@ gemfile:
19
19
  before_script:
20
20
  - psql -c 'create database active_type_test;' -U postgres
21
21
  - mysql -e 'create database IF NOT EXISTS active_type_test;'
22
- script: bundle exec rspec spec
22
+ script: bundle exec rake spec
23
23
  sudo: false
24
24
  cache: bundler
25
25
  notifications:
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ActiveType is in a pre-1.0 state. This means that its APIs and behavior are subject to breaking changes without deprecation notices. Until 1.0, version numbers will follow a [Semver][]-ish `0.y.z` format, where `y` is incremented when new features or breaking changes are introduced, and `z` is incremented for lesser changes or bug fixes.
6
6
 
7
+ ## [0.6.3][] (2017-01-30)
8
+
9
+ * Fix a load error when using `ActiveType::Object` before using `ActiveRecord::Base` within a Rails app.
10
+
7
11
  ## [0.6.2][] (2017-01-30)
8
12
 
9
13
  * When used with Rails, defer loading to not interfere with `ActiveRecord` configuration in initializers.
data/Rakefile CHANGED
@@ -4,13 +4,20 @@ require 'bundler/gem_tasks'
4
4
  desc 'Default: Run all specs.'
5
5
  task :default => 'all:spec'
6
6
 
7
+
8
+ desc "Run specs and isolated specs"
9
+ task :spec do
10
+ success = run_specs
11
+ fail "Tests failed" unless success
12
+ end
13
+
7
14
  namespace :all do
8
15
 
9
16
  desc "Run specs on all versions"
10
17
  task :spec do
11
18
  success = true
12
19
  for_each_gemfile do
13
- success &= system("bundle exec rspec spec")
20
+ success &= run_specs
14
21
  end
15
22
  fail "Tests failed" unless success
16
23
  end
@@ -40,3 +47,17 @@ def for_each_gemfile
40
47
  yield
41
48
  end
42
49
  end
50
+
51
+ def for_each_isolated_spec
52
+ Dir["spec/isolated/**/*_spec.rb"].sort.each do |isolated_spec|
53
+ yield(isolated_spec)
54
+ end
55
+ end
56
+
57
+ def run_specs
58
+ success = system("bundle exec rspec spec --exclude-pattern '**/isolated/**'")
59
+ for_each_isolated_spec do |isolated_spec|
60
+ success &= system("bundle exec rspec #{isolated_spec}")
61
+ end
62
+ success
63
+ end
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
3
3
  gem 'activerecord', '=3.2.22'
4
4
  gem 'rspec', '~> 3.4'
5
5
  gem 'mysql2', '= 0.3.17'
6
+ gem 'rake'
6
7
 
7
8
  gem 'active_type', :path => '..'
8
9
  gem 'i18n', '=0.6.11' # 0.7 no longer builds for Ruby 1.8.7
@@ -24,6 +24,7 @@ GEM
24
24
  i18n (0.6.11)
25
25
  multi_json (1.11.2)
26
26
  mysql2 (0.3.17)
27
+ rake (10.4.2)
27
28
  rspec (3.4.0)
28
29
  rspec-core (~> 3.4.0)
29
30
  rspec-expectations (~> 3.4.0)
@@ -47,6 +48,7 @@ DEPENDENCIES
47
48
  activerecord (= 3.2.22)
48
49
  i18n (= 0.6.11)
49
50
  mysql2 (= 0.3.17)
51
+ rake
50
52
  rspec (~> 3.4)
51
53
 
52
54
  BUNDLED WITH
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
3
3
  gem 'activerecord', '=3.2.22'
4
4
  gem 'rspec', '~>3.4'
5
5
  gem 'sqlite3'
6
+ gem 'rake'
6
7
 
7
8
  gem 'active_type', :path => '..'
8
9
  gem 'i18n', '=0.6.11' # 0.7 no longer builds for Ruby 1.8.7
@@ -23,6 +23,7 @@ GEM
23
23
  diff-lcs (1.2.5)
24
24
  i18n (0.6.11)
25
25
  multi_json (1.11.2)
26
+ rake (10.4.2)
26
27
  rspec (3.4.0)
27
28
  rspec-core (~> 3.4.0)
28
29
  rspec-expectations (~> 3.4.0)
@@ -46,6 +47,7 @@ DEPENDENCIES
46
47
  active_type!
47
48
  activerecord (= 3.2.22)
48
49
  i18n (= 0.6.11)
50
+ rake
49
51
  rspec (~> 3.4)
50
52
  sqlite3
51
53
 
@@ -3,5 +3,6 @@ source 'https://rubygems.org'
3
3
  gem 'activerecord', '~>4.0.0'
4
4
  gem 'rspec', '~>3.4'
5
5
  gem 'sqlite3'
6
+ gem 'rake'
6
7
 
7
8
  gem 'active_type', :path => '..'
@@ -28,6 +28,7 @@ GEM
28
28
  i18n (0.7.0)
29
29
  minitest (4.7.5)
30
30
  multi_json (1.11.2)
31
+ rake (10.4.2)
31
32
  rspec (3.4.0)
32
33
  rspec-core (~> 3.4.0)
33
34
  rspec-expectations (~> 3.4.0)
@@ -51,6 +52,7 @@ PLATFORMS
51
52
  DEPENDENCIES
52
53
  active_type!
53
54
  activerecord (~> 4.0.0)
55
+ rake
54
56
  rspec (~> 3.4)
55
57
  sqlite3
56
58
 
@@ -3,5 +3,6 @@ source 'https://rubygems.org'
3
3
  gem 'activerecord', '~>4.1.0'
4
4
  gem 'rspec', '~>3.4'
5
5
  gem 'sqlite3'
6
+ gem 'rake'
6
7
 
7
8
  gem 'active_type', :path => '..'
@@ -26,6 +26,7 @@ GEM
26
26
  i18n (0.7.0)
27
27
  json (1.8.3)
28
28
  minitest (5.8.3)
29
+ rake (10.4.2)
29
30
  rspec (3.4.0)
30
31
  rspec-core (~> 3.4.0)
31
32
  rspec-expectations (~> 3.4.0)
@@ -50,6 +51,7 @@ PLATFORMS
50
51
  DEPENDENCIES
51
52
  active_type!
52
53
  activerecord (~> 4.1.0)
54
+ rake
53
55
  rspec (~> 3.4)
54
56
  sqlite3
55
57
 
@@ -3,5 +3,6 @@ source 'https://rubygems.org'
3
3
  gem 'activerecord', '~>4.2.1'
4
4
  gem 'rspec', '~>3.4'
5
5
  gem 'mysql2', '~> 0.3.17'
6
+ gem 'rake'
6
7
 
7
8
  gem 'active_type', :path => '..'
@@ -27,6 +27,7 @@ GEM
27
27
  json (1.8.3)
28
28
  minitest (5.8.3)
29
29
  mysql2 (0.3.20)
30
+ rake (10.4.2)
30
31
  rspec (3.4.0)
31
32
  rspec-core (~> 3.4.0)
32
33
  rspec-expectations (~> 3.4.0)
@@ -51,6 +52,7 @@ DEPENDENCIES
51
52
  active_type!
52
53
  activerecord (~> 4.2.1)
53
54
  mysql2 (~> 0.3.17)
55
+ rake
54
56
  rspec (~> 3.4)
55
57
 
56
58
  BUNDLED WITH
@@ -3,5 +3,6 @@ source 'https://rubygems.org'
3
3
  gem 'activerecord', '~>4.2.1'
4
4
  gem 'rspec', '~>3.4'
5
5
  gem 'pg'
6
+ gem 'rake'
6
7
 
7
8
  gem 'active_type', :path => '..'
@@ -27,6 +27,7 @@ GEM
27
27
  json (1.8.3)
28
28
  minitest (5.8.3)
29
29
  pg (0.18.4)
30
+ rake (10.4.2)
30
31
  rspec (3.4.0)
31
32
  rspec-core (~> 3.4.0)
32
33
  rspec-expectations (~> 3.4.0)
@@ -51,6 +52,7 @@ DEPENDENCIES
51
52
  active_type!
52
53
  activerecord (~> 4.2.1)
53
54
  pg
55
+ rake
54
56
  rspec (~> 3.4)
55
57
 
56
58
  BUNDLED WITH
@@ -3,5 +3,6 @@ source 'https://rubygems.org'
3
3
  gem 'activerecord', '~>4.2.1'
4
4
  gem 'rspec', '~> 3.4'
5
5
  gem 'sqlite3'
6
+ gem 'rake'
6
7
 
7
8
  gem 'active_type', :path => '..'
@@ -26,6 +26,7 @@ GEM
26
26
  i18n (0.7.0)
27
27
  json (1.8.3)
28
28
  minitest (5.8.3)
29
+ rake (10.4.2)
29
30
  rspec (3.4.0)
30
31
  rspec-core (~> 3.4.0)
31
32
  rspec-expectations (~> 3.4.0)
@@ -50,6 +51,7 @@ PLATFORMS
50
51
  DEPENDENCIES
51
52
  active_type!
52
53
  activerecord (~> 4.2.1)
54
+ rake
53
55
  rspec (~> 3.4)
54
56
  sqlite3
55
57
 
@@ -3,5 +3,6 @@ source 'https://rubygems.org'
3
3
  gem 'activerecord', '~>5.0.0'
4
4
  gem 'rspec', '~>3.4'
5
5
  gem 'mysql2', '~> 0.3.17'
6
+ gem 'rake'
6
7
 
7
8
  gem 'active_type', :path => '..'
@@ -24,6 +24,7 @@ GEM
24
24
  i18n (0.7.0)
25
25
  minitest (5.9.0)
26
26
  mysql2 (0.3.21)
27
+ rake (10.4.2)
27
28
  rspec (3.5.0)
28
29
  rspec-core (~> 3.5.0)
29
30
  rspec-expectations (~> 3.5.0)
@@ -48,6 +49,7 @@ DEPENDENCIES
48
49
  active_type!
49
50
  activerecord (~> 5.0.0)
50
51
  mysql2 (~> 0.3.17)
52
+ rake
51
53
  rspec (~> 3.4)
52
54
 
53
55
  BUNDLED WITH
@@ -3,5 +3,6 @@ source 'https://rubygems.org'
3
3
  gem 'activerecord', '~>5.0.0'
4
4
  gem 'rspec', '~>3.4'
5
5
  gem 'pg'
6
+ gem 'rake'
6
7
 
7
8
  gem 'active_type', :path => '..'
@@ -24,6 +24,7 @@ GEM
24
24
  i18n (0.7.0)
25
25
  minitest (5.9.0)
26
26
  pg (0.18.4)
27
+ rake (10.4.2)
27
28
  rspec (3.5.0)
28
29
  rspec-core (~> 3.5.0)
29
30
  rspec-expectations (~> 3.5.0)
@@ -48,6 +49,7 @@ DEPENDENCIES
48
49
  active_type!
49
50
  activerecord (~> 5.0.0)
50
51
  pg
52
+ rake
51
53
  rspec (~> 3.4)
52
54
 
53
55
  BUNDLED WITH
@@ -3,5 +3,6 @@ source 'https://rubygems.org'
3
3
  gem 'activerecord', '~>5.0.0'
4
4
  gem 'rspec', '~> 3.4'
5
5
  gem 'sqlite3'
6
+ gem 'rake'
6
7
 
7
8
  gem 'active_type', :path => '..'
@@ -23,6 +23,7 @@ GEM
23
23
  diff-lcs (1.2.5)
24
24
  i18n (0.7.0)
25
25
  minitest (5.9.0)
26
+ rake (10.4.2)
26
27
  rspec (3.5.0)
27
28
  rspec-core (~> 3.5.0)
28
29
  rspec-expectations (~> 3.5.0)
@@ -47,6 +48,7 @@ PLATFORMS
47
48
  DEPENDENCIES
48
49
  active_type!
49
50
  activerecord (~> 5.0.0)
51
+ rake
50
52
  rspec (~> 3.4)
51
53
  sqlite3
52
54
 
data/lib/active_type.rb CHANGED
@@ -2,30 +2,19 @@
2
2
 
3
3
  require 'active_type/version'
4
4
 
5
+ require 'active_record'
5
6
 
6
- load_now = proc do
7
- require 'active_type/util'
8
- require 'active_type/record'
9
- require 'active_type/object'
10
-
11
- if ActiveRecord::VERSION::STRING == '4.2.0'
12
- raise(<<-MESSAGE.strip_heredoc)
13
- ActiveType is not compatible with ActiveRecord 4.2.0. Please upgrade to 4.2.1
14
- For details see https://github.com/makandra/active_type/issues/31
15
- MESSAGE
16
- end
7
+ if ActiveRecord::VERSION::STRING == '4.2.0'
8
+ raise(<<-MESSAGE.strip_heredoc)
9
+ ActiveType is not compatible with ActiveRecord 4.2.0. Please upgrade to 4.2.1
10
+ For details see https://github.com/makandra/active_type/issues/31
11
+ MESSAGE
17
12
  end
18
13
 
14
+ module ActiveType
15
+ extend ActiveSupport::Autoload
19
16
 
20
- if defined?(Rails) && defined?(ActiveSupport)
21
- # If we are inside Rails, we'll assume active_record will be required anyways
22
- # in this case, wait until then, to not mess with ActiveRecord configuration.
23
- # (compare https://github.com/rails/rails/issues/23589)
24
- ActiveSupport.on_load(:active_record) do
25
- load_now.call()
26
- end
27
- else
28
- # No Rails.
29
- require 'active_record'
30
- load_now.call()
17
+ autoload :Object
18
+ autoload :Record
19
+ autoload :Util
31
20
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveType
2
- VERSION = '0.6.2'
2
+ VERSION = '0.6.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_type
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-30 00:00:00.000000000 Z
12
+ date: 2017-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler