trusty-cms 3.2.1 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: e5ddc264335fbd890cf3212f6c6e708f580b8327360ae1b546f3d0afdbb16fa1
4
- data.tar.gz: 99d7b1cdb1e1bc58711eb011122759cb6181cb996680efa1c6ca6772f64805c4
2
+ SHA1:
3
+ metadata.gz: '08f5e8a4af024687fbd7b3254c2b59c20d5f33e3'
4
+ data.tar.gz: 89474a5f5fa76618a79704889210b170a2584be5
5
5
  SHA512:
6
- metadata.gz: e057443e2a5046911cd47e598cf0d4b4470e3fb0cf35b6cad34650d51d5cf4c3ceb62b987db78f042c84a2d5affa6ee6f9291ff0b1e2cc35757dc28507665d0d
7
- data.tar.gz: a1501ed9820469a30c2f7dbbd1e76d7086010d1e5a6a9dd70374f27034a8c26d355eba9ab56f57ca8e642cd834cfc8cb4a988b9d7adeb7d7c0f8c412966919a3
6
+ metadata.gz: 871dcea0008cb217654ade4a262dc0421b1abaaf4ea10e70523a819a45186e9ce6a6584be3f3b305208204a502879114af031cded53a026717eeaeb8d049ff4c
7
+ data.tar.gz: 8f3028f2224bad2539abc7f4fb9beef0838e13200e4055871a4e44f121d4b768949a3eb489aba4cebb4110b07bfadf8a0616dc0750b83b1f64400820d98d7dbc
data/Gemfile CHANGED
@@ -19,9 +19,8 @@ group :development, :test do
19
19
  gem 'factory_bot_rails'
20
20
  gem 'launchy', '~> 2.4.2'
21
21
  gem 'mysql2', '~> 0.4.2'
22
- gem 'rails-observers', :git => 'https://github.com/rails/rails-observers'
23
- gem 'rspec-rails'
24
22
  gem 'poltergeist', '~> 1.14.0'
25
- gem 'protected_attributes_continued'
26
23
  gem 'pry-byebug'
24
+ gem 'rails-observers'
25
+ gem 'rspec-rails'
27
26
  end
data/Gemfile.lock CHANGED
@@ -1,14 +1,7 @@
1
- GIT
2
- remote: https://github.com/rails/rails-observers
3
- revision: fb6b95509c3f1a50c973280ddc2b56648e33623f
4
- specs:
5
- rails-observers (0.2.0)
6
- activemodel (>= 4.2)
7
-
8
1
  PATH
9
2
  remote: .
10
3
  specs:
11
- trusty-cms (3.2.1)
4
+ trusty-cms (3.3.0)
12
5
  RedCloth (= 4.3.2)
13
6
  acts_as_list (~> 0.9.5)
14
7
  acts_as_tree (~> 2.6.1)
@@ -27,7 +20,7 @@ PATH
27
20
  rack (~> 2.0.1)
28
21
  rack-cache (~> 1.7)
29
22
  radius (~> 0.7)
30
- rails (~> 5.1)
23
+ rails (~> 5.2.0.rc2)
31
24
  rake (< 11.0)
32
25
  rdoc (~> 5.1)
33
26
  roadie-rails (~> 1.2.1)
@@ -42,39 +35,43 @@ GEM
42
35
  remote: https://rubygems.org/
43
36
  specs:
44
37
  RedCloth (4.3.2)
45
- actioncable (5.1.6)
46
- actionpack (= 5.1.6)
38
+ actioncable (5.2.0.rc2)
39
+ actionpack (= 5.2.0.rc2)
47
40
  nio4r (~> 2.0)
48
- websocket-driver (~> 0.6.1)
49
- actionmailer (5.1.6)
50
- actionpack (= 5.1.6)
51
- actionview (= 5.1.6)
52
- activejob (= 5.1.6)
41
+ websocket-driver (>= 0.6.1)
42
+ actionmailer (5.2.0.rc2)
43
+ actionpack (= 5.2.0.rc2)
44
+ actionview (= 5.2.0.rc2)
45
+ activejob (= 5.2.0.rc2)
53
46
  mail (~> 2.5, >= 2.5.4)
