chr 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c55b40464d216b27cf2e0d64a3a9768699f0781
4
- data.tar.gz: e41ef252a1f9f89f98a0cf693b0d0d14290e03d5
3
+ metadata.gz: df0a116a90e5bfee90db9b7f31bcf6006f947a70
4
+ data.tar.gz: 27753496f8fa36d4c9b3318eeac2a4b2d43e3dc1
5
5
  SHA512:
6
- metadata.gz: 61d1b8216b23e166ea92689b110b5f13d07c1e3809f568a84657cd939e3fefa5703b01cdc7cbff017de77decb06a2299e4b3b956b9ec0fb533340c6740bfd9d3
7
- data.tar.gz: 2535f8dc560c6b173d8576a26434c68bf3d63b47620dbcec288cd3fc38cca16839afd0767be7c68767ad83483d21ec44732d07bbc0ea8713cdd130c02b83da4b
6
+ metadata.gz: 308f5c919330b3f1b1514add77307d5054b2f86cec6828e24c97b9dc01a0de1d8d85598042eef1572c4013e401b3b97dee15f2dadce21ff616effdc8805bab1a
7
+ data.tar.gz: 40bbd3d5cc4b6a7f8efcd17b907bffe61cf7e3f138a5153555607abe7ffe19391cdb71c12526a671214176a3e918fc50569d0cceb6ae5c83823838e19fccd60b
@@ -58,11 +58,6 @@ module Chr
58
58
  end
59
59
 
60
60
 
61
- def configure_newrelic
62
- template 'newrelic.yml.erb', 'config/newrelic.yml'
63
- end
64
-
65
-
66
61
  def configure_smtp
67
62
  copy_file 'smtp.rb', 'config/smtp.rb'
68
63
 
@@ -74,7 +74,6 @@ module Chr
74
74
 
75
75
  def setup_production_environment
76
76
  say 'Setting up the production environment'
77
- build :configure_newrelic
78
77
  build :configure_smtp
79
78
  build :configure_rack_timeout
80
79
  build :enable_rack_canonical_host
data/lib/chr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Chr
2
2
  RAILS_VERSION = "~> 4.2.5"
3
3
  RUBY_VERSION = IO.read("#{File.dirname(__FILE__)}/../../.ruby-version").strip
4
- VERSION = "0.5.5"
4
+ VERSION = "0.5.6"
5
5
  end
@@ -9,19 +9,17 @@ gem 'jquery-rails'
9
9
  gem 'puma'
10
10
  gem 'recipient_interceptor'
11
11
  gem 'rack-canonical-host'
12
- gem 'meta-tags'
13
12
  gem 'awesome_print'
14
13
  gem 'bson_ext'
15
14
  gem 'mongoid', '~> 5.0.0'
16
15
  gem 'fog'
17
16
  gem 'fog-aws'
18
- gem 'carrierwave-mongoid'
19
- # This `autoinc` branch supports mongoid 5.0, required by Loft
20
- gem 'mongoid-autoinc', github: 'suweller/mongoid-autoinc'
21
- gem 'mongosteen'
22
- gem 'chr'
23
- gem 'ants'
24
- gem 'loft'
17
+ gem 'rack-host-redirect'
18
+ gem 'mongosteen', '>= 0.2.0'
19
+ gem 'chr', '>= 0.5.6'
20
+ gem 'ants', '>= 0.3.12'
21
+ gem 'loft', '>= 0.3.1'
22
+ gem 'journal', github: 'alexkravets/journal'
25
23
 
26
24
  group :development do
27
25
  gem 'spring'
@@ -1,9 +1 @@
1
- <% if ENV["SEGMENT_IO_KEY"] %>
2
- <script type="text/javascript">
3
- window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}window.analytics.load=function(t){if(!document.getElementById("analytics-js")){var a=document.createElement("script");a.type="text/javascript",a.id="analytics-js",a.async=!0,a.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.io/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n)}},window.analytics.SNIPPET_VERSION="2.0.9",
4
- window.analytics.load("<%= ENV["SEGMENT_IO_KEY"] %>");
5
- window.analytics.page();
6
- </script>
7
- <% end %>
8
-
9
- <% # @todo: add google analytics %>
1
+ <% # @todo: add analytics scripts %>
@@ -3,10 +3,3 @@
3
3
  <%= yield :javascript %>
