mack-orm 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +3 -0
- data/doc/classes/Mack.html +131 -0
- data/doc/classes/Mack/Database.html +323 -0
- data/doc/classes/Mack/Database/Generators.html +140 -0
- data/doc/classes/Mack/Database/Migrations.html +250 -0
- data/doc/classes/Mack/ViewHelpers/OrmHelpers.html +105 -0
- data/doc/classes/ScaffoldGenerator.html +159 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +111 -0
- data/doc/files/lib/mack-orm/database_migrations_rb.html +101 -0
- data/doc/files/lib/mack-orm/database_rb.html +101 -0
- data/doc/files/lib/mack-orm/generators_rb.html +101 -0
- data/doc/files/lib/mack-orm/genosaurus_helpers_rb.html +101 -0
- data/doc/files/lib/mack-orm/model_column_rb.html +101 -0
- data/doc/files/lib/mack-orm/orm_helpers_rb.html +101 -0
- data/doc/files/lib/mack-orm/scaffold_generator/scaffold_generator_rb.html +114 -0
- data/doc/files/lib/mack-orm_rb.html +109 -0
- data/doc/files/lib/mack-orm_tasks_rb.html +101 -0
- data/doc/fr_class_index.html +32 -0
- data/doc/fr_file_index.html +36 -0
- data/doc/fr_method_index.html +40 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/mack-orm.rb +11 -0
- data/lib/mack-orm/database.rb +42 -0
- data/lib/mack-orm/database_migrations.rb +31 -0
- data/lib/mack-orm/generators.rb +11 -0
- data/lib/mack-orm/genosaurus_helpers.rb +40 -0
- data/lib/mack-orm/model_column.rb +50 -0
- data/lib/mack-orm/orm_helpers.rb +28 -0
- data/lib/mack-orm/scaffold_generator/manifest.yml +31 -0
- data/lib/mack-orm/scaffold_generator/scaffold_generator.rb +48 -0
- data/lib/mack-orm/scaffold_generator/templates/app/controllers/controller.rb.template +51 -0
- data/lib/mack-orm/scaffold_generator/templates/app/views/edit.html.erb.template +18 -0
- data/lib/mack-orm/scaffold_generator/templates/app/views/index.html.erb.template +41 -0
- data/lib/mack-orm/scaffold_generator/templates/app/views/new.html.erb.template +18 -0
- data/lib/mack-orm/scaffold_generator/templates/app/views/show.html.erb.template +12 -0
- data/lib/mack-orm/scaffold_generator/templates/test/controllers/rspec.rb.template +47 -0
- data/lib/mack-orm/scaffold_generator/templates/test/controllers/test_case.rb.template +9 -0
- data/lib/mack-orm/tasks/db_create_drop_tasks.rake +72 -0
- data/lib/mack-orm/tasks/db_migration_tasks.rake +18 -0
- data/lib/mack-orm/tasks/test_tasks.rake +29 -0
- data/lib/mack-orm_tasks.rb +3 -0
- metadata +96 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
2
|
+
|
3
|
+
describe <%= @name_plural_camel %>Controller do
|
4
|
+
|
5
|
+
describe "index" do
|
6
|
+
|
7
|
+
it "should list <%= @name_plural %>"
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "show" do
|
12
|
+
|
13
|
+
it "should show a <%= @name_singular %>"
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "new" do
|
18
|
+
|
19
|
+
it "should show a form to create a new <%= @name_singular %>"
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "edit" do
|
24
|
+
|
25
|
+
it "should edit a <%= @name_singular %>"
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "create" do
|
30
|
+
|
31
|
+
it "should create a <%= @name_singular %>"
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "update" do
|
36
|
+
|
37
|
+
it "should update a <%= @name_singular %>"
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "delete" do
|
42
|
+
|
43
|
+
it "should delete a <%= @name_singular %>"
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'rake'
|
2
|
+
namespace :db do
|
3
|
+
|
4
|
+
desc "Drops (if it exists) the database and then creates it for your environment."
|
5
|
+
task :recreate => :environment do
|
6
|
+
Mack::Database.drop(Mack.env, repis)
|
7
|
+
Mack::Database.create(Mack.env, repis)
|
8
|
+
end # recreate
|
9
|
+
|
10
|
+
desc "Creates the database for your environment."
|
11
|
+
task :create => :environment do
|
12
|
+
Mack::Database.create(Mack.env, repis)
|
13
|
+
end # create
|
14
|
+
|
15
|
+
desc "Drops the database for your environment."
|
16
|
+
task :drop => :environment do
|
17
|
+
Mack::Database.drop(Mack.env, repis)
|
18
|
+
end # drop
|
19
|
+
|
20
|
+
namespace :create do
|
21
|
+
|
22
|
+
desc "Creates your test and development databases. Does NOT create your production database!"
|
23
|
+
task :all => :environment do
|
24
|
+
Mack::Database.create("test", repis)
|
25
|
+
Mack::Database.create("development", repis)
|
26
|
+
end # all
|
27
|
+
|
28
|
+
end # create
|
29
|
+
|
30
|
+
namespace :drop do
|
31
|
+
|
32
|
+
desc "Drops your test and development databases. Does NOT create your production database!"
|
33
|
+
task :all => :environment do
|
34
|
+
Mack::Database.drop("test", repis)
|
35
|
+
Mack::Database.drop("development", repis)
|
36
|
+
end # all
|
37
|
+
|
38
|
+
end # drop
|
39
|
+
|
40
|
+
namespace :recreate do
|
41
|
+
|
42
|
+
desc "Drops and creates your test and development databases. Does NOT create your production database!"
|
43
|
+
task :all => :environment do
|
44
|
+
Mack::Database.drop("test", repis)
|
45
|
+
Mack::Database.create("test", repis)
|
46
|
+
Mack::Database.drop("development", repis)
|
47
|
+
Mack::Database.create("development", repis)
|
48
|
+
end # all
|
49
|
+
|
50
|
+
end # recreate
|
51
|
+
|
52
|
+
namespace :structure do
|
53
|
+
|
54
|
+
desc "Dump the database structure to a SQL file"
|
55
|
+
task :dump => "mack:environment" do
|
56
|
+
Mack::Database.dump_structure(Mack.env, repis)
|
57
|
+
end # dump
|
58
|
+
|
59
|
+
desc "Create the database from a SQL file"
|
60
|
+
task :load => "mack:environment" do
|
61
|
+
file = (ENV["FILE"] ||= File.join(Mack.root, "db", "development_default_schema_structure.sql"))
|
62
|
+
Mack::Database.load_structure(file, Mack.env, repis)
|
63
|
+
end # load
|
64
|
+
|
65
|
+
end # structure
|
66
|
+
|
67
|
+
private
|
68
|
+
def repis
|
69
|
+
(ENV["REPO"] ||= "default").to_sym
|
70
|
+
end
|
71
|
+
|
72
|
+
end # db
|
@@ -0,0 +1,18 @@
|
|
1
|
+
namespace :db do
|
2
|
+
|
3
|
+
desc "Migrate the database through scripts in db/migrations."
|
4
|
+
task :migrate => "mack:environment" do
|
5
|
+
Mack::Database::Migrations.migrate
|
6
|
+
end # migrate
|
7
|
+
|
8
|
+
desc "Rolls the schema back to the previous version. Specify the number of steps with STEP=n."
|
9
|
+
task :rollback => ["mack:environment", "db:abort_if_pending_migrations"] do
|
10
|
+
Mack::Database::Migrations.rollback((ENV["STEP"] || 1).to_i)
|
11
|
+
end # rollback
|
12
|
+
|
13
|
+
desc "Raises an error if there are pending migrations."
|
14
|
+
task :abort_if_pending_migrations do
|
15
|
+
Mack::Database::Migrations.abort_if_pending_migrations
|
16
|
+
end
|
17
|
+
|
18
|
+
end # db
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rake'
|
2
|
+
namespace :test do
|
3
|
+
|
4
|
+
desc "Sets up your testing environment"
|
5
|
+
task :setup do
|
6
|
+
ENV["MACK_ENV"] = "test"
|
7
|
+
Mack.reset_logger!
|
8
|
+
Rake::Task["db:recreate"].invoke
|
9
|
+
Mack::Database.dump_structure("development", :default)
|
10
|
+
Mack::Database.load_structure(File.join(Mack.root, "db", "development_schema_structure.sql"))
|
11
|
+
Rake::Task["test:factories:run"].invoke
|
12
|
+
end # setup
|
13
|
+
|
14
|
+
namespace :factories do
|
15
|
+
|
16
|
+
desc "If using the mack-data_factory it will require your factories and run the 'init' factories"
|
17
|
+
task :run do
|
18
|
+
if respond_to?(:run_factories)
|
19
|
+
# auto require factories:
|
20
|
+
Dir.glob(File.join(Mack.root, "test", "factories", "**/*.rb")).each do |f|
|
21
|
+
require f
|
22
|
+
end
|
23
|
+
run_factories(:init)
|
24
|
+
end
|
25
|
+
end # run
|
26
|
+
|
27
|
+
end # factories
|
28
|
+
|
29
|
+
end # test
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mack-orm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- markbates
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-08-25 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: "mack-orm was developed by: markbates"
|
17
|
+
email: mark@mackframework.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
files:
|
25
|
+
- lib/mack-orm/database.rb
|
26
|
+
- lib/mack-orm/database_migrations.rb
|
27
|
+
- lib/mack-orm/generators.rb
|
28
|
+
- lib/mack-orm/genosaurus_helpers.rb
|
29
|
+
- lib/mack-orm/model_column.rb
|
30
|
+
- lib/mack-orm/orm_helpers.rb
|
31
|
+
- lib/mack-orm/scaffold_generator/manifest.yml
|
32
|
+
- lib/mack-orm/scaffold_generator/scaffold_generator.rb
|
33
|
+
- lib/mack-orm/scaffold_generator/templates/app/controllers/controller.rb.template
|
34
|
+
- lib/mack-orm/scaffold_generator/templates/app/views/edit.html.erb.template
|
35
|
+
- lib/mack-orm/scaffold_generator/templates/app/views/index.html.erb.template
|
36
|
+
- lib/mack-orm/scaffold_generator/templates/app/views/new.html.erb.template
|
37
|
+
- lib/mack-orm/scaffold_generator/templates/app/views/show.html.erb.template
|
38
|
+
- lib/mack-orm/scaffold_generator/templates/test/controllers/rspec.rb.template
|
39
|
+
- lib/mack-orm/scaffold_generator/templates/test/controllers/test_case.rb.template
|
40
|
+
- lib/mack-orm/tasks/db_create_drop_tasks.rake
|
41
|
+
- lib/mack-orm/tasks/db_migration_tasks.rake
|
42
|
+
- lib/mack-orm/tasks/test_tasks.rake
|
43
|
+
- lib/mack-orm.rb
|
44
|
+
- lib/mack-orm_tasks.rb
|
45
|
+
- README
|
46
|
+
- doc/classes/Mack/Database/Generators.html
|
47
|
+
- doc/classes/Mack/Database/Migrations.html
|
48
|
+
- doc/classes/Mack/Database.html
|
49
|
+
- doc/classes/Mack/ViewHelpers/OrmHelpers.html
|
50
|
+
- doc/classes/Mack.html
|
51
|
+
- doc/classes/ScaffoldGenerator.html
|
52
|
+
- doc/created.rid
|
53
|
+
- doc/files/lib/mack-orm/database_migrations_rb.html
|
54
|
+
- doc/files/lib/mack-orm/database_rb.html
|
55
|
+
- doc/files/lib/mack-orm/generators_rb.html
|
56
|
+
- doc/files/lib/mack-orm/genosaurus_helpers_rb.html
|
57
|
+
- doc/files/lib/mack-orm/model_column_rb.html
|
58
|
+
- doc/files/lib/mack-orm/orm_helpers_rb.html
|
59
|
+
- doc/files/lib/mack-orm/scaffold_generator/scaffold_generator_rb.html
|
60
|
+
- doc/files/lib/mack-orm_rb.html
|
61
|
+
- doc/files/lib/mack-orm_tasks_rb.html
|
62
|
+
- doc/files/README.html
|
63
|
+
- doc/fr_class_index.html
|
64
|
+
- doc/fr_file_index.html
|
65
|
+
- doc/fr_method_index.html
|
66
|
+
- doc/index.html
|
67
|
+
- doc/rdoc-style.css
|
68
|
+
has_rdoc: true
|
69
|
+
homepage: http://www.mackframework.com
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 1.8.6
|
81
|
+
version:
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: "0"
|
87
|
+
version:
|
88
|
+
requirements: []
|
89
|
+
|
90
|
+
rubyforge_project: magrathea
|
91
|
+
rubygems_version: 1.2.0
|
92
|
+
signing_key:
|
93
|
+
specification_version: 2
|
94
|
+
summary: Common ORM support for Mack
|
95
|
+
test_files: []
|
96
|
+
|