54
47
  rails-dom-testing (~> 2.0)
55
- actionpack (5.1.6)
56
- actionview (= 5.1.6)
57
- activesupport (= 5.1.6)
48
+ actionpack (5.2.0.rc2)
49
+ actionview (= 5.2.0.rc2)
50
+ activesupport (= 5.2.0.rc2)
58
51
  rack (~> 2.0)
59
52
  rack-test (>= 0.6.3)
60
53
  rails-dom-testing (~> 2.0)
61
54
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
62
- actionview (5.1.6)
63
- activesupport (= 5.1.6)
55
+ actionview (5.2.0.rc2)
56
+ activesupport (= 5.2.0.rc2)
64
57
  builder (~> 3.1)
65
58
  erubi (~> 1.4)
66
59
  rails-dom-testing (~> 2.0)
67
60
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
68
- activejob (5.1.6)
69
- activesupport (= 5.1.6)
61
+ activejob (5.2.0.rc2)
62
+ activesupport (= 5.2.0.rc2)
70
63
  globalid (>= 0.3.6)
71
- activemodel (5.1.6)
72
- activesupport (= 5.1.6)
73
- activerecord (5.1.6)
74
- activemodel (= 5.1.6)
75
- activesupport (= 5.1.6)
76
- arel (~> 8.0)
77
- activesupport (5.1.6)
64
+ activemodel (5.2.0.rc2)
65
+ activesupport (= 5.2.0.rc2)
66
+ activerecord (5.2.0.rc2)
67
+ activemodel (= 5.2.0.rc2)
68
+ activesupport (= 5.2.0.rc2)
69
+ arel (>= 9.0)
70
+ activestorage (5.2.0.rc2)
71
+ actionpack (= 5.2.0.rc2)
72
+ activerecord (= 5.2.0.rc2)
73
+ marcel (~> 0.3.1)
74
+ activesupport (5.2.0.rc2)
78
75
  concurrent-ruby (~> 1.0, >= 1.0.2)
79
76
  i18n (>= 0.7, < 2)
80
77
  minitest (~> 5.1)
@@ -85,7 +82,7 @@ GEM
85
82
  activerecord (>= 3.0.0)
86
83
  addressable (2.5.2)
87
84
  public_suffix (>= 2.0.2, < 4.0)
88
- arel (8.0.0)
85
+ arel (9.0.0)
89
86
  builder (3.2.3)
90
87
  byebug (10.0.2)
91
88
  capybara (2.18.0)
@@ -175,6 +172,8 @@ GEM
175
172
  nokogiri (>= 1.5.9)
176
173
  mail (2.7.0)
177
174
  mini_mime (>= 0.1.1)
175
+ marcel (0.3.2)
176
+ mimemagic (~> 0.3.2)
178
177
  method_source (0.9.0)
179
178
  mime-types (3.1)
180
179
  mime-types-data (~> 3.2015)
@@ -201,8 +200,6 @@ GEM
201
200
  capybara (~> 2.1)
202
201
  cliver (~> 0.3.1)
203
202
  websocket-driver (>= 0.2.0)
204
- protected_attributes_continued (1.3.0)
205
- activemodel (~> 5.0)
206
203
  pry (0.11.3)
207
204
  coderay (~> 1.1.0)
208
205
  method_source (~> 0.9.0)
@@ -216,26 +213,29 @@ GEM
216
213
  rack-test (1.0.0)
217
214
  rack (>= 1.0, < 3)
218
215
  radius (0.7.4)
