Skip to content

Commit 167044f

Browse files
authored
chore: remove deprecated ORM generators (DataMapper, MongoMapper, CouchRest, Ripple) (#2320)
* chore: remove deprecated ORM generators (DataMapper, MongoMapper, CouchRest, Ripple) * fix: add missing ORMs to admin tooltips/README, remove DM rake task refs --------- Co-authored-by: Arthur Chiu <achiurizo@users.noreply.github.com>
1 parent 14e7b8d commit 167044f

26 files changed

Lines changed: 29 additions & 1011 deletions

File tree

padrino-admin/README.rdoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Padrino has a beautiful Admin management dashboard with these features:
66

7-
Orm Agnostic:: Data Adapters for Datamapper, Activerecord, Sequel, Mongomapper, Mongoid, Couchrest, Dynamoid
7+
Orm Agnostic:: Data Adapters for Activerecord, MiniRecord, Sequel, Mongoid, Ohm, Dynamoid
88
Template Agnostic:: Erb, Erubis and Haml Renderer
99
Authentication:: Support for Account authentication, Account Permission management
1010
Scaffold:: You can simply create a new "admin interface" by providing a Model
@@ -27,15 +27,15 @@ Create the admin subapplication:
2727
Next, follow the admin setup steps:
2828

2929
* configure your <tt>config/database.rb</tt> to connect to the correct data.
30-
* run <tt>padrino rake dm:migrate</tt> # or ar:migrate if you use activerecord
30+
* run <tt>padrino rake ar:migrate</tt> # if you use activerecord
3131
* run <tt>padrino rake seed</tt>
3232

3333
Your admin panel now is ready and you can start your server with <tt>padrino start</tt> and point your browser to <tt>/admin</tt>!
3434

3535
To create a new "scaffold" you need to provide only a Model name to the command:
3636

3737
demo$ padrino-gen model post --skip-migration # edit your post.rb model and add some fields
38-
demo$ padrino-gen rake dm:auto:migrate
38+
demo$ padrino-gen rake ar:migrate
3939
demo$ padrino-gen admin_page post
4040
demo$ padrino start # and go to http://localhost:3000/admin
4141

padrino-admin/lib/padrino-admin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Padrino
88
##
99
# Padrino::Admin is beautiful Ajax Admin, with these features:
1010
#
11-
# Orm Agnostic:: Adapters for datamapper, activerecord, mongomapper, couchdb (now only: datamapper and activerecord), ohm
11+
# Orm Agnostic:: Adapters for activerecord, sequel, mongoid, ohm, and more
1212
# Authentication:: Support for Account authentication, Account Permission management
1313
# Scaffold:: You can simply create a new "admin interface" simply providing a Model
1414
# Ajax Uploads:: You can upload file, manage them and attach them to any model in a quick and simple way (coming soon)

padrino-admin/lib/padrino-admin/generators/actions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def ext
2727
# Tell us for now which orm we support
2828
#
2929
def supported_orm
30-
%i[minirecord datamapper activerecord mongomapper mongoid couchrest sequel ohm dynamoid]
30+
%i[minirecord activerecord mongoid sequel ohm dynamoid]
3131
end
3232

3333
##

padrino-admin/lib/padrino-admin/generators/admin_app.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def create_admin
7878

7979
unless options[:destroy]
8080
insert_middleware 'ConnectionPoolManagement', @admin_path if %i[minirecord activerecord].include?(orm)
81-
insert_middleware 'IdentityMap', @admin_path if orm == :datamapper
8281
end
8382

8483
params = [
@@ -147,7 +146,7 @@ def create_admin
147146

148147
instructions = []
149148
instructions << "Run 'bundle'"
150-
if %i[activerecord datamapper sequel].include?(orm)
149+
if %i[activerecord sequel].include?(orm)
151150
instructions << "Run 'bundle exec rake db:create' if you have not created a database yet"
152151
instructions << "Run 'bundle exec rake db:migrate'"
153152
end

padrino-admin/lib/padrino-admin/generators/orm.rb

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def activerecord?
3333
end
3434

3535
def field_type(type)
36-
type = :string if type.nil? # couchrest-Hack to avoid the next line to fail
36+
type = :string if type.nil?
3737
type = type.to_s.demodulize.downcase.to_sym unless type.is_a?(Symbol)
3838

3939
case type
@@ -52,36 +52,14 @@ def columns
5252
case orm
5353
when :activerecord then @klass.columns
5454
when :minirecord then @klass.columns
55-
when :datamapper then @klass.properties.map { |p| dm_column(p) }
56-
when :couchrest then @klass.properties
5755
when :mongoid then @klass.fields.values.reject { |col| %w[_id _type].include?(col.name) }
58-
when :mongomapper then @klass.keys.values.reject { |key| key.name == '_id' } # On MongoMapper keys are an hash
5956
when :sequel then @klass.db_schema.map { |k, v| v[:type] = :text if v[:db_type] =~ /^text/i; Column.new(k, v[:type]) }
6057
when :ohm then @klass.attributes.map { |a| Column.new(a.to_s, :string) } # ohm has strings
6158
when :dynamoid then @klass.attributes.map { |k, v| Column.new(k.to_s, v[:type]) }
6259
else raise OrmError, "Adapter #{orm} is not yet supported!"
6360
end
6461
end
6562

66-
def dm_column(property)
67-
case property
68-
when DataMapper::Property::Text
69-
Column.new(property.name, :text)
70-
when DataMapper::Property::Boolean
71-
Column.new(property.name, :boolean)
72-
when DataMapper::Property::Integer
73-
Column.new(property.name, :integer)
74-
when DataMapper::Property::Decimal
75-
Column.new(property.name, :decimal)
76-
when DataMapper::Property::Float
77-
Column.new(property.name, :float)
78-
when DataMapper::Property::String
79-
Column.new(property.name, :string)
80-
else # if all fails, lets assume its string-ish
81-
Column.new(property.name, :string)
82-
end
83-
end
84-
8563
def column_fields
8664
excluded_columns = %w[created_at updated_at] << (orm == :mongoid ? '_id' : 'id')
8765
column_fields = columns.dup
@@ -97,8 +75,7 @@ def all
9775

9876
def find(params = nil)
9977
case orm
100-
when :activerecord, :minirecord, :mongomapper, :mongoid, :dynamoid then "#{klass_name}.find(#{params})"
101-
when :datamapper, :couchrest then "#{klass_name}.get(#{params})"
78+
when :activerecord, :minirecord, :mongoid, :dynamoid then "#{klass_name}.find(#{params})"
10279
when :sequel, :ohm then "#{klass_name}[#{params}]"
10380
else raise OrmError, "Adapter #{orm} is not yet supported!"
10481
end
@@ -118,8 +95,8 @@ def save
11895

11996
def update_attributes(params = nil)
12097
case orm
121-
when :mongomapper, :mongoid, :couchrest, :dynamoid then "@#{name_singular}.update_attributes(#{params})"
122-
when :activerecord, :minirecord, :datamapper, :ohm then "@#{name_singular}.update(#{params})"
98+
when :mongoid, :dynamoid then "@#{name_singular}.update_attributes(#{params})"
99+
when :activerecord, :minirecord, :ohm then "@#{name_singular}.update(#{params})"
123100
when :sequel then "@#{name_singular}.modified! && @#{name_singular}.update(#{params})"
124101
else raise OrmError, "Adapter #{orm} is not yet supported!"
125102
end
@@ -132,10 +109,8 @@ def destroy
132109
def find_by_ids(params = nil)
133110
case orm
134111
when :ohm then "#{klass_name}.fetch(#{params})"
135-
when :datamapper then "#{klass_name}.all(id: #{params})"
136112
when :sequel then "#{klass_name}.where(id: #{params})"
137113
when :mongoid then "#{klass_name}.find(#{params})"
138-
when :couchrest then "#{klass_name}.all(keys: #{params})"
139114
when :dynamoid then "#{klass_name}.find(#{params})"
140115
else find(params)
141116
end
@@ -145,15 +120,14 @@ def multiple_destroy(params = nil)
145120
case orm
146121
when :ohm then "#{params}.each(&:delete)"
147122
when :sequel then "#{params}.destroy"
148-
when :datamapper then "#{params}.destroy"
149-
when :couchrest, :mongoid, :mongomapper, :dynamoid then "#{params}.each(&:destroy)"
123+
when :mongoid, :dynamoid then "#{params}.each(&:destroy)"
150124
else "#{klass_name}.destroy #{params}"
151125
end
152126
end
153127

154128
def has_error(field)
155129
case orm
156-
when :datamapper, :ohm, :sequel then "@#{name_singular}.errors.key?(:#{field}) && @#{name_singular}.errors[:#{field}].count > 0"
130+
when :ohm, :sequel then "@#{name_singular}.errors.key?(:#{field}) && @#{name_singular}.errors[:#{field}].count > 0"
157131
else "@#{name_singular}.errors.include?(:#{field})"
158132
end
159133
end

padrino-admin/lib/padrino-admin/generators/templates/account/couchrest.rb.tt

Lines changed: 0 additions & 67 deletions
This file was deleted.

padrino-admin/lib/padrino-admin/generators/templates/account/datamapper.rb.tt

Lines changed: 0 additions & 61 deletions
This file was deleted.

padrino-admin/lib/padrino-admin/generators/templates/account/mongomapper.rb.tt

Lines changed: 0 additions & 47 deletions
This file was deleted.

padrino-admin/lib/padrino-admin/generators/templates/erb/app/base/index.erb.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<div class=base-icons>
88
<div class=btn-group>
9-
<div class="btn btn-primary" title="Adapters for datamapper, sequel, activerecord, minirecord, mongomapper, mongoid, couchrest"><%%= tag_icon("cogs fa-2x", "Orm Agnostic") %></div>
9+
<div class="btn btn-primary" title="Adapters for activerecord, minirecord, sequel, mongoid, ohm, dynamoid"><%%= tag_icon("cogs fa-2x", "Orm Agnostic") %></div>
1010
<div class="btn btn-success" title="User Authentication Support, User Authorization Management"><%%= tag_icon("group fa-2x", "Authentication") %></div>
1111
<div class="btn btn-info" title="Erb, Haml, Slim Rendering Support"><%%= tag_icon("tasks fa-2x", "Template Agnostic") %></div>
1212
<div class="btn btn-warning" title="English, German, Russian, Danish, French, Brazilian and Italian localizations and many more!.."><%%= tag_icon("flag fa-2x", "Multi Language") %></div>

padrino-admin/lib/padrino-admin/generators/templates/haml/app/base/index.haml.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
.base-icons
77
.btn-group
8-
.btn.btn-primary{title: 'Adapters for datamapper, sequel, activerecord, minirecord, mongomapper, mongoid, couchrest'}
8+
.btn.btn-primary{title: 'Adapters for activerecord, minirecord, sequel, mongoid, ohm, dynamoid'}
99
= tag_icon('cogs fa-2x', 'Orm Agnostic')
1010
.btn.btn-success{title: 'User Authentication Support, User Authorization Management'}
1111
= tag_icon('group fa-2x', 'Authentication')

0 commit comments

Comments
 (0)