lalala 4.0.0.dev.162 → 4.0.0.dev.165
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{test/dummy/db/migrate/20130327213850_devise_create_admin_users.rb → db/migrate/20130321140345_devise_create_admin_users.rb} +0 -0
- data/{lib/generators/lalala/install/templates/migrations/1_create_admin_notes.rb → db/migrate/20130321140351_create_admin_notes.rb} +0 -0
- data/{lib/generators/lalala/install/templates/migrations/2_move_admin_notes_to_comments.rb → db/migrate/20130321140352_move_admin_notes_to_comments.rb} +0 -0
- data/{test/dummy/db/migrate/20130327213858_create_pages.rb → db/migrate/20130321140353_create_pages.rb} +9 -10
- data/db/migrate/20130328171232_create_images.rb +5 -0
- data/db/migrate/20130423142125_replace_images_with_assets.rb +24 -0
- data/db/migrate/20130506155010_add_locale_to_asset_translations.rb +5 -0
- data/lib/generators/lalala/devise/devise_generator.rb +2 -16
- data/lib/generators/lalala/install/install_generator.rb +0 -8
- data/lib/lalala/engine.rb +9 -0
- data/lib/lalala/version.rb +1 -1
- data/test/dummy/db/schema.rb +20 -1
- metadata +9 -14
- data/lib/generators/lalala/install/templates/migrations/3_create_pages.rb +0 -42
- data/lib/generators/lalala/install/templates/migrations/4_create_assets.rb +0 -23
- data/test/dummy/db/migrate/20130327213856_create_admin_notes.rb +0 -17
- data/test/dummy/db/migrate/20130327213857_move_admin_notes_to_comments.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d09f6cbd3bc0bf378e619fc8fec19048a28690f
|
4
|
+
data.tar.gz: a5821336b7851714566f7c848f90630eeeebfa0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 492462e6f2cf0ded49d860a6d9654a1936b73f67193f610d878651a5fe4002cc4f71519d75c2872d7404ce4ae3d4aa26eadd793f3f90321f4e9785a27b3b0433
|
7
|
+
data.tar.gz: 7d7307073c1f0e35881d5639d24b676b3271414734181e539a6345b5faf9c38343bb47e7d4a565fea82129b6111d40394f22427a8ad3a9c3af59b39cdb7e081d
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,13 @@
|
|
1
1
|
class CreatePages < ActiveRecord::Migration
|
2
|
-
def
|
2
|
+
def migrate(direction)
|
3
|
+
super
|
4
|
+
if direction == :up
|
5
|
+
# Reset the column info
|
6
|
+
ApplicationPage.reset_column_information
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def change
|
3
11
|
create_table :pages do |t|
|
4
12
|
t.integer :parent_id
|
5
13
|
t.integer :position
|
@@ -29,14 +37,5 @@ class CreatePages < ActiveRecord::Migration
|
|
29
37
|
add_index :page_translations, [:page_id]
|
30
38
|
add_index :page_translations, [:locale]
|
31
39
|
add_index :page_translations, [:path_component]
|
32
|
-
|
33
|
-
# Reset the column info
|
34
|
-
ApplicationPage.reset_column_information
|
35
|
-
end
|
36
|
-
|
37
|
-
def down
|
38
|
-
drop_table :pages
|
39
|
-
drop_table :page_hierarchies
|
40
|
-
drop_table :page_translations
|
41
40
|
end
|
42
41
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class ReplaceImagesWithAssets < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
|
4
|
+
create_table :assets do |t|
|
5
|
+
t.string :asset
|
6
|
+
t.string :type
|
7
|
+
t.references :asset_owner, polymorphic: true
|
8
|
+
t.string :asset_owner_section
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :assets, [:asset_owner_id, :asset_owner_type, :asset_owner_section], name: 'asset_owner_idx'
|
14
|
+
|
15
|
+
create_table :asset_translations do |t|
|
16
|
+
t.string :locale
|
17
|
+
t.references :asset
|
18
|
+
|
19
|
+
t.string :title
|
20
|
+
t.text :caption
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -33,25 +33,11 @@ module Lalala
|
|
33
33
|
gsub_file routes_file, /devise_for :#{plural_table_name}/, "devise_for :#{plural_table_name}, ActiveAdmin::Devise.config"
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def remove_migration
|
37
37
|
# Don't assume that we have a migration!
|
38
38
|
devise_migration_file = Dir["db/migrate/*_devise_create_#{table_name}.rb"].first
|
39
39
|
return if devise_migration_file.nil?
|
40
|
-
|
41
|
-
devise_migration_content = File.read(devise_migration_file)
|
42
|
-
|
43
|
-
if devise_migration_content["def change"]
|
44
|
-
inject_into_file devise_migration_file,
|
45
|
-
"def migrate(direction)\n super\n # Create a default user\n #{class_name}.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password') if direction == :up\n end\n\n ",
|
46
|
-
:before => "def change"
|
47
|
-
elsif devise_migration_content[/def (self.)?up/]
|
48
|
-
inject_into_file devise_migration_file,
|
49
|
-
"# Create a default user\n #{class_name}.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password')\n\n ",
|
50
|
-
:before => "add_index :#{table_name}, :email"
|
51
|
-
else
|
52
|
-
puts devise_migration_content
|
53
|
-
raise "Failed to add default admin user to migration."
|
54
|
-
end
|
40
|
+
File.unlink(devise_migration_file)
|
55
41
|
end
|
56
42
|
end
|
57
43
|
end
|
@@ -64,14 +64,6 @@ module Lalala
|
|
64
64
|
generate "lalala:assets"
|
65
65
|
end
|
66
66
|
|
67
|
-
def create_migrations
|
68
|
-
Dir["#{self.class.source_root}/migrations/*.rb"].sort.each do |filepath|
|
69
|
-
name = File.basename(filepath)
|
70
|
-
migration_template "migrations/#{name}", "db/migrate/#{name.gsub(/^\d+_/,'')}"
|
71
|
-
sleep 1
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
67
|
end
|
76
68
|
end
|
77
69
|
end
|
data/lib/lalala/engine.rb
CHANGED
@@ -9,6 +9,15 @@ module Lalala
|
|
9
9
|
config.lalala.i18n = ActiveSupport::OrderedOptions.new
|
10
10
|
config.lalala.i18n.adapter = nil
|
11
11
|
|
12
|
+
initializer "lalala.migrations" do |app|
|
13
|
+
app.class.configure do
|
14
|
+
if app.class.to_s == "Dummy::Application"
|
15
|
+
else
|
16
|
+
config.paths['db/migrate'] += Lalala::Engine.paths['db/migrate'].existent
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
12
21
|
initializer "lalala.threadsafe" do |app|
|
13
22
|
unless Rails.env.development? or Rails.env.test?
|
14
23
|
app.config.threadsafe!
|
data/lib/lalala/version.rb
CHANGED
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20130506155010) do
|
15
15
|
|
16
16
|
create_table "active_admin_comments", :force => true do |t|
|
17
17
|
t.string "resource_id", :null => false
|
@@ -46,6 +46,25 @@ ActiveRecord::Schema.define(:version => 20130327213858) do
|
|
46
46
|
add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
|
47
47
|
add_index "admin_users", ["reset_password_token"], :name => "index_admin_users_on_reset_password_token", :unique => true
|
48
48
|
|
49
|
+
create_table "asset_translations", :force => true do |t|
|
50
|
+
t.string "locale"
|
51
|
+
t.integer "asset_id"
|
52
|
+
t.string "title"
|
53
|
+
t.text "caption"
|
54
|
+
end
|
55
|
+
|
56
|
+
create_table "assets", :force => true do |t|
|
57
|
+
t.string "asset"
|
58
|
+
t.string "type"
|
59
|
+
t.integer "asset_owner_id"
|
60
|
+
t.string "asset_owner_type"
|
61
|
+
t.string "asset_owner_section"
|
62
|
+
t.datetime "created_at", :null => false
|
63
|
+
t.datetime "updated_at", :null => false
|
64
|
+
end
|
65
|
+
|
66
|
+
add_index "assets", ["asset_owner_id", "asset_owner_type", "asset_owner_section"], :name => "asset_owner_idx"
|
67
|
+
|
49
68
|
create_table "page_hierarchies", :id => false, :force => true do |t|
|
50
69
|
t.integer "ancestor_id", :null => false
|
51
70
|
t.integer "descendant_id", :null => false
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lalala
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.dev.
|
4
|
+
version: 4.0.0.dev.165
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Menke
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-05-
|
16
|
+
date: 2013-05-24 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: carrierwave
|
@@ -1333,6 +1333,13 @@ files:
|
|
1333
1333
|
- config/initializers/active_admin.rb
|
1334
1334
|
- config/initializers/carrierwave.rb
|
1335
1335
|
- config/routes.rb
|
1336
|
+
- db/migrate/20130321140345_devise_create_admin_users.rb
|
1337
|
+
- db/migrate/20130321140351_create_admin_notes.rb
|
1338
|
+
- db/migrate/20130321140352_move_admin_notes_to_comments.rb
|
1339
|
+
- db/migrate/20130321140353_create_pages.rb
|
1340
|
+
- db/migrate/20130328171232_create_images.rb
|
1341
|
+
- db/migrate/20130423142125_replace_images_with_assets.rb
|
1342
|
+
- db/migrate/20130506155010_add_locale_to_asset_translations.rb
|
1336
1343
|
- lalala-assets.gemspec
|
1337
1344
|
- lalala-development.gemspec
|
1338
1345
|
- lalala-test.gemspec
|
@@ -1350,10 +1357,6 @@ files:
|
|
1350
1357
|
- lib/generators/lalala/install/templates/application_page.rb
|
1351
1358
|
- lib/generators/lalala/install/templates/dashboard.rb
|
1352
1359
|
- lib/generators/lalala/install/templates/errors_controller.rb
|
1353
|
-
- lib/generators/lalala/install/templates/migrations/1_create_admin_notes.rb
|
1354
|
-
- lib/generators/lalala/install/templates/migrations/2_move_admin_notes_to_comments.rb
|
1355
|
-
- lib/generators/lalala/install/templates/migrations/3_create_pages.rb
|
1356
|
-
- lib/generators/lalala/install/templates/migrations/4_create_assets.rb
|
1357
1360
|
- lib/generators/lalala/install/templates/models/file_asset.rb
|
1358
1361
|
- lib/generators/lalala/install/templates/models/image_asset.rb
|
1359
1362
|
- lib/generators/lalala/install/templates/pages_controller.rb
|
@@ -1455,10 +1458,6 @@ files:
|
|
1455
1458
|
- test/dummy/config/locales/en.yml
|
1456
1459
|
- test/dummy/config/routes.rb
|
1457
1460
|
- test/dummy/db/.gitkeep
|
1458
|
-
- test/dummy/db/migrate/20130327213850_devise_create_admin_users.rb
|
1459
|
-
- test/dummy/db/migrate/20130327213856_create_admin_notes.rb
|
1460
|
-
- test/dummy/db/migrate/20130327213857_move_admin_notes_to_comments.rb
|
1461
|
-
- test/dummy/db/migrate/20130327213858_create_pages.rb
|
1462
1461
|
- test/dummy/db/schema.rb
|
1463
1462
|
- test/dummy/lib/assets/.gitkeep
|
1464
1463
|
- test/dummy/log/.gitkeep
|
@@ -1537,10 +1536,6 @@ test_files:
|
|
1537
1536
|
- test/dummy/config/locales/en.yml
|
1538
1537
|
- test/dummy/config/routes.rb
|
1539
1538
|
- test/dummy/db/.gitkeep
|
1540
|
-
- test/dummy/db/migrate/20130327213850_devise_create_admin_users.rb
|
1541
|
-
- test/dummy/db/migrate/20130327213856_create_admin_notes.rb
|
1542
|
-
- test/dummy/db/migrate/20130327213857_move_admin_notes_to_comments.rb
|
1543
|
-
- test/dummy/db/migrate/20130327213858_create_pages.rb
|
1544
1539
|
- test/dummy/db/schema.rb
|
1545
1540
|
- test/dummy/lib/assets/.gitkeep
|
1546
1541
|
- test/dummy/log/.gitkeep
|
@@ -1,42 +0,0 @@
|
|
1
|
-
class CreatePages < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
create_table :pages do |t|
|
4
|
-
t.integer :parent_id
|
5
|
-
t.integer :position
|
6
|
-
t.string :type
|
7
|
-
t.string :static_uuid
|
8
|
-
|
9
|
-
t.timestamps
|
10
|
-
end
|
11
|
-
|
12
|
-
create_table :page_hierarchies, :id => false do |t|
|
13
|
-
t.integer :ancestor_id, :null => false # ID of the parent/grandparent/great-grandparent/... tag
|
14
|
-
t.integer :descendant_id, :null => false # ID of the target tag
|
15
|
-
t.integer :generations, :null => false # Number of generations between the ancestor and the descendant. Parent/child = 1, for example.
|
16
|
-
end
|
17
|
-
|
18
|
-
create_table :page_translations do |t|
|
19
|
-
t.references :page
|
20
|
-
t.string :locale
|
21
|
-
|
22
|
-
t.string :title
|
23
|
-
t.string :path_component
|
24
|
-
t.text :body
|
25
|
-
end
|
26
|
-
|
27
|
-
add_index :page_hierarchies, [:ancestor_id, :descendant_id], :unique => true
|
28
|
-
add_index :page_hierarchies, [:descendant_id]
|
29
|
-
add_index :page_translations, [:page_id]
|
30
|
-
add_index :page_translations, [:locale]
|
31
|
-
add_index :page_translations, [:path_component]
|
32
|
-
|
33
|
-
# Reset the column info
|
34
|
-
ApplicationPage.reset_column_information
|
35
|
-
end
|
36
|
-
|
37
|
-
def down
|
38
|
-
drop_table :pages
|
39
|
-
drop_table :page_hierarchies
|
40
|
-
drop_table :page_translations
|
41
|
-
end
|
42
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
class CreateAssets < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
create_table :assets do |t|
|
4
|
-
t.string :asset # carrierwave file mount
|
5
|
-
t.string :type
|
6
|
-
|
7
|
-
t.references :asset_owner, polymorphic: true
|
8
|
-
t.string :asset_owner_section
|
9
|
-
|
10
|
-
t.timestamps
|
11
|
-
end
|
12
|
-
|
13
|
-
add_index :assets, [:asset_owner_id, :asset_owner_type, :asset_owner_section], name: 'asset_owner_idx'
|
14
|
-
|
15
|
-
ImageAsset.create_translation_table! title: :string, caption: :text
|
16
|
-
end
|
17
|
-
|
18
|
-
def down
|
19
|
-
drop_table :assets
|
20
|
-
|
21
|
-
ImageAsset.drop_translation_table!
|
22
|
-
end
|
23
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class CreateAdminNotes < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :admin_notes do |t|
|
4
|
-
t.string :resource_id, :null => false
|
5
|
-
t.string :resource_type, :null => false
|
6
|
-
t.references :admin_user, :polymorphic => true
|
7
|
-
t.text :body
|
8
|
-
t.timestamps
|
9
|
-
end
|
10
|
-
add_index :admin_notes, [:resource_type, :resource_id]
|
11
|
-
add_index :admin_notes, [:admin_user_type, :admin_user_id]
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.down
|
15
|
-
drop_table :admin_notes
|
16
|
-
end
|
17
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
class MoveAdminNotesToComments < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
remove_index :admin_notes, [:admin_user_type, :admin_user_id]
|
4
|
-
rename_table :admin_notes, :active_admin_comments
|
5
|
-
rename_column :active_admin_comments, :admin_user_type, :author_type
|
6
|
-
rename_column :active_admin_comments, :admin_user_id, :author_id
|
7
|
-
add_column :active_admin_comments, :namespace, :string
|
8
|
-
add_index :active_admin_comments, [:namespace]
|
9
|
-
add_index :active_admin_comments, [:author_type, :author_id]
|
10
|
-
|
11
|
-
# Update all the existing comments to the default namespace
|
12
|
-
say "Updating any existing comments to the #{ActiveAdmin.application.default_namespace} namespace."
|
13
|
-
comments_table_name = ActiveRecord::Migrator.proper_table_name("active_admin_comments")
|
14
|
-
execute "UPDATE #{comments_table_name} SET namespace='#{ActiveAdmin.application.default_namespace}'"
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.down
|
18
|
-
remove_index :active_admin_comments, :column => [:author_type, :author_id]
|
19
|
-
remove_index :active_admin_comments, :column => [:namespace]
|
20
|
-
remove_column :active_admin_comments, :namespace
|
21
|
-
rename_column :active_admin_comments, :author_id, :admin_user_id
|
22
|
-
rename_column :active_admin_comments, :author_type, :admin_user_type
|
23
|
-
rename_table :active_admin_comments, :admin_notes
|
24
|
-
add_index :admin_notes, [:admin_user_type, :admin_user_id]
|
25
|
-
end
|
26
|
-
end
|