219
- rails (5.1.6)
220
- actioncable (= 5.1.6)
221
- actionmailer (= 5.1.6)
222
- actionpack (= 5.1.6)
223
- actionview (= 5.1.6)
224
- activejob (= 5.1.6)
225
- activemodel (= 5.1.6)
226
- activerecord (= 5.1.6)
227
- activesupport (= 5.1.6)
216
+ rails (5.2.0.rc2)
217
+ actioncable (= 5.2.0.rc2)
218
+ actionmailer (= 5.2.0.rc2)
219
+ actionpack (= 5.2.0.rc2)
220
+ actionview (= 5.2.0.rc2)
221
+ activejob (= 5.2.0.rc2)
222
+ activemodel (= 5.2.0.rc2)
223
+ activerecord (= 5.2.0.rc2)
224
+ activestorage (= 5.2.0.rc2)
225
+ activesupport (= 5.2.0.rc2)
228
226
  bundler (>= 1.3.0)
229
- railties (= 5.1.6)
227
+ railties (= 5.2.0.rc2)
230
228
  sprockets-rails (>= 2.0.0)
231
229
  rails-dom-testing (2.0.3)
232
230
  activesupport (>= 4.2.0)
233
231
  nokogiri (>= 1.6)
234
232
  rails-html-sanitizer (1.0.4)
235
233
  loofah (~> 2.2, >= 2.2.2)
236
- railties (5.1.6)
237
- actionpack (= 5.1.6)
238
- activesupport (= 5.1.6)
234
+ rails-observers (0.1.5)
235
+ activemodel (>= 4.0)
236
+ railties (5.2.0.rc2)
237
+ actionpack (= 5.2.0.rc2)
238
+ activesupport (= 5.2.0.rc2)
239
239
  method_source
240
240
  rake (>= 0.8.7)
241
241
  thor (>= 0.18.1, < 2.0)
@@ -245,7 +245,7 @@ GEM
245
245
  ffi (>= 0.5.0, < 2)
246
246
  rdoc (5.1.0)
247
247
  ref (2.0.0)
248
- roadie (3.3.0)
248
+ roadie (3.2.2)
249
249
  css_parser (~> 1.4)
250
250
  nokogiri (~> 1.5)
251
251
  roadie-rails (1.2.1)
@@ -277,7 +277,7 @@ GEM
277
277
  sprockets (>= 2.8, < 4.0)
278
278
  sprockets-rails (>= 2.0, < 4.0)
279
279
  tilt (>= 1.1, < 3)
280
- sexp_processor (4.11.0)
280
+ sexp_processor (4.10.1)
281
281
  simplecov (0.13.0)
282
282
  docile (~> 1.1.0)
283
283
  json (>= 1.8, < 3)
@@ -307,7 +307,7 @@ GEM
307
307
  uglifier (3.2.0)
308
308
  execjs (>= 0.3.0, < 3)
309
309
  uuidtools (2.1.5)
310
- websocket-driver (0.6.5)
310
+ websocket-driver (0.7.0)
311
311
  websocket-extensions (>= 0.1.0)
312
312
  websocket-extensions (0.1.3)
313
313
  will_paginate (3.1.6)
@@ -326,9 +326,8 @@ DEPENDENCIES
326
326
  launchy (~> 2.4.2)
327
327
  mysql2 (~> 0.4.2)
328
328
  poltergeist (~> 1.14.0)
329
- protected_attributes_continued
330
329
  pry-byebug
331
- rails-observers!
330
+ rails-observers
332
331
  rspec-rails
333
332
  trusty-cms!
334
333
  trustygems (~> 0.2.0)
data/app/models/asset.rb CHANGED
@@ -10,7 +10,7 @@ class Asset < ActiveRecord::Base
10
10
 
11
11
  default_scope {order("created_at DESC")}
12
12
 
13
- attr_accessible :title, :asset, :caption
13
+ attr_accessor :title, :asset, :caption
14
14
 