4
4
 
5
5
  <%= render "analytics" %>
6
-
7
- <% if Rails.env.test? %>
8
- <%= javascript_tag do %>
9
- $.fx.off = true;
10
- $.ajaxSetup({ async: false });
11
- <% end %>
12
- <% end %>
@@ -2,22 +2,10 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
- <meta name="ROBOTS" content="NOODP" />
5
+ <!-- META TAGS ============================================================ -->
6
+ <%%= display_meta_tags %>
7
+ <!-- ====================================================================== -->
6
8
  <meta name="viewport" content="initial-scale=1" />
7
-
8
- <%%#
9
- Configure default meta tags values, for more details see:
10
- https://github.com/kpumuk/meta-tags
11
- %>
12
- <%%= display_meta_tags site: '<%= app_name %>',
13
- description: '',
14
- og: { site_name: '<%= app_name %>',
15
- url: '',
16
- title: '',
17
- description: '',
18
- type: 'website',
19
- image: '' } %>
20
-
21
9
  <%%= stylesheet_link_tag :application, media: "all" %>
22
10
  <%%= csrf_meta_tags %>
23
11
  </head>
@@ -1,24 +1,21 @@
1
1
  CarrierWave.configure do |config|
2
+ config.storage = :file
2
3
  config.cache_dir = "#{Rails.root}/public/uploads/tmp"
3
4
 
4
- # DEVELOPMENT
5
- if Rails.env.development?
6
- config.storage = :file
7
- end
8
-
9
- # TEST
10
5
  if Rails.env.test?
11
6
  config.cache_dir = "#{Rails.root}/public/uploads/tmp/test"
12
7
  config.enable_processing = false
8
+ end
13
9
 
14
- # PRODUCTION & STAGING
15
- elsif Rails.env.production? || Rails.env.staging?
16
- config.storage = :fog
17
- config.fog_directory = ENV.fetch('FOG_DIRECTORY')
18
- config.fog_credentials = {
19
- provider: 'AWS',
20
- aws_access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
21
- aws_secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
22
- }
10
+ if Rails.env.production? || Rails.env.staging?
11
+ if ENV.has_key? "FOG_DIRECTORY"
12
+ config.storage = :fog
13
+ config.fog_directory = ENV.fetch("FOG_DIRECTORY")
14
+ config.fog_credentials = {
15
+ provider: "AWS",
16
+ aws_access_key_id: ENV.fetch("AWS_ACCESS_KEY_ID"),
17
+ aws_secret_access_key: ENV.fetch("AWS_SECRET_ACCESS_KEY"),
18
+ }
19
+ end
23
20
  end
24
- end
21
+ end
@@ -4,20 +4,35 @@
4
4
  #= require chr
5
5
  #= require loft
6
6
  #= require ants
7
+ #= require journal
7
8
 
8
- @getConfig = (data) ->
9
- modules =
10
- loft: new Loft()
11
- settings:
12
- items:
13
- admins: new AntsAdminUsers()
14
- redirects: new AntsRedirects()
9
+ @redirectToSignIn = ->
10
+ signinPath = "/admin/sign_in"
11
+ if window.location.hash
12
+ returnTo = window.location.hash.substring(1)
13
+ signinPath = "#{signinPath}?return_to=#{returnTo}"
14
+ window.location = signinPath
15
15
 
16
- return { modules: modules }
16
+ @addWebsiteLink = ->
17
+ $link =$ """<a href='/' target='_blank'>
18
+ <i class='fa fa-home fa-fw'></i> View Site
19
+ </a>"""
20
+ chr.$mainMenu.prepend $link
17
21
 
18
22
  $ ->
