merb-admin 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +17 -5
- data/Rakefile +1 -1
- data/lib/abstract_model.rb +3 -3
- data/lib/merb-admin.rb +1 -1
- data/lib/merb-admin/slicetasks.rb +34 -30
- data/spec/migrations/activerecord/001_create_divisions_migration.rb +13 -0
- data/spec/migrations/activerecord/002_create_drafts_migration.rb +19 -0
- data/spec/migrations/activerecord/003_create_leagues_migration.rb +12 -0
- data/spec/migrations/activerecord/004_create_players_migration.rb +20 -0
- data/spec/migrations/activerecord/005_create_teams_migration.rb +22 -0
- data/spec/models/activerecord/division.rb +4 -4
- data/spec/models/activerecord/draft.rb +8 -8
- data/spec/models/activerecord/league.rb +3 -3
- data/spec/models/activerecord/player.rb +5 -5
- data/spec/models/activerecord/team.rb +11 -11
- data/spec/models/datamapper/division.rb +7 -7
- data/spec/models/datamapper/draft.rb +13 -13
- data/spec/models/datamapper/league.rb +6 -6
- data/spec/models/datamapper/player.rb +15 -15
- data/spec/models/datamapper/team.rb +17 -17
- data/spec/spec_helper.rb +5 -8
- metadata +7 -7
- data/schema/migrations/001_create_divisions_migration.rb +0 -15
- data/schema/migrations/002_create_drafts_migration.rb +0 -22
- data/schema/migrations/003_create_leagues_migration.rb +0 -13
- data/schema/migrations/004_create_players_migration.rb +0 -23
- data/schema/migrations/005_create_teams_migration.rb +0 -28
data/README.rdoc
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
==== MerbAdmin is a Merb plugin that provides an easy-to-use interface for managing your data.
|
3
3
|
It currently offers the features listed here[http://sferik.tadalist.com/lists/1352791/public].
|
4
4
|
|
5
|
-
The status of the
|
6
|
-
==
|
5
|
+
The status of the latest build is available here[http://runcoderun.com/sferik/merb-admin].
|
6
|
+
== Installation
|
7
7
|
$ gem install merb-admin -s http://gemcutter.org
|
8
8
|
In your app, add the following dependency to <tt>config/dependencies.rb</tt>:
|
9
|
-
dependency "merb-admin", "0.5.
|
9
|
+
dependency "merb-admin", "0.5.7"
|
10
10
|
Add the following route to <tt>config/router.rb</tt>:
|
11
11
|
add_slice(:merb_admin, :path_prefix => "admin")
|
12
12
|
Then, run the following rake task:
|
@@ -21,10 +21,22 @@ If you're feeling crafty, you can set a couple configuration options in <tt>conf
|
|
21
21
|
Start the server:
|
22
22
|
$ merb
|
23
23
|
You should now be able to administer your site at http://localhost:4000/admin.
|
24
|
-
== Contact
|
25
|
-
Please report any problems you encounter to mailto:sferik@gmail.com or {@sferik}[http://twitter.com/sferik] on Twitter.
|
26
24
|
== WARNING
|
27
25
|
MerbAdmin does not implement any authorization scheme. Make sure to apply authorization logic before deploying to production!
|
26
|
+
== Contributing
|
27
|
+
In the spirit of {free software}[http://www.fsf.org/licensing/essays/free-sw.html], people of all abilities are encouraged to help improve MerbAdmin.
|
28
|
+
|
29
|
+
There are many ways to contribute:
|
30
|
+
* by reporting bugs
|
31
|
+
* by suggesting new features
|
32
|
+
* by writing documentation
|
33
|
+
* by writing specifications
|
34
|
+
* by writing code (no patch is too small: fix typos in comments or inconsistent whitespace)
|
35
|
+
* financially[http://pledgie.com/campaigns/5428]
|
36
|
+
|
37
|
+
All contributors will be added to the credits below and will receive the respect and gratitude of the author.
|
38
|
+
== Contact
|
39
|
+
If you are interested in contributing to MerbAdmin, please contact Erik Michaels-Ober via email[mailto:sferik@gmail.com], GitHub[http://github.com/sferik/], or Twitter[http://twitter.com/sferik].
|
28
40
|
== Credits
|
29
41
|
Many thanks to:
|
30
42
|
* {Wilson Miner}[http://www.wilsonminer.com] for contributing the stylesheets and javascripts from Django[http://www.djangoproject.com]
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ AUTHOR = "Erik Michaels-Ober"
|
|
9
9
|
EMAIL = "sferik@gmail.com"
|
10
10
|
HOMEPAGE = "http://github.com/sferik/merb-admin"
|
11
11
|
SUMMARY = "MerbAdmin is a Merb plugin that provides an easy-to-use interface for managing your data."
|
12
|
-
GEM_VERSION = "0.5.
|
12
|
+
GEM_VERSION = "0.5.7"
|
13
13
|
|
14
14
|
spec = Gem::Specification.new do |s|
|
15
15
|
s.rubyforge_project = "merb"
|
data/lib/abstract_model.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
require 'generic_support'
|
2
|
-
require 'activerecord_support'
|
3
|
-
require 'datamapper_support'
|
4
2
|
|
5
3
|
module MerbAdmin
|
6
4
|
class AbstractModel
|
@@ -11,7 +9,7 @@ module MerbAdmin
|
|
11
9
|
case Merb.orm
|
12
10
|
when :activerecord
|
13
11
|
Dir.glob(Merb.dir_for(:model) / Merb.glob_for(:model)).each do |filename|
|
14
|
-
# FIXME: This heuristic for finding ActiveRecord models
|
12
|
+
# FIXME: This heuristic for finding ActiveRecord models could be too strict
|
15
13
|
File.read(filename).scan(/^class ([\w\d_\-:]+) < ActiveRecord::Base$/).flatten.each do |m|
|
16
14
|
model = lookup(m.to_s.to_sym)
|
17
15
|
@models << new(model) if model
|
@@ -56,8 +54,10 @@ module MerbAdmin
|
|
56
54
|
self.extend(GenericSupport)
|
57
55
|
case Merb.orm
|
58
56
|
when :activerecord
|
57
|
+
require 'activerecord_support'
|
59
58
|
self.extend(ActiverecordSupport)
|
60
59
|
when :datamapper
|
60
|
+
require 'datamapper_support'
|
61
61
|
self.extend(DatamapperSupport)
|
62
62
|
else
|
63
63
|
raise "MerbAdmin does not support the #{Merb.orm} ORM"
|
data/lib/merb-admin.rb
CHANGED
@@ -23,7 +23,7 @@ if defined?(Merb::Plugins)
|
|
23
23
|
|
24
24
|
# Slice metadata
|
25
25
|
self.description = "MerbAdmin is a Merb plugin that provides an easy-to-use interface for managing your data."
|
26
|
-
self.version = "0.5.
|
26
|
+
self.version = "0.5.7"
|
27
27
|
self.author = "Erik Michaels-Ober"
|
28
28
|
|
29
29
|
# Stub classes loaded hook - runs before LoadClasses BootLoader
|
@@ -16,41 +16,44 @@ namespace :slices do
|
|
16
16
|
# task :migrate do
|
17
17
|
# end
|
18
18
|
|
19
|
+
desc "Copies sample models, copies and runs sample migrations, and loads sample data into your app"
|
20
|
+
task :activerecord => ["activerecord:copy_sample_models", "activerecord:copy_sample_migrations", "activerecord:migrate", "load_sample_data"]
|
19
21
|
namespace :activerecord do
|
20
|
-
desc "
|
21
|
-
task :
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
22
|
+
desc "Copies sample models into your app"
|
23
|
+
task :copy_sample_models do
|
24
|
+
copy_models(:activerecord)
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Copies sample migrations into your app"
|
28
|
+
task :copy_sample_migrations do
|
29
|
+
copy_migrations(:activerecord)
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Migrate the database to the latest version"
|
33
|
+
task :migrate do
|
34
|
+
Rake::Task["db:migrate"].reenable
|
35
|
+
Rake::Task["db:migrate"].invoke
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
39
|
+
desc "Copies sample models, runs sample migrations, and loads sample data into your app"
|
40
|
+
task :datamapper => ["datamapper:copy_sample_models", "datamapper:migrate", "load_sample_data"]
|
38
41
|
namespace :datamapper do
|
39
|
-
desc "
|
40
|
-
task :
|
41
|
-
|
42
|
-
desc "Loads sample DataMapper models"
|
43
|
-
task :models do
|
44
|
-
copy_models(:datamapper)
|
45
|
-
end
|
46
|
-
|
47
|
-
desc "Loads sample DataMapper data"
|
48
|
-
task :data do
|
49
|
-
Rake::Task["db:automigrate"].reenable
|
50
|
-
Rake::Task["db:automigrate"].invoke
|
51
|
-
load_data
|
52
|
-
end
|
42
|
+
desc "Copies sample models into your app"
|
43
|
+
task :copy_sample_models do
|
44
|
+
copy_models(:datamapper)
|
53
45
|
end
|
46
|
+
|
47
|
+
desc "Perform non destructive automigration"
|
48
|
+
task :migrate do
|
49
|
+
Rake::Task["db:automigrate"].reenable
|
50
|
+
Rake::Task["db:automigrate"].invoke
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
desc "Loads sample data into your app"
|
55
|
+
task :load_sample_data do
|
56
|
+
load_data
|
54
57
|
end
|
55
58
|
|
56
59
|
end
|
@@ -79,6 +82,7 @@ def load_data
|
|
79
82
|
team = MerbAdmin::AbstractModel.new("Team").create(:name => mlb_team.name, :logo_url => mlb_team.logo_url, :manager => mlb_team.manager, :ballpark => mlb_team.ballpark, :mascot => mlb_team.mascot, :founded => mlb_team.founded, :wins => mlb_team.wins, :losses => mlb_team.losses, :win_percentage => ("%.3f" % (mlb_team.wins.to_f / (mlb_team.wins + mlb_team.losses))).to_f, :division => division, :league => league)
|
80
83
|
end
|
81
84
|
mlb_team.players.each do |player|
|
85
|
+
next if player.number.nil?
|
82
86
|
MerbAdmin::AbstractModel.new("Player").create(:name => player.name, :number => player.number, :position => player.position, :team => team)
|
83
87
|
end
|
84
88
|
end
|
@@ -102,7 +106,7 @@ def copy_migrations(orm = nil)
|
|
102
106
|
orm ||= set_orm
|
103
107
|
puts "Copying sample #{orm} migrations into host application - resolves any collisions"
|
104
108
|
seen, copied, duplicated = [], [], []
|
105
|
-
Dir.glob(File.dirname(__FILE__) / ".." / ".." / "
|
109
|
+
Dir.glob(File.dirname(__FILE__) / ".." / ".." / "spec" / "migrations" / orm.to_s.downcase / "*.rb").each do |source_filename|
|
106
110
|
destination_filename = Merb.root / "schema" / "migrations" / File.basename(source_filename)
|
107
111
|
next if seen.include?(source_filename)
|
108
112
|
mirror_file(source_filename, destination_filename, copied, duplicated)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateDivisionsMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:divisions) do |t|
|
4
|
+
t.timestamps
|
5
|
+
t.integer(:league_id)
|
6
|
+
t.string(:name, :limit => 50, :null => false)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
drop_table(:divisions)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateDraftsMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:drafts) do |t|
|
4
|
+
t.timestamps
|
5
|
+
t.integer(:player_id)
|
6
|
+
t.integer(:team_id)
|
7
|
+
t.date(:date)
|
8
|
+
t.integer(:round)
|
9
|
+
t.integer(:pick)
|
10
|
+
t.integer(:overall)
|
11
|
+
t.string(:college, :limit => 100)
|
12
|
+
t.text(:notes)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table(:drafts)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreatePlayersMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:players) do |t|
|
4
|
+
t.timestamps
|
5
|
+
t.datetime(:deleted_at)
|
6
|
+
t.integer(:team_id)
|
7
|
+
t.string(:name, :limit => 100, :null => false)
|
8
|
+
t.string(:position, :limit => 50)
|
9
|
+
t.integer(:number, :null => false)
|
10
|
+
t.boolean(:retired, :default => false)
|
11
|
+
t.boolean(:injured, :default => false)
|
12
|
+
t.date(:born_on)
|
13
|
+
t.text(:notes)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.down
|
18
|
+
drop_table(:players)
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateTeamsMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:teams) do |t|
|
4
|
+
t.timestamps
|
5
|
+
t.integer(:league_id)
|
6
|
+
t.integer(:division_id)
|
7
|
+
t.string(:name, :limit => 50, :null => false)
|
8
|
+
t.string(:logo_url, :limit => 255)
|
9
|
+
t.string(:manager, :limit => 100, :null => false)
|
10
|
+
t.string(:ballpark, :limit => 100)
|
11
|
+
t.string(:mascot, :limit => 100)
|
12
|
+
t.integer(:founded)
|
13
|
+
t.integer(:wins)
|
14
|
+
t.integer(:losses)
|
15
|
+
t.float(:win_percentage)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.down
|
20
|
+
drop_table(:teams)
|
21
|
+
end
|
22
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Division < ActiveRecord::Base
|
2
|
-
validates_numericality_of
|
3
|
-
validates_presence_of
|
2
|
+
validates_numericality_of(:league_id, :only_integer => true)
|
3
|
+
validates_presence_of(:name)
|
4
4
|
|
5
|
-
belongs_to
|
6
|
-
has_many
|
5
|
+
belongs_to(:league)
|
6
|
+
has_many(:teams)
|
7
7
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class Draft < ActiveRecord::Base
|
2
|
-
validates_numericality_of
|
3
|
-
validates_numericality_of
|
4
|
-
validates_presence_of
|
5
|
-
validates_numericality_of
|
6
|
-
validates_numericality_of
|
7
|
-
validates_numericality_of
|
2
|
+
validates_numericality_of(:player_id, :only_integer => true)
|
3
|
+
validates_numericality_of(:team_id, :only_integer => true)
|
4
|
+
validates_presence_of(:date)
|
5
|
+
validates_numericality_of(:round, :only_integer => true)
|
6
|
+
validates_numericality_of(:pick, :only_integer => true)
|
7
|
+
validates_numericality_of(:overall, :only_integer => true)
|
8
8
|
|
9
|
-
belongs_to
|
10
|
-
belongs_to
|
9
|
+
belongs_to(:team)
|
10
|
+
belongs_to(:player)
|
11
11
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class Player < ActiveRecord::Base
|
2
|
-
validates_presence_of
|
3
|
-
validates_numericality_of
|
4
|
-
validates_uniqueness_of
|
2
|
+
validates_presence_of(:name)
|
3
|
+
validates_numericality_of(:number, :only_integer => true)
|
4
|
+
validates_uniqueness_of(:number, :scope => :team_id, :message => "There is already a player with that number on this team")
|
5
5
|
|
6
|
-
belongs_to
|
7
|
-
has_one
|
6
|
+
belongs_to(:team)
|
7
|
+
has_one(:draft)
|
8
8
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
class Team < ActiveRecord::Base
|
2
|
-
validates_numericality_of
|
3
|
-
validates_numericality_of
|
4
|
-
validates_presence_of
|
5
|
-
validates_presence_of
|
6
|
-
validates_numericality_of
|
7
|
-
validates_numericality_of
|
8
|
-
validates_numericality_of
|
9
|
-
validates_numericality_of
|
2
|
+
validates_numericality_of(:league_id, :only_integer => true)
|
3
|
+
validates_numericality_of(:division_id, :only_integer => true)
|
4
|
+
validates_presence_of(:name)
|
5
|
+
validates_presence_of(:manager)
|
6
|
+
validates_numericality_of(:founded, :only_integer => true)
|
7
|
+
validates_numericality_of(:wins, :only_integer => true)
|
8
|
+
validates_numericality_of(:losses, :only_integer => true)
|
9
|
+
validates_numericality_of(:win_percentage)
|
10
10
|
|
11
|
-
belongs_to
|
12
|
-
belongs_to
|
13
|
-
has_many
|
11
|
+
belongs_to(:league)
|
12
|
+
belongs_to(:division)
|
13
|
+
has_many(:players)
|
14
14
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class Division
|
2
2
|
include DataMapper::Resource
|
3
3
|
|
4
|
-
property
|
5
|
-
property
|
6
|
-
property
|
7
|
-
property
|
8
|
-
property
|
4
|
+
property(:id, Serial)
|
5
|
+
property(:created_at, DateTime)
|
6
|
+
property(:updated_at, DateTime)
|
7
|
+
property(:league_id, Integer, :nullable => false, :index => true)
|
8
|
+
property(:name, String, :nullable => false, :index => true)
|
9
9
|
|
10
|
-
belongs_to
|
11
|
-
has
|
10
|
+
belongs_to(:league)
|
11
|
+
has(n, :teams)
|
12
12
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
class Draft
|
2
2
|
include DataMapper::Resource
|
3
3
|
|
4
|
-
property
|
5
|
-
property
|
6
|
-
property
|
7
|
-
property
|
8
|
-
property
|
9
|
-
property
|
10
|
-
property
|
11
|
-
property
|
12
|
-
property
|
13
|
-
property
|
14
|
-
property
|
4
|
+
property(:id, Serial)
|
5
|
+
property(:created_at, DateTime)
|
6
|
+
property(:updated_at, DateTime)
|
7
|
+
property(:player_id, Integer, :nullable => false, :index => true)
|
8
|
+
property(:team_id, Integer, :nullable => false, :index => true)
|
9
|
+
property(:date, Date, :nullable => false)
|
10
|
+
property(:round, Integer, :nullable => false)
|
11
|
+
property(:pick, Integer, :nullable => false)
|
12
|
+
property(:overall, Integer, :nullable => false)
|
13
|
+
property(:college, String, :length => 100, :index => true)
|
14
|
+
property(:notes, Text)
|
15
15
|
|
16
|
-
belongs_to
|
17
|
-
belongs_to
|
16
|
+
belongs_to(:team)
|
17
|
+
belongs_to(:player)
|
18
18
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class League
|
2
2
|
include DataMapper::Resource
|
3
3
|
|
4
|
-
property
|
5
|
-
property
|
6
|
-
property
|
7
|
-
property
|
4
|
+
property(:id, Serial)
|
5
|
+
property(:created_at, DateTime)
|
6
|
+
property(:updated_at, DateTime)
|
7
|
+
property(:name, String, :nullable => false, :index => true)
|
8
8
|
|
9
|
-
has
|
10
|
-
has
|
9
|
+
has(n, :divisions)
|
10
|
+
has(n, :teams)
|
11
11
|
end
|
@@ -1,21 +1,21 @@
|
|
1
1
|
class Player
|
2
2
|
include DataMapper::Resource
|
3
3
|
|
4
|
-
property
|
5
|
-
property
|
6
|
-
property
|
7
|
-
property
|
8
|
-
property
|
9
|
-
property
|
10
|
-
property
|
11
|
-
property
|
12
|
-
property
|
13
|
-
property
|
14
|
-
property
|
15
|
-
property
|
4
|
+
property(:id, Serial)
|
5
|
+
property(:created_at, DateTime)
|
6
|
+
property(:updated_at, DateTime)
|
7
|
+
property(:deleted_at, ParanoidDateTime)
|
8
|
+
property(:team_id, Integer, :index => true)
|
9
|
+
property(:name, String, :length => 100, :nullable => false, :index => true)
|
10
|
+
property(:position, String, :index => true)
|
11
|
+
property(:number, Integer, :nullable => false)
|
12
|
+
property(:retired, Boolean, :default => false)
|
13
|
+
property(:injured, Boolean, :default => false)
|
14
|
+
property(:born_on, Date)
|
15
|
+
property(:notes, Text)
|
16
16
|
|
17
|
-
validates_is_unique
|
17
|
+
validates_is_unique(:number, :scope => :team_id, :message => "There is already a player with that number on this team")
|
18
18
|
|
19
|
-
belongs_to
|
20
|
-
has
|
19
|
+
belongs_to(:team)
|
20
|
+
has(1, :draft)
|
21
21
|
end
|
@@ -1,22 +1,22 @@
|
|
1
1
|
class Team
|
2
2
|
include DataMapper::Resource
|
3
3
|
|
4
|
-
property
|
5
|
-
property
|
6
|
-
property
|
7
|
-
property
|
8
|
-
property
|
9
|
-
property
|
10
|
-
property
|
11
|
-
property
|
12
|
-
property
|
13
|
-
property
|
14
|
-
property
|
15
|
-
property
|
16
|
-
property
|
17
|
-
property
|
4
|
+
property(:id, Serial)
|
5
|
+
property(:created_at, DateTime)
|
6
|
+
property(:updated_at, DateTime)
|
7
|
+
property(:league_id, Integer, :nullable => false, :index => true)
|
8
|
+
property(:division_id, Integer, :nullable => false, :index => true)
|
9
|
+
property(:name, String, :nullable => false, :index => true)
|
10
|
+
property(:logo_url, String, :length => 255)
|
11
|
+
property(:manager, String, :length => 100, :nullable => false, :index => true)
|
12
|
+
property(:ballpark, String, :length => 100, :index => true)
|
13
|
+
property(:mascot, String, :length => 100, :index => true)
|
14
|
+
property(:founded, Integer, :nullable => false)
|
15
|
+
property(:wins, Integer, :nullable => false)
|
16
|
+
property(:losses, Integer, :nullable => false)
|
17
|
+
property(:win_percentage, Float, :nullable => false, :precision => 4, :scale => 3)
|
18
18
|
|
19
|
-
belongs_to
|
20
|
-
belongs_to
|
21
|
-
has
|
19
|
+
belongs_to(:league)
|
20
|
+
belongs_to(:division)
|
21
|
+
has(n, :players)
|
22
22
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -44,23 +44,20 @@ module Merb
|
|
44
44
|
when :activerecord
|
45
45
|
require 'activerecord'
|
46
46
|
require_models(orm)
|
47
|
-
|
48
47
|
unless ActiveRecord::Base.connected?
|
49
48
|
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
|
50
49
|
ActiveRecord::Migration.verbose = false
|
51
|
-
ActiveRecord::Migrator.run(:up, "
|
52
|
-
ActiveRecord::Migrator.run(:up, "
|
53
|
-
ActiveRecord::Migrator.run(:up, "
|
54
|
-
ActiveRecord::Migrator.run(:up, "
|
55
|
-
ActiveRecord::Migrator.run(:up, "
|
50
|
+
ActiveRecord::Migrator.run(:up, File.join(File.dirname(__FILE__), "migrations", "activerecord"), 1)
|
51
|
+
ActiveRecord::Migrator.run(:up, File.join(File.dirname(__FILE__), "migrations", "activerecord"), 2)
|
52
|
+
ActiveRecord::Migrator.run(:up, File.join(File.dirname(__FILE__), "migrations", "activerecord"), 3)
|
53
|
+
ActiveRecord::Migrator.run(:up, File.join(File.dirname(__FILE__), "migrations", "activerecord"), 4)
|
54
|
+
ActiveRecord::Migrator.run(:up, File.join(File.dirname(__FILE__), "migrations", "activerecord"), 5)
|
56
55
|
end
|
57
56
|
when :datamapper
|
58
57
|
require 'dm-core'
|
59
|
-
require 'dm-types'
|
60
58
|
require 'dm-aggregates'
|
61
59
|
require 'dm-validations'
|
62
60
|
require_models(orm)
|
63
|
-
|
64
61
|
unless DataMapper::Repository.adapters.key?(:default)
|
65
62
|
DataMapper.setup(:default, 'sqlite3::memory:')
|
66
63
|
DataMapper.auto_migrate!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Michaels-Ober
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-26 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -152,12 +152,12 @@ files:
|
|
152
152
|
- public/stylesheets/patch-iewin.css
|
153
153
|
- public/stylesheets/rtl.css
|
154
154
|
- public/stylesheets/widgets.css
|
155
|
-
- schema/migrations/001_create_divisions_migration.rb
|
156
|
-
- schema/migrations/002_create_drafts_migration.rb
|
157
|
-
- schema/migrations/003_create_leagues_migration.rb
|
158
|
-
- schema/migrations/004_create_players_migration.rb
|
159
|
-
- schema/migrations/005_create_teams_migration.rb
|
160
155
|
- spec/controllers/main_spec.rb
|
156
|
+
- spec/migrations/activerecord/001_create_divisions_migration.rb
|
157
|
+
- spec/migrations/activerecord/002_create_drafts_migration.rb
|
158
|
+
- spec/migrations/activerecord/003_create_leagues_migration.rb
|
159
|
+
- spec/migrations/activerecord/004_create_players_migration.rb
|
160
|
+
- spec/migrations/activerecord/005_create_teams_migration.rb
|
161
161
|
- spec/models/activerecord/division.rb
|
162
162
|
- spec/models/activerecord/draft.rb
|
163
163
|
- spec/models/activerecord/league.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class CreateDivisionsMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :divisions do |t|
|
4
|
-
t.timestamps
|
5
|
-
t.integer :league_id
|
6
|
-
t.string :name, :limit => 50, :null => false
|
7
|
-
end
|
8
|
-
add_index :divisions, :league_id
|
9
|
-
add_index :divisions, :name
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.down
|
13
|
-
drop_table :divisions
|
14
|
-
end
|
15
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class CreateDraftsMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :drafts do |t|
|
4
|
-
t.timestamps
|
5
|
-
t.integer :player_id
|
6
|
-
t.integer :team_id
|
7
|
-
t.date :date
|
8
|
-
t.integer :round
|
9
|
-
t.integer :pick
|
10
|
-
t.integer :overall
|
11
|
-
t.string :college, :limit => 100
|
12
|
-
t.text :notes
|
13
|
-
end
|
14
|
-
add_index :drafts, :player_id
|
15
|
-
add_index :drafts, :team_id
|
16
|
-
add_index :drafts, :college
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.down
|
20
|
-
drop_table :drafts
|
21
|
-
end
|
22
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class CreateLeaguesMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :leagues do |t|
|
4
|
-
t.timestamps
|
5
|
-
t.string :name, :limit => 50, :null => false
|
6
|
-
end
|
7
|
-
add_index :leagues, :name
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.down
|
11
|
-
drop_table :leagues
|
12
|
-
end
|
13
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
class CreatePlayersMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :players do |t|
|
4
|
-
t.timestamps
|
5
|
-
t.datetime :deleted_at
|
6
|
-
t.integer :team_id
|
7
|
-
t.string :name, :limit => 100, :null => false
|
8
|
-
t.string :position, :limit => 50
|
9
|
-
t.integer :number, :null => false
|
10
|
-
t.boolean :retired, :default => false
|
11
|
-
t.boolean :injured, :default => false
|
12
|
-
t.date :born_on
|
13
|
-
t.text :notes
|
14
|
-
end
|
15
|
-
add_index :players, :team_id
|
16
|
-
add_index :players, :name
|
17
|
-
add_index :players, :position
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.down
|
21
|
-
drop_table :players
|
22
|
-
end
|
23
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
class CreateTeamsMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :teams do |t|
|
4
|
-
t.timestamps
|
5
|
-
t.integer :league_id
|
6
|
-
t.integer :division_id
|
7
|
-
t.string :name, :limit => 50, :null => false
|
8
|
-
t.string :logo_url, :limit => 255
|
9
|
-
t.string :manager, :limit => 100, :null => false
|
10
|
-
t.string :ballpark, :limit => 100
|
11
|
-
t.string :mascot, :limit => 100
|
12
|
-
t.integer :founded
|
13
|
-
t.integer :wins
|
14
|
-
t.integer :losses
|
15
|
-
t.float :win_percentage
|
16
|
-
end
|
17
|
-
add_index :teams, :division_id
|
18
|
-
add_index :teams, :league_id
|
19
|
-
add_index :teams, :name
|
20
|
-
add_index :teams, :manager
|
21
|
-
add_index :teams, :ballpark
|
22
|
-
add_index :teams, :mascot
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.down
|
26
|
-
drop_table :teams
|
27
|
-
end
|
28
|
-
end
|