Skip to content

Commit 4cd2d3f

Browse files
committed
Push it
Currently it's possible to print formatted ruby source code for any DataMapper::Model by calling #to_ruby on it. The generated ruby source includes all property and relationship definitions.
0 parents  commit 4cd2d3f

21 files changed

+852
-0
lines changed

.document

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
README.rdoc
2+
lib/**/*.rb
3+
bin/*
4+
features/**/*.feature
5+
LICENSE

.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## MAC OS
2+
.DS_Store
3+
4+
## TEXTMATE
5+
*.tmproj
6+
tmtags
7+
8+
## EMACS
9+
*~
10+
\#*
11+
.\#*
12+
13+
## VIM
14+
*.swp
15+
16+
## PROJECT::GENERAL
17+
coverage
18+
rdoc
19+
pkg
20+
21+
## PROJECT::SPECIFIC

LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2009 snusnu
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.rdoc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
= dm-schema_reflector
2+
3+
Description goes here.
4+
5+
== Note on Patches/Pull Requests
6+
7+
* Fork the project.
8+
* Make your feature addition or bug fix.
9+
* Add tests for it. This is important so I don't break it in a
10+
future version unintentionally.
11+
* Commit, do not mess with rakefile, version, or history.
12+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13+
* Send me a pull request. Bonus points for topic branches.
14+
15+
== Copyright
16+
17+
Copyright (c) 2009 snusnu. See LICENSE for details.

Rakefile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
require 'rubygems'
2+
require 'rake'
3+
4+
begin
5+
6+
gem 'jeweler', '>= 1.4'
7+
require 'jeweler'
8+
9+
require File.expand_path('../lib/dm-reflection/version', __FILE__)
10+
11+
FileList['tasks/**/*.rake'].each { |task| load task }
12+
13+
Jeweler::Tasks.new do |gem|
14+
15+
gem.version = DataMapper::SchemaReflection::VERSION
16+
17+
gem.name = "dm-reflection"
18+
gem.summary = %Q{Generates datamapper models from existing database schemas}
19+
gem.description = %Q{Generates datamapper models from existing database schemas and export them to files}
20+
gem.email = "[email protected]"
21+
gem.homepage = "http://github.com/snusnu/dm-schema_reflection"
22+
gem.authors = ["Martin Gamsjaeger (snusnu)"]
23+
24+
gem.add_dependency 'dm-core', '~> 0.10.2'
25+
26+
gem.add_development_dependency 'rspec', '~> 1.2.9'
27+
gem.add_development_dependency 'yard', '~> 0.5'
28+
29+
end
30+
31+
Jeweler::GemcutterTasks.new
32+
33+
rescue LoadError
34+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
35+
end
36+
37+
task :spec => :check_dependencies
38+
task :default => :spec