15
15
  scope :latest, lambda { |limit|
16
16
  order("created_at DESC").limit(limit)
@@ -189,7 +189,7 @@ private
189
189
  end
190
190
 
191
191
  def assign_title
192
- self.title = self.asset_file_name.downcase.sub(self.original_extension, "").sub(".", "")
192
+ self.title = self.asset_file_name.sub(self.original_extension, "").sub(".", "")
193
193
  end
194
194
 
195
195
  def assign_uuid
data/app/models/page.rb CHANGED
@@ -9,9 +9,9 @@ class Page < ActiveRecord::Base
9
9
 
10
10
  # Associations
11
11
  acts_as_tree :order => 'title ASC'
12
- has_many :parts, {:class_name => 'PagePart', :dependent => :destroy}, -> {order(:id)}
12
+ has_many :parts, -> {order(:id)}, :class_name => 'PagePart', :dependent => :destroy
13
13
  accepts_nested_attributes_for :parts, :allow_destroy => true
14
- has_many :fields, {:class_name => 'PageField', :dependent => :destroy}, -> {order(:id)}
14
+ has_many :fields, -> {order(:id)}, :class_name => 'PageField', :dependent => :destroy
15
15
  accepts_nested_attributes_for :fields, :allow_destroy => true
16
16
  belongs_to :layout
17
17
  belongs_to :created_by, :class_name => 'User'
@@ -282,14 +282,16 @@ class Page < ActiveRecord::Base
282
282
  $1.camelize.constantize if page =~ %r{/([^/]+)\.rb}
283
283
  end
284
284
  end
285
- if ActiveRecord::Base.connection.data_sources.include?('pages') && Page.column_names.include?('class_name') # Assume that we have bootstrapped
286
- Page.connection.select_values("SELECT DISTINCT class_name FROM pages WHERE class_name <> '' AND class_name IS NOT NULL").each do |p|
287
- begin
288
- p.constantize
289
- rescue NameError, LoadError
290
- #Rubocop: The use of eval is a serious security risk.
291
- #eval(%Q{class #{p} < Page; acts_as_tree; def self.missing?; true end end}, TOPLEVEL_BINDING)
292
- Rails.logger.error NameError
285
+ if database_exists?
286
+ if ActiveRecord::Base.connection.data_sources.include?('pages') && Page.column_names.include?('class_name') # Assume that we have bootstrapped
287
+ Page.connection.select_values("SELECT DISTINCT class_name FROM pages WHERE class_name <> '' AND class_name IS NOT NULL").each do |p|
288
+ begin
289
+ p.constantize
290
+ rescue NameError, LoadError
291
+ #Rubocop: The use of eval is a serious security risk.
292
+ #eval(%Q{class #{p} < Page; acts_as_tree; def self.missing?; true end end}, TOPLEVEL_BINDING)
293
+ Rails.logger.error NameError
294
+ end
293
295
  end
294
296
  end
295
297
  end
@@ -364,6 +366,14 @@ class Page < ActiveRecord::Base
364
366
  !parent.nil?
365
367
  end
366
368
 
369
+ def database_exists?
370
+ ActiveRecord::Base.connection
371
+ rescue ActiveRecord::NoDatabaseError
372
+ false
373
+ else
374
+ true
375
+ end
376
+
367
377
  def lazy_initialize_parser_and_context
368
378
  unless @parser and @context
369
379
  @context = PageContext.new(self)
@@ -76,23 +76,35 @@ module TrustyCms
76
76
 
77
77
  class << self
78
78
  def [](key)
79
- if table_exists?
80
- unless TrustyCms::Config.cache_file_exists?
81
- TrustyCms::Config.ensure_cache_file
82
- TrustyCms::Config.initialize_cache
79
+ if database_exists?
80
+ if table_exists?
81
+ unless TrustyCms::Config.cache_file_exists?
82
+ TrustyCms::Config.ensure_cache_file
83
+ TrustyCms::Config.initialize_cache
84
+ end
85
+ TrustyCms::Config.initialize_cache if TrustyCms::Config.stale_cache?
86
+ Rails.cache.read('TrustyCms::Config')[key]
83
87
  end
84
- TrustyCms::Config.initialize_cache if TrustyCms::Config.stale_cache?
85
- Rails.cache.read('TrustyCms::Config')[key]
86
88
  end
87
89
  end
88
90
 
89
91
  def []=(key, value)
90
- if table_exists?
91
- setting = where(key: key).first_or_initialize
92
- setting.value = value
92
+ if database_exists?
93
+ if table_exists?
94
+ setting = where(key: key).first_or_initialize
95
+ setting.value = value
96
+ end
93
97
  end
94
98
  end
95
99
 
100
+ def database_exists?
101
+ ActiveRecord::Base.connection
102
+ rescue ActiveRecord::NoDatabaseError
103
+ false
104
+ else
105
+ true
106
+ end
107
+
96
108
  def to_hash
97
109
  Hash[ *all.map { |pair| [pair.key, pair.value] }.flatten ]
98
110
  end
@@ -65,7 +65,6 @@ To add more extensions just add them to your Gemfile and run `bundle install`.
65
65
  desc "Migrate the database through all available migration scripts (looks for db/migrate/* in trusty-cms, in extensions and in your site) and update db/schema.rb by invoking db:schema:dump. Turn off output with VERBOSE=false."
66
66
  task :migrate => [:environment, 'db:migrate:trusty_cms', 'db:migrate:extensions'] do
67
67
  ActiveRecord::Migration[5.1].verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
68
- ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
69
68
  Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
70
69
  end
71
70
 
@@ -73,7 +72,6 @@ To add more extensions just add them to your Gemfile and run `bundle install`.
73
72
  desc "Migrates the database through steps defined in the core trusty-cms distribution. Usual db:migrate options can apply."
74
73
  task :trusty_cms => :environment do
75
74
  ActiveRecord::Migration[5.1].verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
76
- ActiveRecord::Migrator.migrate(File.join(TrustyCms.root, 'db', 'migrate'), ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
77
75
  Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
78
76
  end
79
77
  end
data/lib/trusty_cms.rb CHANGED
@@ -2,6 +2,6 @@ TRUSTY_CMS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..")) unle
2
2
 
3
3
  unless defined? TrustyCms::VERSION
4
4
  module TrustyCms
5
- VERSION = '3.2.1'
5
+ VERSION = '3.3.0'
6
6
  end
7
7
  end
@@ -1,4 +1,4 @@
1
1
  test: &TEST
2
2
  adapter: mysql2
3
- database: radiant_test
3
+ database: trusty_cms_test
4
4
  username:
@@ -10,9 +10,9 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 20161027141250) do
13
+ ActiveRecord::Schema.define(version: 2016_10_27_141250) do
14
14
 
15
- create_table "assets", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
15
+ create_table "assets", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
16
16
  t.string "caption"
17
17
  t.string "title"
18
18
  t.string "asset_file_name"
@@ -28,19 +28,19 @@ ActiveRecord::Schema.define(version: 20161027141250) do
28
28
  t.string "original_extension"
29
29
  end
30
30
 
31
- create_table "config", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
31
+ create_table "config", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
32
32
  t.string "key", limit: 40, default: "", null: false
33
33
  t.string "value", default: ""
34
34
  t.index ["key"], name: "key", unique: true
35
35
  end
36
36
 
37
- create_table "extension_meta", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
37
+ create_table "extension_meta", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
38
38
  t.string "name"
39
39
  t.integer "schema_version", default: 0
40
40
  t.boolean "enabled", default: true
41
41
  end
42
42
 
43
- create_table "layouts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
43
+ create_table "layouts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
44
44
  t.string "name", limit: 100
45
45
  t.text "content"
46
46
  t.datetime "created_at"
@@ -52,20 +52,20 @@ ActiveRecord::Schema.define(version: 20161027141250) do
52
52
  t.integer "site_id"
53
53
  end
54
54
 
55
- create_table "page_attachments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
55
+ create_table "page_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
56
56
  t.integer "asset_id"
57
57
  t.integer "page_id"
58
58
  t.integer "position"
59
59
  end
60
60
 
61
- create_table "page_fields", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
61
+ create_table "page_fields", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
62
62
  t.integer "page_id"
63
63
  t.string "name"
64
64
  t.string "content"
65
65
  t.index ["page_id", "name", "content"], name: "index_page_fields_on_page_id_and_name_and_content"
66
66
  end
67
67
 
68
- create_table "page_parts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
68
+ create_table "page_parts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
69
69
  t.string "name", limit: 100
70
70
  t.string "filter_id", limit: 25
71
71
  t.text "content", limit: 16777215
@@ -73,7 +73,7 @@ ActiveRecord::Schema.define(version: 20161027141250) do
73
73
  t.index ["page_id", "name"], name: "parts_by_page"
74
74
  end
75
75
 
76
- create_table "pages", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
76
+ create_table "pages", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
77
77
  t.string "title"
78
78
  t.string "slug", limit: 100
79
79
  t.string "breadcrumb", limit: 160
@@ -98,7 +98,7 @@ ActiveRecord::Schema.define(version: 20161027141250) do
98
98
  t.index ["virtual", "status_id"], name: "pages_published"
99
99
  end
100
100
 
101
- create_table "sessions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
101
+ create_table "sessions", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
102
102
  t.string "session_id"
103
103
  t.text "data"
104
104
  t.datetime "updated_at"
@@ -106,7 +106,7 @@ ActiveRecord::Schema.define(version: 20161027141250) do
106
106
  t.index ["updated_at"], name: "index_sessions_on_updated_at"
107
107
  end
108
108
 
109
- create_table "sites", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
109
+ create_table "sites", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
110
110
  t.string "name"
111
111
  t.string "domain"
112
112
  t.integer "homepage_id"
@@ -120,7 +120,7 @@ ActiveRecord::Schema.define(version: 20161027141250) do
120
120
  t.string "base_domain"
121
121
  end
122
122
 
123
- create_table "snippets", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
123
+ create_table "snippets", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
124
124
  t.string "name", limit: 100, default: "", null: false
125
125
  t.string "filter_id", limit: 25
126
126
  t.text "content"
@@ -133,7 +133,7 @@ ActiveRecord::Schema.define(version: 20161027141250) do
133
133
  t.index ["name", "site_id"], name: "name_site_id", unique: true
134
134
  end
135
135
 
136
- create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
136
+ create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
137
137
  t.string "name", limit: 100
138
138
  t.string "email"
139
139
  t.string "login", limit: 40, default: "", null: false
data/trusty_cms.gemspec CHANGED
@@ -40,7 +40,7 @@ a general purpose content managment system--not merely a blogging engine.}
40
40
  s.add_dependency 'paperclip', '> 5.2'
