mack-data_mapper 0.5.1 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/configuration.rb +22 -0
- data/lib/helpers/orm_helpers.rb +5 -5
- data/lib/mack-data_mapper.rb +4 -15
- data/lib/persistence.rb +9 -0
- data/lib/scaffold_generator/scaffold_generator.rb +1 -1
- data/lib/scaffold_generator/templates/app/controllers/controller.rb.template +9 -9
- data/lib/scaffold_generator/templates/app/views/edit.html.erb.template +1 -1
- data/lib/scaffold_generator/templates/app/views/index.html.erb.template +3 -3
- data/lib/scaffold_generator/templates/app/views/show.html.erb.template +1 -1
- data/lib/tasks/db_create_drop_tasks.rake +76 -0
- data/lib/tasks/{db_tasks.rake → db_migration_tasks.rake} +8 -3
- data/test/database.yml +1 -1
- data/test/fixtures/zoo_no_cols/edit.html.erb.fixture +1 -1
- data/test/fixtures/zoo_no_cols/index.html.erb.fixture +3 -3
- data/test/fixtures/zoo_no_cols/show.html.erb.fixture +1 -1
- data/test/fixtures/zoo_with_cols/edit.html.erb.fixture +1 -1
- data/test/fixtures/zoo_with_cols/index.html.erb.fixture +3 -3
- data/test/fixtures/zoo_with_cols/show.html.erb.fixture +1 -1
- data/test/fixtures/zoo_with_cols/zoos_controller.rb.fixture +9 -9
- data/test/generators/scaffold_generator_test.rb +5 -5
- data/test/tasks/{db_tasks_test.rb → db_migration_tasks_test.rb} +2 -2
- data/test/test_helper.rb +22 -9
- metadata +7 -4
@@ -0,0 +1,22 @@
|
|
1
|
+
module Mack
|
2
|
+
module Configuration
|
3
|
+
|
4
|
+
def self.load_database_configurations(env = Mack::Configuration.env)
|
5
|
+
dbs = Mack::Configuration.database_configurations
|
6
|
+
unless dbs.nil?
|
7
|
+
settings = dbs[env]
|
8
|
+
settings.symbolize_keys!
|
9
|
+
if settings[:default]
|
10
|
+
settings.each do |k,v|
|
11
|
+
DataMapper::Database.setup(k, v.symbolize_keys)
|
12
|
+
end
|
13
|
+
else
|
14
|
+
DataMapper::Database.setup(settings)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end # load_database_configurations
|
18
|
+
|
19
|
+
end # Configuration
|
20
|
+
end # Mack
|
21
|
+
|
22
|
+
Mack::Configuration.load_database_configurations
|
data/lib/helpers/orm_helpers.rb
CHANGED
@@ -26,16 +26,16 @@ module Mack
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
app_errors.flatten!
|
29
|
-
File.join(
|
29
|
+
File.join(Mack::Configuration.views_directory, "application", "_error_messages.html.erb")
|
30
30
|
unless app_errors.empty?
|
31
31
|
if view_partial.nil?
|
32
|
-
if File.exist?(File.join(
|
33
|
-
render
|
32
|
+
if File.exist?(File.join(Mack::Configuration.views_directory, "application", "_error_messages.html.erb"))
|
33
|
+
render(:partial, "application/error_messages", :locals => {:errors => app_errors})
|
34
34
|
else
|
35
|
-
render
|
35
|
+
render(:text, DEFAULT_PARTIAL, :locals => {:errors => app_errors})
|
36
36
|
end
|
37
37
|
else
|
38
|
-
render
|
38
|
+
render(:partial, view_partial, :locals => {:errors => app_errors})
|
39
39
|
end
|
40
40
|
else
|
41
41
|
""
|
data/lib/mack-data_mapper.rb
CHANGED
@@ -9,24 +9,13 @@ end
|
|
9
9
|
gem("datamapper", "0.3.2")
|
10
10
|
require 'data_mapper'
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
settings.symbolize_keys!
|
17
|
-
if settings[:default]
|
18
|
-
settings.each do |k,v|
|
19
|
-
DataMapper::Database.setup(k, v.symbolize_keys)
|
20
|
-
end
|
21
|
-
else
|
22
|
-
DataMapper::Database.setup(settings)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
12
|
+
fl = File.dirname(__FILE__)
|
13
|
+
require File.join(fl, "persistence")
|
14
|
+
require File.join(fl, "configuration")
|
15
|
+
Mack::Configuration.load_database_configurations
|
26
16
|
class SchemaInfo # :nodoc:
|
27
17
|
include DataMapper::Persistence
|
28
18
|
|
29
|
-
set_table_name "schema_info"
|
30
19
|
property :version, :integer, :default => 0
|
31
20
|
end
|
32
21
|
|
data/lib/persistence.rb
ADDED
@@ -20,7 +20,7 @@ class ScaffoldGenerator < Genosaurus
|
|
20
20
|
|
21
21
|
def update_routes_file
|
22
22
|
# update routes.rb
|
23
|
-
routes = File.join(
|
23
|
+
routes = File.join(Mack::Configuration.config_directory, "routes.rb")
|
24
24
|
rf = File.open(routes).read
|
25
25
|
unless rf.match(".resource :#{@name_plural}")
|
26
26
|
puts "Updating routes.rb"
|
@@ -2,12 +2,12 @@ class <%= @name_plural_camel %>Controller < Mack::Controller::Base
|
|
2
2
|
|
3
3
|
# GET /<%= @name_plural %>
|
4
4
|
def index
|
5
|
-
@<%= @name_plural %> = <%= @name_singular_camel %>.
|
5
|
+
@<%= @name_plural %> = <%= @name_singular_camel %>.all
|
6
6
|
end
|
7
7
|
|
8
8
|
# GET /<%= @name_plural %>/1
|
9
9
|
def show
|
10
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.
|
10
|
+
@<%= @name_singular %> = <%= @name_singular_camel %>.first(params(:id))
|
11
11
|
end
|
12
12
|
|
13
13
|
# GET /<%= @name_plural %>/new
|
@@ -17,32 +17,32 @@ class <%= @name_plural_camel %>Controller < Mack::Controller::Base
|
|
17
17
|
|
18
18
|
# GET /<%= @name_plural %>/1/edit
|
19
19
|
def edit
|
20
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.
|
20
|
+
@<%= @name_singular %> = <%= @name_singular_camel %>.first(params(:id))
|
21
21
|
end
|
22
22
|
|
23
23
|
# POST /<%= @name_plural %>
|
24
24
|
def create
|
25
25
|
@<%= @name_singular %> = <%= @name_singular_camel %>.new(params(:<%= @name_singular %>))
|
26
26
|
if @<%= @name_singular %>.save
|
27
|
-
redirect_to(<%= @name_plural %>_show_url(:id => @<%= @name_singular
|
27
|
+
redirect_to(<%= @name_plural %>_show_url(:id => @<%= @name_singular %>))
|
28
28
|
else
|
29
|
-
render(:action
|
29
|
+
render(:action, "new")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
# PUT /<%= @name_plural %>/1
|
34
34
|
def update
|
35
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.
|
35
|
+
@<%= @name_singular %> = <%= @name_singular_camel %>.first(params(:id))
|
36
36
|
if @<%= @name_singular %>.update_attributes(params(:<%= @name_singular %>))
|
37
|
-
redirect_to(<%= @name_plural %>_show_url(:id => @<%= @name_singular
|
37
|
+
redirect_to(<%= @name_plural %>_show_url(:id => @<%= @name_singular %>))
|
38
38
|
else
|
39
|
-
render(:action
|
39
|
+
render(:action, "edit")
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
# DELETE /<%= @name_plural %>/1
|
44
44
|
def delete
|
45
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.
|
45
|
+
@<%= @name_singular %> = <%= @name_singular_camel %>.first(params(:id))
|
46
46
|
@<%= @name_singular %>.destroy!
|
47
47
|
redirect_to(<%= @name_plural %>_index_url)
|
48
48
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<%%= error_messages_for :<%= @name_singular %> %>
|
4
4
|
|
5
|
-
<%% form(<%= @name_singular %>s_update_url(:id => @<%= @name_singular
|
5
|
+
<%% form(<%= @name_singular %>s_update_url(:id => @<%= @name_singular %>), :class => "edit_<%= @name_singular %>", :id => "edit_<%= @name_singular %>", :method => :put) do %>
|
6
6
|
<% for column in columns -%>
|
7
7
|
<% unless column.column_name == "created_at" || column.column_name == "updated_at" -%>
|
8
8
|
<p>
|
@@ -29,9 +29,9 @@ else
|
|
29
29
|
-%>
|
30
30
|
<td> </td>
|
31
31
|
<% end -%>
|
32
|
-
<td><%%= link_to("Show", <%= @name_plural %>_show_url(:id => <%= @name_singular
|
33
|
-
<td><%%= link_to("Edit", <%= @name_plural %>_edit_url(:id => <%= @name_singular
|
34
|
-
<td><%%= link_to("Delete", <%= @name_plural %>_delete_url(:id => <%= @name_singular
|
32
|
+
<td><%%= link_to("Show", <%= @name_plural %>_show_url(:id => <%= @name_singular %>)) %></td>
|
33
|
+
<td><%%= link_to("Edit", <%= @name_plural %>_edit_url(:id => <%= @name_singular %>)) %></td>
|
34
|
+
<td><%%= link_to("Delete", <%= @name_plural %>_delete_url(:id => <%= @name_singular %>), :method => :delete, :confirm => "Are you sure?") %></td>
|
35
35
|
</tr>
|
36
36
|
<%% end %>
|
37
37
|
</table>
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'rake'
|
2
|
+
namespace :db do
|
3
|
+
|
4
|
+
desc "Create the database for your environment."
|
5
|
+
task :create => :environment do
|
6
|
+
Mack::Configuration.load_database_configurations(Mack::Configuration.env)
|
7
|
+
database(:default) do
|
8
|
+
drop_create_database
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :create do
|
13
|
+
|
14
|
+
desc "Creates your Full environment. Does NOT create your production database!"
|
15
|
+
task :all => :environment do
|
16
|
+
Mack::Configuration.load_database_configurations("test")
|
17
|
+
database(:default) do
|
18
|
+
drop_create_database
|
19
|
+
end
|
20
|
+
Mack::Configuration.load_database_configurations("development")
|
21
|
+
database(:default) do
|
22
|
+
drop_create_database
|
23
|
+
end
|
24
|
+
Rake::Task["db:migrate"].invoke
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def drop_create_database
|
33
|
+
configuration = database.adapter.instance_variable_get('@configuration')
|
34
|
+
case database.adapter.class.name
|
35
|
+
when "DataMapper::Adapters::MysqlAdapter"
|
36
|
+
DataMapper::Database.setup(:tmp, {
|
37
|
+
:adapter => "mysql",
|
38
|
+
:host => "localhost",
|
39
|
+
:database => "mysql",
|
40
|
+
:username => ENV["DB_USERNAME"] || "root",
|
41
|
+
:password => ENV["DB_PASSWORD"] || ""
|
42
|
+
})
|
43
|
+
database(:tmp) do
|
44
|
+
puts "Dropping (MySQL): #{configuration.database}"
|
45
|
+
database.execute "DROP DATABASE IF EXISTS `#{configuration.database}`"
|
46
|
+
puts "Creating (MySQL): #{configuration.database}"
|
47
|
+
database.execute "CREATE DATABASE `#{configuration.database}` DEFAULT CHARACTER SET `utf8`"
|
48
|
+
begin
|
49
|
+
database.adapter.flush_connections!
|
50
|
+
rescue Exception => e
|
51
|
+
end
|
52
|
+
end
|
53
|
+
when "DataMapper::Adapters::PostgresqlAdapter"
|
54
|
+
ENV['PGHOST'] = configuration.host if configuration.host
|
55
|
+
ENV['PGPORT'] = configuration.port.to_s if configuration.port
|
56
|
+
ENV['PGPASSWORD'] = configuration.password.to_s if configuration.password
|
57
|
+
|
58
|
+
database.adapter.flush_connections!
|
59
|
+
begin
|
60
|
+
puts "Dropping (PostgreSQL): #{configuration.database}"
|
61
|
+
`dropdb -U "#{configuration.username}" #{configuration.database}`
|
62
|
+
rescue Exception => e
|
63
|
+
end
|
64
|
+
|
65
|
+
begin
|
66
|
+
puts "Creating (PostgreSQL): #{configuration.database}"
|
67
|
+
`createdb -U "#{configuration.username}" #{configuration.database}`
|
68
|
+
rescue Exception => e
|
69
|
+
end
|
70
|
+
when 'DataMapper::Adapters::Sqlite3Adapter'
|
71
|
+
puts "Dropping (SQLite3): #{configuration.database}"
|
72
|
+
FileUtils.rm_rf(configuration.database)
|
73
|
+
else
|
74
|
+
raise "Task not supported for '#{database.adapter}'"
|
75
|
+
end
|
76
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rake'
|
1
2
|
namespace :db do
|
2
3
|
|
3
4
|
desc "Migrate the database through scripts in db/migrations"
|
@@ -54,8 +55,12 @@ namespace :db do
|
|
54
55
|
task :create => "mack:environment" do
|
55
56
|
require 'data_mapper/migration'
|
56
57
|
unless SchemaInfo.table.exists?
|
57
|
-
SchemaInfo
|
58
|
-
|
58
|
+
class SchemaInfo
|
59
|
+
include DataMapper::Persistence
|
60
|
+
property :version, :integer
|
61
|
+
end
|
62
|
+
SchemaInfo.auto_migrate!
|
63
|
+
SchemaInfo.create(:version => 0, :id => 1)
|
59
64
|
end
|
60
65
|
@schema_info = SchemaInfo.first
|
61
66
|
end # create
|
@@ -64,7 +69,7 @@ namespace :db do
|
|
64
69
|
|
65
70
|
|
66
71
|
def migration_files
|
67
|
-
Dir.glob(File.join(
|
72
|
+
Dir.glob(File.join(Mack::Configuration.root, "db", "migrations", "*.rb"))
|
68
73
|
end
|
69
74
|
|
70
75
|
def migration_number(migration)
|
data/test/database.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<%= error_messages_for :zoo %>
|
4
4
|
|
5
|
-
<% form(zoos_update_url(:id => @zoo
|
5
|
+
<% form(zoos_update_url(:id => @zoo), :class => "edit_zoo", :id => "edit_zoo", :method => :put) do %>
|
6
6
|
<p>
|
7
7
|
<input id="zoo_submit" name="commit" type="submit" value="Update" />
|
8
8
|
</p>
|
@@ -8,9 +8,9 @@
|
|
8
8
|
<% for zoo in @zoos %>
|
9
9
|
<tr>
|
10
10
|
<td> </td>
|
11
|
-
<td><%= link_to("Show", zoos_show_url(:id => zoo
|
12
|
-
<td><%= link_to("Edit", zoos_edit_url(:id => zoo
|
13
|
-
<td><%= link_to("Delete", zoos_delete_url(:id => zoo
|
11
|
+
<td><%= link_to("Show", zoos_show_url(:id => zoo)) %></td>
|
12
|
+
<td><%= link_to("Edit", zoos_edit_url(:id => zoo)) %></td>
|
13
|
+
<td><%= link_to("Delete", zoos_delete_url(:id => zoo), :method => :delete, :confirm => "Are you sure?") %></td>
|
14
14
|
</tr>
|
15
15
|
<% end %>
|
16
16
|
</table>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<%= error_messages_for :zoo %>
|
4
4
|
|
5
|
-
<% form(zoos_update_url(:id => @zoo
|
5
|
+
<% form(zoos_update_url(:id => @zoo), :class => "edit_zoo", :id => "edit_zoo", :method => :put) do %>
|
6
6
|
<p>
|
7
7
|
<b>Name</b><br />
|
8
8
|
<input type="text" name="zoo[name]" id="zoo_name" size="30" value="<%= @zoo.name %>" />
|
@@ -14,9 +14,9 @@
|
|
14
14
|
<td><%= zoo.description %></td>
|
15
15
|
<td><%= zoo.created_at %></td>
|
16
16
|
<td><%= zoo.updated_at %></td>
|
17
|
-
<td><%= link_to("Show", zoos_show_url(:id => zoo
|
18
|
-
<td><%= link_to("Edit", zoos_edit_url(:id => zoo
|
19
|
-
<td><%= link_to("Delete", zoos_delete_url(:id => zoo
|
17
|
+
<td><%= link_to("Show", zoos_show_url(:id => zoo)) %></td>
|
18
|
+
<td><%= link_to("Edit", zoos_edit_url(:id => zoo)) %></td>
|
19
|
+
<td><%= link_to("Delete", zoos_delete_url(:id => zoo), :method => :delete, :confirm => "Are you sure?") %></td>
|
20
20
|
</tr>
|
21
21
|
<% end %>
|
22
22
|
</table>
|
@@ -2,12 +2,12 @@ class ZoosController < Mack::Controller::Base
|
|
2
2
|
|
3
3
|
# GET /zoos
|
4
4
|
def index
|
5
|
-
@zoos = Zoo.
|
5
|
+
@zoos = Zoo.all
|
6
6
|
end
|
7
7
|
|
8
8
|
# GET /zoos/1
|
9
9
|
def show
|
10
|
-
@zoo = Zoo.
|
10
|
+
@zoo = Zoo.first(params(:id))
|
11
11
|
end
|
12
12
|
|
13
13
|
# GET /zoos/new
|
@@ -17,32 +17,32 @@ class ZoosController < Mack::Controller::Base
|
|
17
17
|
|
18
18
|
# GET /zoos/1/edit
|
19
19
|
def edit
|
20
|
-
@zoo = Zoo.
|
20
|
+
@zoo = Zoo.first(params(:id))
|
21
21
|
end
|
22
22
|
|
23
23
|
# POST /zoos
|
24
24
|
def create
|
25
25
|
@zoo = Zoo.new(params(:zoo))
|
26
26
|
if @zoo.save
|
27
|
-
redirect_to(zoos_show_url(:id => @zoo
|
27
|
+
redirect_to(zoos_show_url(:id => @zoo))
|
28
28
|
else
|
29
|
-
render(:action
|
29
|
+
render(:action, "new")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
# PUT /zoos/1
|
34
34
|
def update
|
35
|
-
@zoo = Zoo.
|
35
|
+
@zoo = Zoo.first(params(:id))
|
36
36
|
if @zoo.update_attributes(params(:zoo))
|
37
|
-
redirect_to(zoos_show_url(:id => @zoo
|
37
|
+
redirect_to(zoos_show_url(:id => @zoo))
|
38
38
|
else
|
39
|
-
render(:action
|
39
|
+
render(:action, "edit")
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
# DELETE /zoos/1
|
44
44
|
def delete
|
45
|
-
@zoo = Zoo.
|
45
|
+
@zoo = Zoo.first(params(:id))
|
46
46
|
@zoo.destroy!
|
47
47
|
redirect_to(zoos_index_url)
|
48
48
|
end
|
@@ -4,7 +4,7 @@ class ScaffoldGeneratorTest < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
def test_generate_data_mapper
|
6
6
|
sg = ScaffoldGenerator.run("name" => "zoo")
|
7
|
-
File.open(File.join(
|
7
|
+
File.open(File.join(Mack::Configuration.config_directory, "routes.rb")) do |f|
|
8
8
|
assert_match "r.resource :zoos # Added by rake generate:scaffold name=zoo", f.read
|
9
9
|
end
|
10
10
|
|
@@ -24,7 +24,7 @@ class ScaffoldGeneratorTest < Test::Unit::TestCase
|
|
24
24
|
|
25
25
|
def test_generate_data_mapper_with_columns
|
26
26
|
sg = ScaffoldGenerator.run("name" => "zoo", "cols" => "name:string,description:text,created_at:datetime,updated_at:datetime")
|
27
|
-
File.open(File.join(
|
27
|
+
File.open(File.join(Mack::Configuration.config_directory, "routes.rb")) do |f|
|
28
28
|
assert_match "r.resource :zoos # Added by rake generate:scaffold name=zoo", f.read
|
29
29
|
end
|
30
30
|
assert File.exists?(views_directory)
|
@@ -43,15 +43,15 @@ class ScaffoldGeneratorTest < Test::Unit::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def views_directory
|
46
|
-
File.join(
|
46
|
+
File.join(Mack::Configuration.views_directory, "zoos")
|
47
47
|
end
|
48
48
|
|
49
49
|
def model_file
|
50
|
-
File.join(
|
50
|
+
File.join(Mack::Configuration.app_directory, "models", "zoo.rb")
|
51
51
|
end
|
52
52
|
|
53
53
|
def controller_file
|
54
|
-
File.join(
|
54
|
+
File.join(Mack::Configuration.app_directory, "controllers", "zoos_controller.rb")
|
55
55
|
end
|
56
56
|
|
57
57
|
def migration_file
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
2
|
|
3
|
-
class
|
3
|
+
class DbMigrationTasksTest < Test::Unit::TestCase
|
4
4
|
|
5
|
-
$current_rake_task = File.join(File.dirname(__FILE__), "..", "..", "lib", "tasks", "
|
5
|
+
$current_rake_task = File.join(File.dirname(__FILE__), "..", "..", "lib", "tasks", "db_migration_tasks.rake")
|
6
6
|
|
7
7
|
def test_db_rollback
|
8
8
|
test_db_migrate
|
data/test/test_helper.rb
CHANGED
@@ -1,17 +1,30 @@
|
|
1
1
|
require "test/unit"
|
2
2
|
require File.join(File.dirname(__FILE__), "..", "..", "test_helpers")
|
3
|
+
require 'rubygems'
|
4
|
+
require 'genosaurus'
|
5
|
+
module Mack
|
6
|
+
module Configuration
|
7
|
+
def self.method_missing(sym, *args)
|
8
|
+
ev = "_mack_#{sym}".downcase
|
9
|
+
return ENV[ev]
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.set(name, value)
|
13
|
+
ENV["_mack_#{name.to_s.downcase}"] = value
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
3
17
|
|
4
18
|
$genosaurus_output_directory = File.join(File.dirname(__FILE__), "..", "tmp")
|
5
19
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
20
|
+
ENV["_mack_config_directory"] = File.dirname(__FILE__)
|
21
|
+
ENV["_mack_root"] = $genosaurus_output_directory
|
22
|
+
ENV["_mack_app_directory"] = File.join($genosaurus_output_directory, "app")
|
23
|
+
ENV["_mack_env"] = "test"
|
24
|
+
ENV["_mack_views_directory"] = File.join(ENV["_mack_app_directory"], "views")
|
11
25
|
|
12
|
-
require File.join(File.dirname(__FILE__), "..", "lib", "mack-data_mapper")
|
13
26
|
require File.join(File.dirname(__FILE__), "..", "..", "mack-orm_common", "lib", "mack-orm_common")
|
14
|
-
|
27
|
+
require File.join(File.dirname(__FILE__), "..", "lib", "mack-data_mapper")
|
15
28
|
|
16
29
|
load File.join(File.dirname(__FILE__), "lib", "user.rb")
|
17
30
|
|
@@ -23,7 +36,7 @@ class Test::Unit::TestCase
|
|
23
36
|
def cleanup
|
24
37
|
database.adapter.flush_connections!
|
25
38
|
FileUtils.rm_rf($genosaurus_output_directory)
|
26
|
-
FileUtils.rm_rf(File.join(
|
39
|
+
FileUtils.rm_rf(File.join(Mack::Configuration.config_directory, "routes.rb"))
|
27
40
|
end
|
28
41
|
|
29
42
|
def teardown
|
@@ -35,7 +48,7 @@ class Test::Unit::TestCase
|
|
35
48
|
[$genosaurus_output_directory, migrations_directory, models_directory].each do |d|
|
36
49
|
FileUtils.mkdir_p(d)
|
37
50
|
end
|
38
|
-
FileUtils.cp(fixture_path("routes.rb"), File.join(
|
51
|
+
FileUtils.cp(fixture_path("routes.rb"), File.join(Mack::Configuration.config_directory, "routes.rb"))
|
39
52
|
end
|
40
53
|
|
41
54
|
def migrations_directory
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mack-data_mapper
|
3
3
|
version: &id001 !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
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-05-
|
12
|
+
date: 2008-05-21 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -38,6 +38,7 @@ extensions: []
|
|
38
38
|
extra_rdoc_files: []
|
39
39
|
|
40
40
|
files:
|
41
|
+
- lib/configuration.rb
|
41
42
|
- lib/helpers/orm_helpers.rb
|
42
43
|
- lib/mack-data_mapper.rb
|
43
44
|
- lib/mack-data_mapper_tasks.rb
|
@@ -47,6 +48,7 @@ files:
|
|
47
48
|
- lib/model_generator/model_generator.rb
|
48
49
|
- lib/model_generator/templates/model.rb.template
|
49
50
|
- lib/model_generator/templates/test.rb.template
|
51
|
+
- lib/persistence.rb
|
50
52
|
- lib/scaffold_generator/manifest.yml
|
51
53
|
- lib/scaffold_generator/scaffold_generator.rb
|
52
54
|
- lib/scaffold_generator/templates/app/controllers/controller.rb.template
|
@@ -55,7 +57,8 @@ files:
|
|
55
57
|
- lib/scaffold_generator/templates/app/views/new.html.erb.template
|
56
58
|
- lib/scaffold_generator/templates/app/views/show.html.erb.template
|
57
59
|
- lib/scaffold_generator/templates/test.rb.template
|
58
|
-
- lib/tasks/
|
60
|
+
- lib/tasks/db_create_drop_tasks.rake
|
61
|
+
- lib/tasks/db_migration_tasks.rake
|
59
62
|
- README
|
60
63
|
has_rdoc: true
|
61
64
|
homepage:
|
@@ -112,5 +115,5 @@ test_files:
|
|
112
115
|
- test/lib
|
113
116
|
- test/lib/user.rb
|
114
117
|
- test/tasks
|
115
|
-
- test/tasks/
|
118
|
+
- test/tasks/db_migration_tasks_test.rb
|
116
119
|
- test/test_helper.rb
|