blacksand 2.4.1 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/blacksand/navigation.rb +1 -1
- data/app/models/blacksand/page.rb +3 -3
- data/lib/blacksand/engine.rb +1 -1
- data/lib/blacksand/migrations.rb +18 -0
- data/lib/blacksand/version.rb +1 -1
- data/lib/generators/blacksand/install_generator.rb +16 -0
- data/lib/tasks/blacksand_tasks.rake +7 -4
- metadata +33 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbb79dbfee63a76f5004d6d090ecf88aaf821d37
|
4
|
+
data.tar.gz: 07b9659e3a1eb6f675d0df2db27109c9d7ede3b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab9910cd2a9a323e739aac62b0d9f1009dc51a19354c087823f4b51d489b1f7b84733ef1e4bd873c62ef480385a0724d5bc9959c2f53bdd2fb5f625cad7a50d2
|
7
|
+
data.tar.gz: a113c68689401a6c6326c964337cb847da3b6ca7424c65bec93af4dd8fa9f3c65d6c4d04fa71b055e4751f09c3525f4baf73fbe704b4e845ec021fe0b7bbf8d9
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Blacksand
|
2
2
|
class Navigation < ActiveRecord::Base
|
3
|
-
belongs_to :page
|
3
|
+
belongs_to :page, required: false
|
4
4
|
|
5
5
|
# ActiveRecord attribute api changed, see http://api.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html#method-i-attribute
|
6
6
|
if ActiveRecord::VERSION::MAJOR >= 5
|
@@ -2,12 +2,12 @@ require 'uri'
|
|
2
2
|
|
3
3
|
module Blacksand
|
4
4
|
class Page < ActiveRecord::Base
|
5
|
-
belongs_to :parent, class_name: Page, foreign_key: 'parent_id'
|
5
|
+
belongs_to :parent, class_name: Page, foreign_key: 'parent_id', required: false
|
6
6
|
has_many :children, class_name: Page, foreign_key: 'parent_id', :dependent => :destroy
|
7
7
|
has_one :navigation, :dependent => :destroy
|
8
8
|
|
9
|
-
belongs_to :template
|
10
|
-
belongs_to :prototype
|
9
|
+
belongs_to :template, required: false
|
10
|
+
belongs_to :prototype, required: false
|
11
11
|
|
12
12
|
has_many :properties, :dependent => :destroy
|
13
13
|
has_many_kindeditor_assets :attachments, :dependent => :destroy
|
data/lib/blacksand/engine.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rails'
|
2
2
|
require 'carrierwave'
|
3
3
|
require 'rails_kindeditor'
|
4
|
-
# TODO: may be optional
|
5
4
|
require 'mini_magick'
|
6
5
|
require 'kaminari'
|
7
6
|
require 'bootstrap-kaminari-views'
|
@@ -11,6 +10,7 @@ require 'bootstrap-sass'
|
|
11
10
|
require 'bootstrap_form'
|
12
11
|
require 'cocoon'
|
13
12
|
require 'font-awesome-rails'
|
13
|
+
require 'jquery-rails'
|
14
14
|
require 'enumerize'
|
15
15
|
require 'ransack'
|
16
16
|
require 'themes_on_rails'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module Blacksand
|
4
|
+
class Migrations < Thor
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
# 修正 migration 的父类,默认是 ActiveRecord::Migration, 但是 Rails 5.1 以后,
|
8
|
+
# 必须指定版本,例如 ActiveRecord::Migration[5.1]
|
9
|
+
def fix_migration_super_class
|
10
|
+
if ActiveRecord::VERSION::MAJOR > 5 || ( ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR >= 1 )
|
11
|
+
puts "Fix migration super class"
|
12
|
+
Dir.glob("db/migrate/*.blacksand.rb") do |file|
|
13
|
+
gsub_file(file, /ActiveRecord::Migration$/, "ActiveRecord::Migration[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/blacksand/version.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rails/generators'
|
2
|
+
require 'blacksand/migrations'
|
2
3
|
|
3
4
|
module Blacksand
|
4
5
|
module Generators
|
@@ -24,7 +25,22 @@ Blacksand.site_name = 'site name'
|
|
24
25
|
# Blacksand.page_caching = false
|
25
26
|
RUBY
|
26
27
|
|
28
|
+
copy_migrations
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def copy_migrations
|
27
33
|
rake 'railties:install:migrations'
|
34
|
+
|
35
|
+
Blacksand::Migrations.new.fix_migration_super_class
|
36
|
+
# # 修正 migration 的父类,默认是 ActiveRecord::Migration, 但是 Rails 5.1 以后,
|
37
|
+
# # 必须指定版本,例如 ActiveRecord::Migration[5.1]
|
38
|
+
# if ActiveRecord::VERSION::MAJOR > 5 || ( ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR >= 1 )
|
39
|
+
# puts "Fix migration super class"
|
40
|
+
# Dir.glob("db/migrate/*.blacksand.rb") do |file|
|
41
|
+
# gsub_file(file, /ActiveRecord::Migration$/, "ActiveRecord::Migration[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]")
|
42
|
+
# end
|
43
|
+
# end
|
28
44
|
end
|
29
45
|
end
|
30
46
|
end
|
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
# task :blacksand do
|
3
|
-
# # Task goes here
|
4
|
-
# end
|
1
|
+
require 'blacksand/migrations'
|
5
2
|
|
6
3
|
namespace :blacksand do
|
7
4
|
desc "Clean unsued kindeditor assets"
|
@@ -69,4 +66,10 @@ namespace :blacksand do
|
|
69
66
|
p.destroy!
|
70
67
|
end
|
71
68
|
end
|
69
|
+
|
70
|
+
desc "update migrations"
|
71
|
+
task :update_migrations do
|
72
|
+
Rake::Task["blacksand:install:migrations"].invoke
|
73
|
+
Blacksand::Migrations.new.fix_migration_super_class
|
74
|
+
end
|
72
75
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacksand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bastengao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rails
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -19,7 +33,7 @@ dependencies:
|
|
19
33
|
version: 4.2.6
|
20
34
|
- - "<"
|
21
35
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
36
|
+
version: '5.2'
|
23
37
|
type: :runtime
|
24
38
|
prerelease: false
|
25
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +43,21 @@ dependencies:
|
|
29
43
|
version: 4.2.6
|
30
44
|
- - "<"
|
31
45
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
46
|
+
version: '5.2'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: jquery-rails
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
33
61
|
- !ruby/object:Gem::Dependency
|
34
62
|
name: actionpack-page_caching
|
35
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -493,6 +521,7 @@ files:
|
|
493
521
|
- lib/blacksand/controller_helper.rb
|
494
522
|
- lib/blacksand/engine.rb
|
495
523
|
- lib/blacksand/expire_pages.rb
|
524
|
+
- lib/blacksand/migrations.rb
|
496
525
|
- lib/blacksand/my_json_type.rb
|
497
526
|
- lib/blacksand/routing.rb
|
498
527
|
- lib/blacksand/version.rb
|