41
41
  s.add_dependency 'rack', '~> 2.0.1'
42
42
  s.add_dependency 'rack-cache', '~> 1.7'
43
- s.add_dependency 'rails', '~> 5.1'
43
+ s.add_dependency 'rails', '~> 5.2.0.rc2'
44
44
  s.add_dependency 'rdoc', '~> 5.1'
45
45
  s.add_dependency 'radius', '~> 0.7'
46
46
  s.add_dependency 'RedCloth', '4.3.2'
@@ -1,5 +1,6 @@
1
1
  class ClippedExtension < TrustyCms::Extension
2
2
  migrate_from 'Paperclipped', 20100327111216
3
+ require 'admin/assets_helper'
3
4
 
4
5
  def activate
5
6
  if Asset.table_exists?
@@ -1,16 +1,16 @@
1
1
  module Admin::AssetsHelper
2
-
2
+
3
3
  def automatic_size_descriptions
4
4
  Asset.thumbnail_sizes.collect{|k,v| "#{k} (#{(v.to_s).match(/\d+x\d+/)})"}.join(', ')
5
5
  end
6
-
6
+
7
7
  def asset_insertion_link(asset)
8
8
  radius_tag = asset.asset_type.default_radius_tag || 'link';
9
9
  link_to t('clipped_extension.insert'), '#', :class => 'insert_asset', :rel => "#{radius_tag}_#{TrustyCms.config['assets.insertion_size']}_#{asset.id}"
