mack-data_mapper 0.7.1.1 → 0.8.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.
@@ -1,12 +1,10 @@
1
1
  require 'rubygems'
2
2
  require 'genosaurus'
3
- require 'mack-orm'
4
3
 
5
- config = {
6
- "data_mapper_session_store::expiry_time" => 4.hours
7
- }
4
+ configatron.mack.set_default(:disable_transactional_tests, false)
5
+ configatron.mack.data_mapper_session_store.set_default(:expiry_time, 4.hours)
8
6
 
9
- app_config.load_hash(config.merge(app_config.final_configuration_settings), "mack-data_mapper")
7
+ require 'mack-orm'
10
8
 
11
9
 
12
10
  fl = File.join(File.dirname(__FILE__), "mack-data_mapper")
@@ -15,16 +13,17 @@ $: << File.expand_path(File.join(fl, "dm_patches"))
15
13
 
16
14
  [:core, :aggregates, :migrations, :serializer, :timestamps, :validations, :observer, :types].each do |g|
17
15
  gem "dm-#{g}", "0.9.5"
18
- require "dm-#{g}"
16
+ require "dm-#{g}" unless g == :types
19
17
  end
20
18
 
19
+ autoload :Serial, 'dm-types/serial'
20
+ autoload :Yaml, 'dm-types/yaml'
21
21
 
22
22
  require File.join(fl, "database")
23
23
  require File.join(fl, "database_migrations")
24
24
  require File.join(fl, "generators")
25
25
  require File.join(fl, "helpers", "orm_helpers")
26
26
  require File.join(fl, "resource")
27
- require File.join(fl, "runner")
28
27
  require File.join(fl, "test_extensions")
29
28
 
30
29
 
@@ -39,15 +38,10 @@ module DataMapper # :nodoc:
39
38
  class Logger # :nodoc:
40
39
 
41
40
  [:debug, :info, :warn, :error, :fatal].each do |m|
42
- unless method_defined?("dm_#{m}")
43
- eval %{
44
- alias_method :dm_#{m}, :#{m}
45
-
46
- def #{m}(message)
47
- Mack.logger.#{m}(message)
48
- dm_#{m}(message)
49
- end
50
- }
41
+ alias_instance_method m
42
+ define_method(m) do |message|
43
+ Mack.logger.send(m, message)
44
+ self.send("_original_#{m}", message)
51
45
  end
52
46
  end
53
47
 
@@ -5,12 +5,12 @@ model_template:
5
5
  type: file
6
6
  template_path: <%= File.join(templates_directory_path, "model.rb.template") %>
7
7
  output_path: <%= File.join("app", "models", "#{param(:name).singular.underscore}.rb") %>
8
- <% if app_config.mack.testing_framework == "test_case" -%>
8
+ <% if configatron.mack.testing_framework.to_s == "test_case" -%>
9
9
  test_template:
10
10
  type: file
11
11
  template_path: <%= File.join(templates_directory_path, "test_case.rb.template") %>
12
12
  output_path: <%= File.join("test", "models", "#{param(:name).singular.underscore}_test.rb") %>
13
- <% elsif app_config.mack.testing_framework == "rspec" -%>
13
+ <% elsif configatron.mack.testing_framework.to_s == "rspec" -%>
14
14
  test_template:
15
15
  type: file
16
16
  template_path: <%= File.join(templates_directory_path, "rspec.rb.template") %>
@@ -1,7 +1,7 @@
1
1
  module Mack
2
2
  module SessionStore # :nodoc:
3
3
  # Stores session information in the database.
4
- # To set the expiry time for this session store use the following app_config setting:
4
+ # To set the expiry time for this session store use the following configatron setting:
5
5
  # data_mapper_session_store::expiry_time: <%= 4.hours %>
6
6
  class DataMapper < Mack::SessionStore::Base
7
7
 
@@ -13,7 +13,7 @@ module Mack
13
13
  create_storage_if_non_existent
14
14
  sess = Mack::DataMapper::Session.first(:id => id)
15
15
  return nil if sess.nil?
16
- expire_date = DateTime.now.minus_seconds(app_config.data_mapper_session_store.expiry_time)
16
+ expire_date = DateTime.now.minus_seconds(configatron.mack.data_mapper_session_store.expiry_time)
17
17
  if sess.updated_at.to_s < expire_date.to_s
18
18
  sess.destroy
19
19
  return nil