19
- $.get '/admin/bootstrap.json', (response) ->
20
- config = getConfig(response)
21
-
22
- chr.start('<%= app_name %>', config)
23
+ $.get("/admin/bootstrap.json", (response) ->
24
+ chr.start "<%= app_name %>",
25
+ modules:
26
+ posts: new JournalPosts()
27
+ pages: new JournalPages()
28
+ loft: new Loft()
29
+ settings:
30
+ menuIcon: "cog"
31
+ items:
32
+ categories: new JournalCategories()
33
+ admins: new AntsAdminUsers()
34
+ redirects: new AntsRedirects()
23
35
  new AntsProfile()
36
+ ).fail (response) ->
37
+ if response.status == 401
38
+ redirectToSignIn(response)
@@ -1,4 +1,14 @@
1
1
  @import "chr";
2
2
  @import "loft";
3
3
  @import "ants";
4
- @import "font-awesome";
4
+ @import "journal";
5
+ @import "font-awesome";
6
+
7
+ /* Tablet ------------------------------------------------------------------ */
8
+ @media #{$tablet} {
9
+ .menu,
10
+ .menu-posts,
11
+ .menu-settings {
12
+ margin-top: 1em;
13
+ }
14
+ }
@@ -1,2 +1,5 @@
1
1
  <%= javascript_include_tag :admin %>
2
- <%= render partial: 'ants/profile' %>
2
+
3
+ <% if admin_user_signed_in? %>
4
+ <%= render partial: 'ants/profile' %>
5
+ <% end %>
@@ -10,12 +10,12 @@
10
10
 
11
11
  <%%= display_meta_tags site: "<%= app_name %>", title: "CMS" %>
12
12
 
13
- <%%= csrf_meta_tags %>
14
13
  <%%= stylesheet_link_tag :admin, media: "all" %>
14
+ <%%= csrf_meta_tags %>
15
15
  </head>
16
16
 
17
17
  <body class="<%%= body_class %>">
18
18
  <%%= yield %>
19
19
  </body>
20
20
 
21
- </html>
21
+ </html>
@@ -1,12 +1,14 @@
1
- class Admin::BaseController < ActionController::Base
2
- protect_from_forgery
3
- before_action :authenticate_admin_user!
1
+ module Admin
2
+ class BaseController < ActionController::Base
3
+ protect_from_forgery
4
+ before_action :authenticate_admin_user!, except: %w(index)
4
5
 
5
- def index
6
- render '/admin/index', layout: 'admin'
7
- end
6
+ def index
7
+ render '/admin/index', layout: 'admin'
8
+ end
8
9
 
9
- def bootstrap_data
10
- render json: {}
10
+ def bootstrap_data
11
+ render json: {}
12
+ end
11
13
  end
12
14
  end
@@ -1,9 +1,11 @@
1
- class Admin::DeviseOverrides::PasswordsController < Devise::PasswordsController
2
- layout 'admin'
1
+ module Admin
2
+ class DeviseOverrides::PasswordsController < Devise::PasswordsController
3
+ layout 'admin'
3
4
 
4
- protected
5
+ protected
5
6
 
6
- def after_resetting_password_path_for(resource)
7
- admin_path
7
+ def after_resetting_password_path_for(resource)
8
+ admin_path
9
+ end
8
10
  end
9
11
  end
@@ -1,11 +1,20 @@
1
- class Admin::DeviseOverrides::SessionsController < Devise::SessionsController
2
- layout 'admin'
1
+ module Admin
2
+ class DeviseOverrides::SessionsController < Devise::SessionsController
3
+ layout 'admin'
4
+ before_filter :update_return_to, only: %w(new)
3
5
 
4
- def after_sign_in_path_for(resource)
5
- admin_path
6
- end
6
+ def after_sign_in_path_for(resource)
7
+ "#{admin_path}##{stored_location_for(resource)}"
8
+ end
9
+
10
+ def after_sign_out_path_for(resource)
11
+ new_admin_user_session_path
12
+ end
13
+
14
+ private
7
15
 