10
10
  end
11
-
11
+
12
12
  def asset_attachment_link(asset)
13
13
  link_to t("clipped_extension.attach"), new_admin_page_attachment_path(:asset_id => asset.id), :class => 'attach_asset', :rel => "attach_#{asset.id}"
14
14
  end
15
-
16
- end
15
+
16
+ end
@@ -1,13 +1,11 @@
1
1
  module PageAssetAssociations
2
-
3
- #TODO: Turn page_attachments into a generic, polymorphic asset-attachment mechanism
4
-
2
+
5
3
  def self.included(base)
6
4
  base.class_eval {
7
5
  has_many :page_attachments, -> { order 'position desc' }
8
- has_many :assets,{ :through => :page_attachments}, -> { order 'page_attachments.position ASC' }
6
+ has_many :assets, -> { order 'page_attachments.position ASC' }, through: :page_attachments
9
7
  accepts_nested_attributes_for :page_attachments, :allow_destroy => true
10
8
  }
11
9
  end
12
-
13
- end
10
+
11
+ end
@@ -15,16 +15,26 @@ module MultiSite::ScopedValidation
15
15
  # Hence the check for a site_id column. It's a hack, but a fairly harmless one.
16
16
 
17
17
  def validates_uniqueness_of_with_site(*attr)