@@ -17,64 +17,23 @@ if Mack.env == "test"
17
17
  include DataMapper::Resource
18
18
  end
19
19
 
20
- module DataMapperHelpers
21
- def rollback_transaction
22
- begin
23
- Mack::Testing::DmTestTransactionWrapper.transaction do
24
- # DataMapper::Transaction.new.commit do
25
- yield if block_given?
26
- raise "Rollback!"
27
- end
28
- rescue => ex
29
- # we need to do this so we can throw up actual errors!
30
- unless ex.to_s == "Rollback!"
31
- raise ex
32
- end
20
+ def rollback_transaction
21
+ begin
22
+ Mack::Testing::DmTestTransactionWrapper.transaction do
23
+ # DataMapper::Transaction.new.commit do
24
+ yield if block_given?
25
+ raise "Rollback!"
33
26
  end
34
- end # rollback_transaction
35
- end # DataMapperHelpers
36
- end # Testing
37
- end # Mack
38
-
39
-
40
- module Spec # :nodoc:
41
- module Example # :nodoc:
42
- module ExampleMethods # :nodoc:
43
- include Mack::Testing::DataMapperHelpers
44
-
45
- alias_method :dm_spec_execute, :execute
46
-
47
- def execute(options, instance_variables)
48
- rollback_transaction do
49
- @__res = dm_spec_execute(options, instance_variables)
27
+ rescue => ex
28
+ # we need to do this so we can throw up actual errors!
29
+ unless ex.to_s == "Rollback!"
30
+ raise ex
50
31
  end
51
- @__res
52
32
  end
33
+ end # rollback_transaction
53
34
 
54
- end # ExampleGroup
55
- end # Example
56
- end # Spec
57
-
58
- module Test # :nodoc:
59
- module Unit # :nodoc:
60
- class TestCase # :nodoc:
61
- include Mack::Testing::DataMapperHelpers
62
-
63
- # Let's alias the run method in the class above us so we can create a new one here
64
- # but still reference it.
65
- alias_method :dm_test_case_run, :run # :nodoc:
66
-
67
- # We need to wrap the run method so we can do things like
68
- # run a cleanup method if it exists
69
- def run(result, &progress_block) # :nodoc:
70
- rollback_transaction do
71
- dm_test_case_run(result, &progress_block)
72
- end
73
- end
74
-
75
- end # TestCase
76
- end # Unit
77
- end # Test
35
+ end # Testing
36
+ end # Mack
78
37
 
79
38
  end
80
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mack-data_mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-14 00:00:00 -04:00
12
+ date: 2008-10-06 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -100,7 +100,7 @@ dependencies:
100
100
  requirements:
101
101
  - - "="
102
102
  - !ruby/object:Gem::Version
103
- version: 0.7.1.1
103
+ version: 0.8.0
104
104
  version:
105
105
  description: "mack-data_mapper was developed by: markbates"
106
106
  email: mark@mackframework.com
@@ -128,7 +128,6 @@ files:
128
128
  - lib/mack-data_mapper/model_generator/templates/rspec.rb.template
129
129
  - lib/mack-data_mapper/model_generator/templates/test_case.rb.template
130
130
  - lib/mack-data_mapper/resource.rb
131
- - lib/mack-data_mapper/runner.rb
132
131
  - lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
133
132
  - lib/mack-data_mapper/sessions/data_mapper_session_store.rb
134
133
  - lib/mack-data_mapper/sessions/session.rb
@@ -159,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
158
  requirements: []
160
159
 
161
160
  rubyforge_project: magrathea
162
- rubygems_version: 1.2.0
161
+ rubygems_version: 1.3.0
163
162
  signing_key:
164
163
  specification_version: 2
165
164
  summary: DataMapper ORM support for Mack
@@ -1,17 +0,0 @@
1
- #--
2
- # module Mack
3
- # class Runner
4
- #
5
- # alias_method :data_mapper_custom_dispatch_wrapper, :custom_dispatch_wrapper# if self.respond_to? :custom_dispatch_wrapper
6
- #
7
- # # Wrap all requests in a 'default' DataMapper repository block.
8
- # def custom_dispatch_wrapper(&block)
9
- # repo = (app_config.mack.default_respository_name || "default").to_sym
10
- # repository(repo) do
11
- # data_mapper_custom_dispatch_wrapper(&block)
12
- # end
13
- # end
14
- #
15
- # end # Runner
16
- # end # Mack
17
- #++