dm-rails 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +36 -0
- data/Gemfile +37 -0
- data/LICENSE +20 -0
- data/README.rdoc +506 -0
- data/Rakefile +33 -0
- data/VERSION +1 -0
- data/dm-rails.gemspec +85 -0
- data/lib/dm-rails.rb +1 -0
- data/lib/dm-rails/configuration.rb +70 -0
- data/lib/dm-rails/middleware/identity_map.rb +19 -0
- data/lib/dm-rails/railtie.rb +103 -0
- data/lib/dm-rails/railties/benchmarking_mixin.rb +23 -0
- data/lib/dm-rails/railties/controller_runtime.rb +45 -0
- data/lib/dm-rails/railties/database.rake +124 -0
- data/lib/dm-rails/railties/i18n_support.rb +12 -0
- data/lib/dm-rails/railties/log_subscriber.rb +31 -0
- data/lib/dm-rails/session_store.rb +61 -0
- data/lib/dm-rails/setup.rb +41 -0
- data/lib/dm-rails/storage.rb +165 -0
- data/lib/generators/data_mapper.rb +82 -0
- data/lib/generators/data_mapper/migration/migration_generator.rb +30 -0
- data/lib/generators/data_mapper/migration/templates/migration.rb +23 -0
- data/lib/generators/data_mapper/model/model_generator.rb +23 -0
- data/lib/generators/data_mapper/model/templates/model.rb +11 -0
- data/lib/generators/data_mapper/observer/observer_generator.rb +19 -0
- data/lib/generators/data_mapper/observer/templates/observer.rb +7 -0
- data/tasks/ci.rake +1 -0
- data/tasks/clean.rake +6 -0
- data/tasks/local_gemfile.rake +18 -0
- data/tasks/metrics.rake +37 -0
- data/tasks/yard.rake +9 -0
- data/tasks/yardstick.rake +20 -0
- metadata +171 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'generators/data_mapper'
|
2
|
+
|
3
|
+
module DataMapper
|
4
|
+
module Generators
|
5
|
+
|
6
|
+
class ModelGenerator < Base
|
7
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
8
|
+
|
9
|
+
check_class_collision
|
10
|
+
|
11
|
+
class_option :timestamps, :type => :boolean
|
12
|
+
class_option :parent, :type => :string, :desc => "The parent class for the generated model"
|
13
|
+
|
14
|
+
def create_model_file
|
15
|
+
template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
|
16
|
+
end
|
17
|
+
|
18
|
+
hook_for :test_framework
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class <%= class_name %><%= "< #{options[:parent].classify}" if options[:parent] %>
|
2
|
+
|
3
|
+
<% unless options[:parent] -%>
|
4
|
+
include DataMapper::Resource
|
5
|
+
|
6
|
+
property :id, Serial
|
7
|
+
<% end %>
|
8
|
+
<% attributes.each do |attribute| -%>
|
9
|
+
property :<%= attribute.name -%>, <%= attribute.type_class %>
|
10
|
+
<% end %>
|
11
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'generators/data_mapper'
|
2
|
+
|
3
|
+
module DataMapper
|
4
|
+
module Generators
|
5
|
+
|
6
|
+
class ObserverGenerator < Base
|
7
|
+
|
8
|
+
check_class_collision :suffix => "Observer"
|
9
|
+
|
10
|
+
def create_observer_file
|
11
|
+
template 'observer.rb', File.join('app/models', class_path, "#{file_name}_observer.rb")
|
12
|
+
end
|
13
|
+
|
14
|
+
hook_for :test_framework
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/tasks/ci.rake
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
task :ci => [ 'metrics:all' ]
|
data/tasks/clean.rake
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle foo)"
|
2
|
+
task :local_gemfile do |t|
|
3
|
+
|
4
|
+
root = Pathname(__FILE__).dirname.parent
|
5
|
+
datamapper = root.parent
|
6
|
+
|
7
|
+
source_regex = /DATAMAPPER = 'git:\/\/github.com\/datamapper'/
|
8
|
+
gem_source_regex = /:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/
|
9
|
+
|
10
|
+
root.join('Gemfile.local').open('w') do |f|
|
11
|
+
root.join('Gemfile').open.each do |line|
|
12
|
+
line.sub!(source_regex, "DATAMAPPER = '#{datamapper}'")
|
13
|
+
line.sub!(gem_source_regex, ':path => "#{DATAMAPPER}/\1"')
|
14
|
+
f.puts line
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/tasks/metrics.rake
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
begin
|
2
|
+
require 'metric_fu'
|
3
|
+
rescue LoadError
|
4
|
+
namespace :metrics do
|
5
|
+
task :all do
|
6
|
+
abort 'metric_fu is not available. In order to run metrics:all, you must: gem install metric_fu'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'reek/adapters/rake_task'
|
13
|
+
|
14
|
+
Reek::RakeTask.new do |t|
|
15
|
+
t.fail_on_error = true
|
16
|
+
t.verbose = false
|
17
|
+
t.source_files = 'lib/**/*.rb'
|
18
|
+
end
|
19
|
+
rescue LoadError
|
20
|
+
task :reek do
|
21
|
+
abort 'Reek is not available. In order to run reek, you must: gem install reek'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'roodi'
|
27
|
+
require 'rake/tasklib'
|
28
|
+
require 'roodi_task'
|
29
|
+
|
30
|
+
RoodiTask.new do |t|
|
31
|
+
t.verbose = false
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
task :roodi do
|
35
|
+
abort 'Roodi is not available. In order to run roodi, you must: gem install roodi'
|
36
|
+
end
|
37
|
+
end
|
data/tasks/yard.rake
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
begin
|
2
|
+
require 'pathname'
|
3
|
+
require 'yardstick'
|
4
|
+
require 'yardstick/rake/measurement'
|
5
|
+
require 'yardstick/rake/verify'
|
6
|
+
|
7
|
+
# yardstick_measure task
|
8
|
+
Yardstick::Rake::Measurement.new
|
9
|
+
|
10
|
+
# verify_measurements task
|
11
|
+
Yardstick::Rake::Verify.new do |verify|
|
12
|
+
verify.threshold = 100
|
13
|
+
end
|
14
|
+
rescue LoadError
|
15
|
+
%w[ yardstick_measure verify_measurements ].each do |name|
|
16
|
+
task name.to_s do
|
17
|
+
abort "Yardstick is not available. In order to run #{name}, you must: gem install yardstick"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dm-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: true
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- rc1
|
10
|
+
version: 1.0.0.rc1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Martin Gamsjaeger (snusnu)
|
14
|
+
- Dan Kubb
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-05-19 00:00:00 -07:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: dm-core
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 0
|
32
|
+
- 0
|
33
|
+
- rc1
|
34
|
+
version: 1.0.0.rc1
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: dm-active_model
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
- 4
|
47
|
+
version: "0.4"
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: activesupport
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
segments:
|
58
|
+
- 3
|
59
|
+
- 0
|
60
|
+
- 0
|
61
|
+
- beta3
|
62
|
+
version: 3.0.0.beta3
|
63
|
+
type: :runtime
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: actionpack
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ~>
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 3
|
74
|
+
- 0
|
75
|
+
- 0
|
76
|
+
- beta3
|
77
|
+
version: 3.0.0.beta3
|
78
|
+
type: :runtime
|
79
|
+
version_requirements: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: railties
|
82
|
+
prerelease: false
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
segments:
|
88
|
+
- 3
|
89
|
+
- 0
|
90
|
+
- 0
|
91
|
+
- beta3
|
92
|
+
version: 3.0.0.beta3
|
93
|
+
type: :runtime
|
94
|
+
version_requirements: *id005
|
95
|
+
description: Integrate DataMapper with Rails 3
|
96
|
+
email: gamsnjaga@gmail.com
|
97
|
+
executables: []
|
98
|
+
|
99
|
+
extensions: []
|
100
|
+
|
101
|
+
extra_rdoc_files:
|
102
|
+
- LICENSE
|
103
|
+
- README.rdoc
|
104
|
+
files:
|
105
|
+
- .document
|
106
|
+
- .gitignore
|
107
|
+
- Gemfile
|
108
|
+
- LICENSE
|
109
|
+
- README.rdoc
|
110
|
+
- Rakefile
|
111
|
+
- VERSION
|
112
|
+
- dm-rails.gemspec
|
113
|
+
- lib/dm-rails.rb
|
114
|
+
- lib/dm-rails/configuration.rb
|
115
|
+
- lib/dm-rails/middleware/identity_map.rb
|
116
|
+
- lib/dm-rails/railtie.rb
|
117
|
+
- lib/dm-rails/railties/benchmarking_mixin.rb
|
118
|
+
- lib/dm-rails/railties/controller_runtime.rb
|
119
|
+
- lib/dm-rails/railties/database.rake
|
120
|
+
- lib/dm-rails/railties/i18n_support.rb
|
121
|
+
- lib/dm-rails/railties/log_subscriber.rb
|
122
|
+
- lib/dm-rails/session_store.rb
|
123
|
+
- lib/dm-rails/setup.rb
|
124
|
+
- lib/dm-rails/storage.rb
|
125
|
+
- lib/generators/data_mapper.rb
|
126
|
+
- lib/generators/data_mapper/migration/migration_generator.rb
|
127
|
+
- lib/generators/data_mapper/migration/templates/migration.rb
|
128
|
+
- lib/generators/data_mapper/model/model_generator.rb
|
129
|
+
- lib/generators/data_mapper/model/templates/model.rb
|
130
|
+
- lib/generators/data_mapper/observer/observer_generator.rb
|
131
|
+
- lib/generators/data_mapper/observer/templates/observer.rb
|
132
|
+
- tasks/ci.rake
|
133
|
+
- tasks/clean.rake
|
134
|
+
- tasks/local_gemfile.rake
|
135
|
+
- tasks/metrics.rake
|
136
|
+
- tasks/yard.rake
|
137
|
+
- tasks/yardstick.rake
|
138
|
+
has_rdoc: true
|
139
|
+
homepage: http://github.com/datamapper/dm-rails
|
140
|
+
licenses: []
|
141
|
+
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options:
|
144
|
+
- --charset=UTF-8
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
segments:
|
152
|
+
- 0
|
153
|
+
version: "0"
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
segments:
|
159
|
+
- 1
|
160
|
+
- 3
|
161
|
+
- 1
|
162
|
+
version: 1.3.1
|
163
|
+
requirements: []
|
164
|
+
|
165
|
+
rubyforge_project:
|
166
|
+
rubygems_version: 1.3.6
|
167
|
+
signing_key:
|
168
|
+
specification_version: 3
|
169
|
+
summary: Use DataMapper with Rails 3
|
170
|
+
test_files: []
|
171
|
+
|