18
- if table_exists? && column_names.include?('site_id')
19
- configuration = attr.extract_options!
20
- configuration[:scope] ||= :site_id
21
- attr.push(configuration)
18
+ if database_exists?
19
+ if table_exists? && column_names.include?('site_id')
20
+ configuration = attr.extract_options!
21
+ configuration[:scope] ||= :site_id
22
+ attr.push(configuration)
23
+ end
24
+ validates_uniqueness_of_without_site(*attr)
22
25
  end
23
- validates_uniqueness_of_without_site(*attr)
24
26
  end
25
27
 
26
28
  alias_method :validates_uniqueness_of_without_site, :validates_uniqueness_of
27
29
  alias_method :validates_uniqueness_of, :validates_uniqueness_of_with_site
30
+
31
+ def database_exists?
32
+ ActiveRecord::Base.connection
33
+ rescue ActiveRecord::NoDatabaseError
34
+ false
35
+ else
36
+ true
37
+ end
28
38
  end
29
39
 
30
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusty-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TrustyCms CMS dev team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-24 00:00:00.000000000 Z
11
+ date: 2018-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_list
@@ -240,14 +240,14 @@ dependencies:
240
240
  requirements:
241
241
  - - "~>"
242
242
  - !ruby/object:Gem::Version
243
- version: '5.1'
243
+ version: 5.2.0.rc2
244
244
  type: :runtime
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
- version: '5.1'
250
+ version: 5.2.0.rc2
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: rdoc
253
253
  requirement: !ruby/object:Gem::Requirement
@@ -621,7 +621,6 @@ files:
621
621
  - app/controllers/application_controller.rb
622
622
  - app/controllers/site_controller.rb
623
623
  - app/controllers/social_mailer_controller.rb
624
- - app/helpers/admin/assets_helper.rb
625
624
  - app/helpers/admin/configuration_helper.rb
626
625
  - app/helpers/admin/export_helper.rb
627
626
  - app/helpers/admin/extensions_helper.rb
@@ -983,11 +982,9 @@ files:
983
982
  - lib/tasks/environments.rake
984
983
  - lib/tasks/extensions.rake
985
984
  - lib/tasks/framework.rake
986
- - lib/tasks/instance.rake
987
985
  - lib/tasks/radiant_config.rake
988
986
  - lib/tasks/snippets_extension_tasks.rake
989
987
  - lib/tasks/translate.rake
990
- - lib/tasks/undefine.rake
991
988
  - lib/translation_support.rb
992
989
  - lib/trusty_cms.rb
993
990
  - lib/trusty_cms/admin_ui.rb
@@ -1052,7 +1049,6 @@ files:
1052
1049
  - spec/dummy/config/routes.rb
1053
1050
  - spec/dummy/config/secrets.yml
1054
1051
  - spec/dummy/db/schema.rb
1055
- - spec/dummy/log/development.log
1056
1052
  - spec/dummy/log/test.log