dm-reflection.gemspec

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Generated by jeweler
2+
# DO NOT EDIT THIS FILE DIRECTLY
3+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4+
# -*- encoding: utf-8 -*-
5+
6+
Gem::Specification.new do |s|
7+
s.name = %q{dm-reflection}
8+
s.version = "0.0.1"
9+
10+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11+
s.authors = ["Martin Gamsjaeger (snusnu)"]
12+
s.date = %q{2009-12-25}
13+
s.description = %q{Generates datamapper models from existing database schemas and export them to files}
14+
s.email = %q{[email protected]}
15+
s.extra_rdoc_files = [
16+
"LICENSE",
17+
"README.rdoc"
18+
]
19+
s.files = [
20+
".document",
21+
".gitignore",
22+
"LICENSE",
23+
"README.rdoc",
24+
"Rakefile",
25+
"dm-reflection.gemspec",
26+
"dm-schema_reflection.gemspec",
27+
"lib/dm-reflection.rb",
28+
"lib/dm-reflection/builders/source_builder.rb",
29+
"lib/dm-reflection/version.rb",
30+
"measurements/report.txt",
31+
"spec/rcov.opts",
32+
"spec/source_builder_spec.rb",
33+
"spec/spec.opts",
34+
"spec/spec_helper.rb",
35+
"tasks/changelog.rake",
36+
"tasks/ci.rake",
37+
"tasks/metrics.rake",
38+
"tasks/spec.rake",
39+
"tasks/yard.rake",
40+
"tasks/yardstick.rake"
41+
]
42+
s.homepage = %q{http://github.com/snusnu/dm-schema_reflection}
43+
s.rdoc_options = ["--charset=UTF-8"]
44+
s.require_paths = ["lib"]
45+
s.rubygems_version = %q{1.3.5}
46+
s.summary = %q{Generates datamapper models from existing database schemas}
47+
s.test_files = [
48+
"spec/source_builder_spec.rb",
49+
"spec/spec_helper.rb"
50+
]
51+
52+
if s.respond_to? :specification_version then
53+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54+
s.specification_version = 3
55+
56+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
57+
s.add_runtime_dependency(%q<dm-core>, ["~> 0.10.2"])
58+
s.add_development_dependency(%q<rspec>, ["~> 1.2.9"])
59+
s.add_development_dependency(%q<yard>, ["~> 0.5"])
60+
else
61+
s.add_dependency(%q<dm-core>, ["~> 0.10.2"])
62+
s.add_dependency(%q<rspec>, ["~> 1.2.9"])
63+
s.add_dependency(%q<yard>, ["~> 0.5"])
64+
end
65+
else
66+
s.add_dependency(%q<dm-core>, ["~> 0.10.2"])
67+
s.add_dependency(%q<rspec>, ["~> 1.2.9"])
68+
s.add_dependency(%q<yard>, ["~> 0.5"])
69+
end
70+
end
71+

dm-schema_reflection.gemspec

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Generated by jeweler
2+
# DO NOT EDIT THIS FILE DIRECTLY
3+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4+
# -*- encoding: utf-8 -*-
5+
6+
Gem::Specification.new do |s|
7+
s.name = %q{dm-schema_reflection}
8+
s.version = "0.0.1"
9+
10+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11+
s.authors = ["Martin Gamsjaeger (snusnu)"]
12+
s.date = %q{2009-12-25}
13+
s.description = %q{Generates datamapper models from existing database schemas and export them to files}
14+
s.email = %q{[email protected]}
15+
s.extra_rdoc_files = [
16+
"LICENSE",
17+
"README.rdoc"
18+
]
19+
s.files = [
20+
".document",
21+
".gitignore",
22+
"LICENSE",
23+
"README.rdoc",
24+
"Rakefile",
25+
"lib/dm-schema_reflection.rb",
26+
"lib/dm-schema_reflection/ruby_builder.rb",
27+
"lib/dm-schema_reflection/schema_reflection.rb",
28+
"lib/dm-schema_reflection/version.rb",
29+
"measurements/report.txt",
30+
"spec/rcov.opts",
31+
"spec/ruby_builder_spec.rb",
32+
"spec/spec.opts",
33+
"spec/spec_helper.rb",
34+
"tasks/changelog.rake",
35+
"tasks/ci.rake",
36+
"tasks/metrics.rake",
37+
"tasks/spec.rake",
38+
"tasks/yard.rake",
39+
"tasks/yardstick.rake"
40+
]
41+
s.homepage = %q{http://github.com/snusnu/dm-schema_reflection}
42+
s.rdoc_options = ["--charset=UTF-8"]
43+
s.require_paths = ["lib"]
44+
s.rubygems_version = %q{1.3.5}
45+
s.summary = %q{Generates datamapper models from existing database schemas}
46+
s.test_files = [
47+
"spec/ruby_builder_spec.rb",
48+
"spec/spec_helper.rb"
49+
]
50+
51+
if s.respond_to? :specification_version then
52+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
53+
s.specification_version = 3
54+
55+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
56+
s.add_runtime_dependency(%q<dm-core>, ["~> 0.10.2"])
57+
s.add_development_dependency(%q<rspec>, ["~> 1.2.9"])
58+
s.add_development_dependency(%q<yard>, ["~> 0.5"])
59+
else
60+
s.add_dependency(%q<dm-core>, ["~> 0.10.2"])
61+
s.add_dependency(%q<rspec>, ["~> 1.2.9"])
62+
s.add_dependency(%q<yard>, ["~> 0.5"])
63+
end
64+
else
65+
s.add_dependency(%q<dm-core>, ["~> 0.10.2"])
66+
s.add_dependency(%q<rspec>, ["~> 1.2.9"])
67+
s.add_dependency(%q<yard>, ["~> 0.5"])
68+
end
69+
end
70+

lib/dm-reflection.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)