8
- def after_sign_out_path_for(resource)
9
- new_admin_user_session_path
16
+ def update_return_to
17
+ session["admin_user_return_to"] = params[:return_to]
18
+ end
10
19
  end
11
20
  end
data/templates/routes.rb CHANGED
@@ -1,37 +1,33 @@
1
1
  Rails.application.routes.draw do
2
- #-------------------------------------------#
3
- # App Routes
4
- #-------------------------------------------#
5
-
6
-
7
- #-------------------------------------------#
2
+ #----------------------------------------------------------------------------
8
3
  # Admin
9
- #-------------------------------------------#
4
+ #----------------------------------------------------------------------------
10
5
  devise_for :admin_users,
11
- path: 'admin',
6
+ path: "admin",
12
7
  controllers: {
13
- passwords: 'admin/devise_overrides/passwords',
14
- sessions: 'admin/devise_overrides/sessions'
8
+ passwords: "admin/devise_overrides/passwords",
9
+ sessions: "admin/devise_overrides/sessions"
15
10
  }
16
11
 
17
12
  namespace :admin do
18
- get '/' => 'base#index'
19
- get '/bootstrap.json' => 'base#bootstrap_data'
20
-
21
- # files
22
- resources :assets, controller: 'assets' # Loft::Asset
23
-
24
- # settings
25
- resources :admin_users, controller: 'admin_users' # Ants::Admin
26
- resources :redirects, controller: 'redirects' # Ants::Redirect
13
+ get "/" => "base#index"
14
+ get "/bootstrap.json" => "base#bootstrap_data"
15
+ mount_journal_posts_crud
16
+ mount_journal_pages_crud
17
+ mount_journal_categories_crud
18
+ mount_loft_assets_crud
19
+ mount_ants_admin_users_crud
20
+ mount_ants_redirects_crud
27
21
  end
28
22
 
29
-
30
- #-------------------------------------------#
31
- # Redirects, ideally this should go last
32
- #-------------------------------------------#
33
- get "/*id" => 'redirects#show', :constraints => Constraints::Redirects
34
-
23
+ #----------------------------------------------------------------------------
24
+ # Application
25
+ #----------------------------------------------------------------------------
26
+ root "journal_posts#index"
27
+ mount_journal_categories
28
+ mount_journal_pages
29
+ mount_journal_posts
30
+ mount_ants_redirects
35
31
 
36
32
  # The priority is based upon order of creation: first created -> highest priority.
37
33
  # See how all your routes lay out with "rake routes".
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kravets
@@ -387,7 +387,6 @@ files:
387
387
  - templates/devise_overrides_sessions_new.html.erb
388
388
  - templates/errors.rb
389
389
  - templates/json_encoding.rb
390
- - templates/newrelic.yml.erb
391
390
  - templates/puma.rb
392
391
  - templates/routes.rb
393
392
  - templates/sample.env
@@ -1,34 +0,0 @@
1
- common: &default_settings
2
- app_name: "<%= app_name %>"
3
- audit_log:
4
- enabled: false
5
- browser_monitoring:
6
- auto_instrument: true
7
- capture_params: false
8
- developer_mode: false
9
- error_collector:
10
- capture_source: true
11
- enabled: true
12
- ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
13
- license_key: "<%%= ENV["NEW_RELIC_LICENSE_KEY"] %>"
14
- log_level: info
15
- monitor_mode: true
16
- transaction_tracer:
17
- enabled: true
18
- record_sql: obfuscated
19
- stack_trace_threshold: 0.500
20
- transaction_threshold: apdex_f
21
- development:
22
- <<: *default_settings
23
- monitor_mode: false
24
- developer_mode: true
25
- test:
26
- <<: *default_settings
27
- monitor_mode: false
28
- production:
29
- <<: *default_settings
30
- monitor_mode: true
31
- staging:
32
- <<: *default_settings
33
- app_name: "<%= app_name %> (Staging)"
34
- monitor_mode: true