1057
1053
  - spec/dummy/node_modules/jquery-ui-bundle/AUTHORS.txt
1058
1054
  - spec/dummy/node_modules/jquery-ui-bundle/LICENSE.txt
@@ -1225,6 +1221,7 @@ files:
1225
1221
  - spec/support/custom_actions.rb
1226
1222
  - trusty_cms.gemspec
1227
1223
  - vendor/extensions/clipped-extension/clipped_extension.rb
1224
+ - vendor/extensions/clipped-extension/lib/admin/assets_helper.rb
1228
1225
  - vendor/extensions/clipped-extension/lib/asset_tags.rb
1229
1226
  - vendor/extensions/clipped-extension/lib/clipped/engine.rb
1230
1227
  - vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb
@@ -1318,7 +1315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1318
1315
  version: 1.3.1
1319
1316
  requirements: []
1320
1317
  rubyforge_project:
1321
- rubygems_version: 2.7.6
1318
+ rubygems_version: 2.6.13
1322
1319
  signing_key:
1323
1320
  specification_version: 4
1324
1321
  summary: A no-fluff content management system designed for small teams.
@@ -1352,7 +1349,6 @@ test_files:
1352
1349
  - spec/dummy/config/secrets.yml
1353
1350
  - spec/dummy/config.ru
1354
1351
  - spec/dummy/db/schema.rb
1355
- - spec/dummy/log/development.log
1356
1352
  - spec/dummy/log/test.log
1357
1353
  - spec/dummy/node_modules/jquery/AUTHORS.txt
1358
1354
  - spec/dummy/node_modules/jquery/bower.json
@@ -1,23 +0,0 @@
1
- # # Redefined standard Rails tasks only in instance mode
2
- # unless TrustyCms.app?
3
- # require 'rake/testtask'
4
- #
5
- # ENV['RADIANT_ENV_FILE'] = File.join(Rails.root, 'config', 'environment')
6
- #
7
- # [Dir["#{Rails.Root}/vendor/rails/railties/lib/tasks/*.rake"], Dir["#{Rails.root}/vendor/plugins/rspec_on_rails/tasks/*.rake"]].flatten.each do |rake|
8
- # lines = IO.readlines(rake)
9
- # lines.map! do |line|
10
- # line.gsub!('Rails.root', 'TRUSTY_CMS_ROOT') unless rake =~ /(misc|rspec|databases)\.rake$/
11
- # case rake
12
- # when /testing\.rake$/
13
- # line.gsub!(/t.libs << (["'])/, 't.libs << \1#{TRUSTY_CMS_ROOT}/')
14
- # line.gsub!(/t\.pattern = (["'])/, 't.pattern = \1#{TRUSTY_CMS_ROOT}/')
15
- # when /databases\.rake$/
16
- # line.gsub!(/(migrate|rollback)\((["'])/, '\1(\2#{TRUSTY_CMS_ROOT}/')
17
- # line.gsub!(/(run|new)\((:up|:down), (["'])db/, '\1(\2, \3#{TRUSTY_CMS_ROOT}/db')
18
- # end
19
- # line
20
- # end
21
- # eval(lines.join("\n"), binding, rake)
22
- # end
23
- # end
@@ -1,24 +0,0 @@
1
- # # Undefined unneeded tasks in instance mode
2
- # unless TrustyCms.app?
3
- # def undefine_task(*names)
4
- # app = Rake.application
5
- # tasks = app.instance_variable_get('@tasks')
6
- # names.flatten.each { |name| tasks.delete(name) }
7
- # end
8
- #
9
- # undefine_task %w(
10
- # radiant:clobber_package
11
- # radiant:install_gem
12
- # radiant:package
13
- # radiant:release
14
- # radiant:repackage
15
- # radiant:uninstall_gem
16
- # rails:freeze:edge
17
- # rails:freeze:gems
18
- # rails:unfreeze
19
- # rails:update
20
- # rails:update:configs
21
- # rails:update:javascripts
22
- # rails:update:scripts
23
- # )
24
- # end