enjoy_cms 0.4.0.beta3 → 0.4.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
2
  SHA1:
3
- metadata.gz: 0a5d6147bb0eb040d5049c6ec15332854109a4bb
4
- data.tar.gz: ac05ab418b17b705a7541eb7b8ca7e2819445495
3
+ metadata.gz: 867a2e90a3a9e259ceadaf99ab42df4469481c3b
4
+ data.tar.gz: 441c4459be10d3e19416f8865f6a3db7db6c1bf0
5
5
  SHA512:
6
- metadata.gz: 1122136245369984ddb261ea6d1d3092eda5a8dab2d07367b2c1bf5f89767c35c173e7aaa66d1b85215563129f0bc6a1a650073316d9b2151bf26c764e579a6b
7
- data.tar.gz: f0405c8bc242b332325098247b6c88fd5df0ed3fea92c0afaf70b8997106afd73a4f8df1121e5a29776e4a20cb60838356dba3b822e6df3680507fb2a9f8e6ee
6
+ metadata.gz: b59526d7d43ff89a2dea28e56ffc08cc5d6744a79e23b54ed5d9e575e273fc9e9c2d4172fdf475075e1565edee2274ecb44f2abb59770a9aaff6954ce484cb9a
7
+ data.tar.gz: bf4872c75876973ac21328ed9fa194d718bc454c26670f4a01d0b8a5953ce578abc94db608472994abff3a6aaf3bd7589fa61f8f312cff3d0f5c55693c9cabdf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enjoy_cms (0.4.0.beta3)
4
+ enjoy_cms (0.4.0)
5
5
  ckeditor
6
6
  coffee-rails
7
7
  devise
@@ -1,7 +1,7 @@
1
1
  module Enjoy::Errors
2
2
  extend ActiveSupport::Concern
3
3
  included do
4
- if Rails.env.production? || Rails.env.staging?
4
+ if Rails.env.production? || Rails.env.staging? || (respond_to?(:enjoy_check_errors) and enjoy_check_errors)
5
5
  rescue_from Exception, with: :render_500
6
6
  rescue_from ActionController::RoutingError, with: :render_404
7
7
  rescue_from ActionController::UnknownController, with: :render_404
@@ -1,4 +1,4 @@
1
- if Enjoy.mongoid?
1
+ if false #Enjoy.mongoid?
2
2
  module Enjoy::HashField
3
3
  extend ActiveSupport::Concern
4
4
 
@@ -12,8 +12,8 @@ if Enjoy.mongoid?
12
12
  meth_hsh = "#{name}_hash"
13
13
  meth_json = "#{name}_json"
14
14
  if opts[:localize]
15
- meth_str_t = "#{name}_str_translations"
16
- meth_hsh_t = "#{name}_hash_translations"
15
+ meth_str_t = "#{meth_str}_translations"
16
+ meth_hsh_t = "#{meth_hsh}_translations"
17
17
  class_eval <<-EVAL
18
18
  def #{meth_str_t}=(val)
19
19
  return self.#{meth_hsh_t} = {} if val.blank?
@@ -38,6 +38,9 @@ if Enjoy.mongoid?
38
38
  def #{meth}
39
39
  self.#{meth_hsh}
40
40
  end
41
+ def #{meth}=(val)
42
+ self.#{meth_str} = val
43
+ end
41
44
  def #{meth_json}
42
45
  self.#{meth_hsh}.to_json if self.#{meth_hsh}
43
46
  end
@@ -47,9 +50,6 @@ if Enjoy.mongoid?
47
50
  _has_errors = false
48
51
  I18n.available_locales.each do |l|
49
52
  I18n.with_locale(l) do
50
- puts self.#{meth_hsh_t}[l]
51
- puts self.#{meth_str}
52
- puts "_"
53
53
  if self.#{meth_hsh_t}[l].nil? and !self[:#{meth_str_t}][l].blank?
54
54
  _has_errors ||= true
55
55
  _meth = "#{meth_hsh_t}_\#{l}".to_s
@@ -69,9 +69,16 @@ if Enjoy.mongoid?
69
69
  class_eval <<-EVAL
70
70
  def #{meth_str}=(val)
71
71
  return self.#{meth_hsh} = {} if val.blank?
72
- begin
73
- self.#{meth_hsh} = JSON.parse(val)
74
- rescue
72
+ if val.is_a?(String)
73
+ begin
74
+ begin
75
+ self[:#{meth_str}] = JSON.parse(val)
76
+ rescue
77
+ self[:#{meth_str}] = YAML.load(val)
78
+ end
79
+ rescue
80
+ end
81
+ elsif val.is_a?(Hash)
75
82
  self[:#{meth_str}] = val
76
83
  end
77
84
  end
@@ -81,6 +88,9 @@ if Enjoy.mongoid?
81
88
  def #{meth}
82
89
  self.#{meth_hsh}
83
90
  end
91
+ def #{meth}=(val)
92
+ self.#{meth_str} = val
93
+ end
84
94
  def #{meth_json}
85
95
  self.#{meth_hsh}.to_json if self.#{meth_hsh}
86
96
  end
@@ -1 +1 @@
1
- = render 'errors/base', code: 403, text: t('enjoy.errors.access_denied')
1
+ = render 'enjoy/errors/base', code: 403, text: t('enjoy.errors.access_denied')
@@ -1 +1 @@
1
- = render 'errors/base', code: 404, text: t('enjoy.errors.not_found')
1
+ = render 'enjoy/errors/base', code: 404, text: t('enjoy.errors.not_found')
@@ -1 +1 @@
1
- = render 'errors/base', code: 500, text: t('enjoy.errors.internal_error')
1
+ = render 'enjoy/errors/base', code: 500, text: t('enjoy.errors.internal_error')
@@ -14,9 +14,9 @@ html lang="ru"
14
14
  /[if lt IE 9]
15
15
  = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js", async: async
16
16
  css:
17
- #{Settings.custom_css(default: '', kind: :css)}
17
+ #{Settings.custom_css(default: '', kind: :css, title: "Дополнительный CSS")}
18
18
  javascript:
19
- #{Settings.custom_js(default: '', kind: :js)}
19
+ #{Settings.custom_js(default: '', kind: :js, title: "Дополнительный JS")}
20
20
 
21
21
  body
22
22
  #root
data/lib/enjoy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Enjoy
2
- VERSION = "0.4.0.beta3"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/enjoy_cms.rb CHANGED
@@ -20,7 +20,7 @@ require 'filename_to_slug'
20
20
  require 'rails_admin'
21
21
  require 'enjoy/rails_admin_ext/config'
22
22
 
23
- require 'enjoy/rails_admin_ext/enjoy_hash'
23
+ # require 'enjoy/rails_admin_ext/enjoy_hash'
24
24
  require 'enjoy/rails_admin_ext/enjoy_html'
25
25
  require 'enjoy/rails_admin_ext/enjoy_slugs'
26
26
  require 'enjoy/rails_admin_ext/group_patch'
@@ -8,7 +8,7 @@ module Enjoy::Cms
8
8
 
9
9
  desc 'Enjoy CMS Layout generator'
10
10
  def layout
11
- template('app/views/layouts/application.html.slim', 'app/views/layouts/application.html.slim')
11
+ template('../app/views/layouts/application.html.slim', 'app/views/layouts/application.html.slim')
12
12
  end
13
13
  end
14
14
  end
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '4.2.4' #'~> 5.0.0.beta3'
3
+ gem 'rails', '4.2.6' #'~> 5.0.0.beta3'
4
4
  #{if mongoid then "gem 'mongoid'" else "gem 'pg'" end}
5
5
 
6
6
  gem 'sass'
@@ -29,6 +29,7 @@ class Ability
29
29
  end
30
30
 
31
31
  def admin_ui(user)
32
+ can :manage, :all
32
33
  can :manage, User
33
34
  can :user_abilities, User
34
35
 
@@ -36,6 +37,8 @@ class Ability
36
37
  end
37
38
 
38
39
  def manager_ui(user)
40
+ can :read, :all
41
+ can :show, :all
39
42
  cannot [:edit, :destroy, :new, :create], User
40
43
  can :edit, User, _id: user._id
41
44
  cannot :user_abilities, :all
data/template.rb CHANGED
@@ -14,7 +14,7 @@ remove_file 'Gemfile'
14
14
  create_file 'Gemfile' do <<-TEXT
15
15
  source 'https://rubygems.org'
16
16
 
17
- gem 'rails', '4.2.6' #'~> 5.0.0.rc1'
17
+ gem 'rails', '4.2.6'
18
18
  #{if mongoid then "gem 'mongoid'" else "gem 'pg'" end}
19
19
 
20
20
  gem 'sass'
@@ -29,8 +29,7 @@ gem 'rails_admin_multiple_file_upload'
29
29
  #gem 'rails_admin_comments', github: "enjoycreative/rails_admin_comments" #path: '/home/ack/www/rails_admin/rails_admin_comments'
30
30
 
31
31
 
32
- ##{if mongoid then "gem 'enjoy_cms_mongoid'" else "gem 'enjoy_cms_activerecord'" end}, path: '/home/ack/www/enjoy/enjoy_cms' #'~> 0.4.0.beta1'
33
- #{if mongoid then "gem 'enjoy_cms_mongoid'" else "gem 'enjoy_cms_activerecord'" end}, github: "enjoycreative/enjoy_cms" #'~> 0.4.0.beta1'
32
+ #{if mongoid then "gem 'enjoy_cms_mongoid'" else "gem 'enjoy_cms_activerecord'" end}, '~> 0.4.0'
34
33
 
35
34
  gem 'devise'
36
35
 
@@ -159,11 +158,16 @@ create_file 'config/navigation.rb' do <<-TEXT
159
158
  TEXT
160
159
  end
161
160
 
161
+ remove_file 'README.md'
162
162
  create_file 'README.md', "## #{app_name}\nProject generated by EnjoyCMS\nORM: #{if mongoid then 'Mongoid' else 'ActiveRecord' end}\n\n"
163
163
 
164
- create_file '.ruby-version', "2.3.1\n"
164
+ RVM_RUBY_VERSION = "2.3.1"
165
+ create_file '.ruby-version', "#{RVM_RUBY_VERSION}\n"
165
166
  create_file '.ruby-gemset', "#{app_name}\n"
166
167
 
168
+ # run "rvm use #{RVM_RUBY_VERSION} && rvm gemset create #{app_name}"
169
+ # run "rvm use #{RVM_RUBY_VERSION}@#{app_name} && gem install bundler"
170
+ # run "rvm gemset list"
167
171
  run 'bundle install --without production'
168
172
 
169
173
  if mongoid
@@ -325,13 +329,13 @@ inject_into_file 'app/models/user.rb', before: /^end/ do <<-TEXT
325
329
  def self.generate_first_admin_user
326
330
  if User.all.count == 0
327
331
  _email_pass = 'admin@#{app_name.dasherize.downcase}.ru'
328
- if User.create(roles: ["admin"], email: _email_pass, password: _email_pass, password_confirmation: _email_pass)
332
+ if User.new(roles: ["admin"], email: _email_pass, password: _email_pass, password_confirmation: _email_pass).save
329
333
  puts "User with email and password '\#{_email_pass}' was created!"
330
334
  else
331
- puts 'error'
335
+ puts 'Creating User error'
332
336
  end
333
337
  else
334
- puts 'error'
338
+ puts 'Users are here already'
335
339
  end
336
340
  end
337
341
 
@@ -406,6 +410,8 @@ TEXT
406
410
  end
407
411
  end
408
412
 
413
+ # run 'rails r User.generate_first_admin_user'
414
+
409
415
  if mongoid
410
416
  generate "ckeditor:install", "--orm=mongoid", "--backend=paperclip"
411
417
  else
@@ -467,7 +473,7 @@ end
467
473
  # end
468
474
 
469
475
 
470
- generate "enjoy:rack"
476
+ generate "enjoy:cms:rack"
471
477
 
472
478
 
473
479
  remove_file 'app/assets/stylesheets/application.css'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enjoy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.beta3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kiseliev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-04 00:00:00.000000000 Z
11
+ date: 2016-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -383,9 +383,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
383
383
  version: '0'
384
384
  required_rubygems_version: !ruby/object:Gem::Requirement
385
385
  requirements:
386
- - - ">"
386
+ - - ">="
387
387
  - !ruby/object:Gem::Version
388
- version: 1.3.1
388
+ version: '0'
389
389
  requirements: []
390
390
  rubyforge_project:
391
391
  rubygems_version: 2.5.1