caboose-cms 0.3.101 → 0.3.110

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2NlYzU4ZDY3MmRkNDQ1NmE0ZDFlYmNmNmY4ODU3YzEzYTEwYWFhMQ==
4
+ OGM1NjAzNzBmZGY1MGFiNmM5NjI4ZTQ3ZmNiNTkzMTkwZWUwZWVhZg==
5
5
  data.tar.gz: !binary |-
6
- NzE1MjhlNmNhY2I4OGVhZTQxNThmZDdkZDVlNzZhNGYzNTA4NWU2ZQ==
6
+ NjIyMDQ5Y2M3NWU1NTkxMGJhMzQ4NzBiMmRlOGNkMzE0YzI2OTcxNg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YjRhZTAzYTQxNzA2ZTc2ZjU0YTI1MTMxMDBlNjhmMTBiYzc4ZGFkOTQ2MGI0
10
- ZWRkY2M4NTE1NmY2NGUwZjM0ZWVhMzc5YjczZjAyNGMxMWJkM2Y5MWZjYmI2
11
- ZTQ5ZGE5ZjI2Y2JhMWUzNzc5ZGIyNDE3MGNkOWJkMzFiZmNiOTY=
9
+ NmZmMmVhYjUyYTEzYjRkNTg5MmMxZTRkY2FiNzg4NGNhOTVhMWE4ZjU4YjE2
10
+ NDFlNDVhZmQzYjNiYjM3NGE5M2FlZTI5N2ExZjA5NDVkNDE3YmU2NTRiOWI4
11
+ ODBjOGRjNWIwYjgzNGM2NzM3MGU2Nzk1ZjliNzNkOTg5M2YxZmQ=
12
12
  data.tar.gz: !binary |-
13
- NDgyMWZmNTA0YmVmYzM2ODMxMTFmZmYxMzE3M2FjZmJkNDBhMGU2YTE2OTQz
14
- ODgzZTAzYzE3OTZlMmU2ZTZlODNiYzkwZDkzNTkzY2E3OGRlNjNmMTVlODcw
15
- YzRkOGQwZGI4ZDhhYzc0ZjdlOTc1YTVlZGQ4ZjgyMTI3MzBhZjY=
13
+ ZWY4YWUxZTgwNDNhMWIyMWQ4YjY3ZGMzMDI1ZDQ0YzMwMTZlNTllZWQ1ZDFk
14
+ NzM5YWMzYjkxNzAyYmFjZDk3YmM5OTQ0ZjIwMjdhYjRmMjdmNjE1YzgwNmJi
15
+ OTg2MzY4OWIwZThlNzJiNTVjZWM4ZmJiYzZhYjYzNzljN2RlMWE=
@@ -5,64 +5,39 @@ require 'caboose'
5
5
  require 'caboose/engine'
6
6
  require 'caboose/version'
7
7
  require 'caboose/caboose_helper'
8
- require 'trollop'
9
-
10
- #puts "Usage:"
11
- #puts "Create a new caboose app:"
12
- #puts " caboose new <app_path>"
13
- #puts "Initialize an existing rails app as a new caboose app:"
14
- #puts " caboose init [<app_path>]\n\n"
15
- #exit
16
-
17
- global_opts = Trollop::options do
18
- banner <<-EOS
19
- --------------------------------------------------------------------------------
20
- Caboose CMS
21
- A content management system built on top of Ruby on Rails.
22
- --------------------------------------------------------------------------------
23
- Usage:
24
- caboose new <path>
25
- caboose init [--force] [<path>]
26
- --------------------------------------------------------------------------------
27
- EOS
28
- version "Caboose CMS Version #{Caboose::VERSION}\n\n"
29
- stop_on ['version', 'new', 'init']
30
- end
8
+ #require 'trollop'
31
9
 
32
10
  cmd = ARGV.shift
33
11
  case cmd
34
12
 
35
- when 'new'
36
-
37
- path = ARGV.shift
38
- if (path.nil?)
39
- puts "Error: path for new app is required.\n\n"
40
- global_opts.help
41
- exit
42
- end
13
+ when 'version'
43
14
 
44
- puts "Creating the new rails app..."
45
- `rails new #{path} -d=mysql`
46
- helper = CabooseHelper.new(path, true)
47
- helper.init_all
15
+ puts "Caboose CMS Version #{Caboose::VERSION}\n\n"
48
16
 
49
- when 'init'
50
-
51
- opts = Trollop::options do
52
- opt :force, 'Force re-installation of all caboose files.', :default => false
53
- end
17
+ when 'new'
54
18
 
55
- path = ARGV.shift
56
- path = Dir.pwd if path.nil?
57
- is_rails_app = File.exists?(File.join(path, 'config', 'environment.rb'))
58
- if (!is_rails_app)
59
- puts "Error: Not a rails app.\n\n"
60
- global_opts.help
61
- exit
62
- end
19
+ puts "\n"
20
+ puts "--------------------------------------------------------------------------------\n"
21
+ puts "Create a new Caboose CMS App\n"
22
+ puts "--------------------------------------------------------------------------------\n"
63
23
 
64
- helper = CabooseHelper.new(path, opts.force)
65
- helper.init_all
24
+ questions = {
25
+ 'app_name' => "What's the name of your new app?",
26
+ 'smtp_server' => "What's the SMTP server?",
27
+ 'smtp_domain' => "What's the SMTP domain?",
28
+ 'smtp_user' => "What's the SMTP user?",
29
+ 'smtp_password' => "What's the SMTP password?"
30
+ }
31
+ questions.each do |k,q|
32
+ while vars[k].nil? || vars[k].strip.length == 0
33
+ puts "\n#{q}"
34
+ vars[k.upcase] = gets.chomp
35
+ end
36
+ end
37
+
38
+ # Do the caboose init
39
+ helper = CabooseHelper.new(vars)
40
+ helper.create_app
66
41
 
67
42
  when 'pg_restore'
68
43
 
@@ -87,4 +62,13 @@ when 'sync_db'
87
62
  `pg_restore --verbose --clean --no-acl --no-owner -h localhost -d #{db} #{dump_file}`
88
63
 
89
64
  else
65
+
66
+ puts "--------------------------------------------------------------------------------"
67
+ puts "Caboose CMS"
68
+ puts "A content management system built on top of Ruby on Rails."
69
+ puts "--------------------------------------------------------------------------------"
70
+ puts "Usage:"
71
+ puts "caboose new <path>"
72
+ puts "--------------------------------------------------------------------------------"
73
+
90
74
  end
@@ -1,71 +1,45 @@
1
1
 
2
2
  class CabooseHelper
3
3
 
4
- def initialize(app_path, force = false)
5
- @app_path = app_path
6
- @force = force
4
+ def initialize(vars)
5
+ @vars = vars
6
+ @vars['APP_NAME'] = @vars['APP_NAME'].downcase.capitalize
7
+ @vars['CABOOSE_SALT'] = Digest::SHA1.hexdigest(DateTime.now.to_s) if @vars['CABOOSE_SALT'].nil?
8
+ @vars['CABOOSER_VERSION'] = Caboose::VERSION if @vars['CABOOSE_VERSION'].nil?
7
9
  end
8
10
 
9
- def init_all
10
- init_gem
11
- init_app_config
12
- init_initializer
13
- init_routes
14
- init_assets
15
- init_tinymce
16
- init_session
11
+ def create_app
12
+ # Create the rails app
13
+ puts "Creating the rails app..."
14
+ `rails new #{path} -d=postgresql`
15
+
16
+ # Do the caboose init
17
+ init_skeleton_files
17
18
  remove_public_index
18
19
  end
19
20
 
20
- def init_file(filename)
21
- gem_root = Gem::Specification.find_by_name('caboose-cms').gem_dir
22
- filename = File.join(@app_path, filename)
23
- copy_from = File.join(gem_root,'lib','sample_files', Pathname.new(filename).basename)
24
-
25
- if (!File.exists?(filename) || @force)
26
- FileUtils.cp(copy_from, filename)
21
+ # Copies all the files in the sample directory to the host application
22
+ def init_skeleton_files
23
+ puts "Adding files to rails app..."
24
+
25
+ gem_root = Gem::Specification.find_by_name('caboose-cms').gem_dir
26
+ skeleton_root = File.join(gem_root,'lib','sample_files')
27
+
28
+ Find.find(skeleton_root).each do |file|
29
+ next if File.directory?(file)
30
+ file2 = file.gsub(skeleton_root, '')
31
+ file2 = File.join(Rails.root, file2)
32
+ FileUtils.cp(file, file2)
33
+
34
+ # Replace any variables
35
+ f = File.open(file2, 'rb')
36
+ str = f.read
37
+ f.close
38
+ @vars.each { |k,v| str.gsub!("|#{k}|",v) }
39
+ File.open(file2, 'w') { |f| f.write(str) }
27
40
  end
28
41
  end
29
42
 
30
- # Add the gem to the Gemfile
31
- def init_gem
32
- puts "Adding the caboose gem to the Gemfile... "
33
- filename = File.join(@app_path,'Gemfile')
34
- return if !File.exists?(filename)
35
- return if !@force
36
-
37
- file = File.open(filename, 'rb')
38
- str = file.read
39
- file.close
40
- str2 = ""
41
- str.each_line do |line|
42
- if (!line.strip.start_with?('#') && (!line.index("gem 'caboose-cms'").nil? || !line.index('gem "caboose-cms"').nil?))
43
- str2 << "##{line}"
44
- else
45
- str2 << line
46
- end
47
- end
48
- str2 << "gem 'caboose-cms', '= #{Caboose::VERSION}'\n"
49
- File.open(filename, 'w') {|file| file.write(str2) }
50
- end
51
-
52
- # Require caboose in the application config
53
- def init_app_config
54
- puts "Requiring caboose in the application config..."
55
-
56
- filename = File.join(@app_path,'config','application.rb')
57
- return if !File.exists?(filename)
58
-
59
- file = File.open(filename, 'rb')
60
- contents = file.read
61
- file.close
62
- if (contents.index("require 'caboose'").nil?)
63
- arr = contents.split("require 'rails/all'", -1)
64
- str = arr[0] + "\nrequire 'rails/all'\nrequire 'caboose'\n" + arr[1]
65
- File.open(filename, 'w') { |file| file.write(str) }
66
- end
67
- end
68
-
69
43
  # Removes the public/index.html file from the rails app
70
44
  def remove_public_index
71
45
  puts "Removing the public/index.html file... "
@@ -75,88 +49,4 @@ class CabooseHelper
75
49
  File.delete(filename)
76
50
  end
77
51
 
78
- # Adds the caboose initializer file
79
- def init_initializer
80
- puts "Adding the caboose initializer file..."
81
-
82
- filename = File.join(@app_path,'config','initializers','caboose.rb')
83
- return if File.exists?(filename) && !@force
84
-
85
- Caboose::salt = Digest::SHA1.hexdigest(DateTime.now.to_s)
86
- str = ""
87
- str << "# Salt to ensure passwords are encrypted securely\n"
88
- str << "Caboose::salt = '#{Caboose::salt}'\n\n"
89
- str << "# Where page asset files will be uploaded\n"
90
- str << "Caboose::assets_path = Rails.root.join('app', 'assets', 'caboose')\n\n"
91
- str << "# Register any caboose plugins\n"
92
- str << "#Caboose::plugins + ['MyCaboosePlugin']\n\n"
93
- str << "# Tell the host app about the caboose assets\n"
94
- str << "Rails.application.config.assets.paths << Rails.root.join('vendor','gems','caboose-cms','app','assets','javascripts')\n"
95
- str << "Rails.application.config.assets.paths << Rails.root.join('vendor','gems','caboose-cms','app','assets','stylesheets')\n"
96
- str << "Rails.application.config.assets.precompile += [\n"
97
- str << " 'login.css',\n"
98
- str << " 'caboose/admin.js',\n"
99
- str << " 'caboose/application.js',\n"
100
- str << " 'caboose/login.js',\n"
101
- str << " 'caboose/model.form.page.js',\n"
102
- str << " 'caboose/station.js',\n"
103
- str << " 'caboose/admin.css',\n"
104
- str << " 'caboose/application.css',\n"
105
- str << " 'caboose/caboose.css',\n"
106
- str << " 'caboose/fonts.css',\n"
107
- str << " 'caboose/tinymce.css'\n"
108
- str << "]\n\n"
109
-
110
- File.open(filename, 'w') {|file| file.write(str) }
111
- end
112
-
113
- # Adds the routes to the host app to point everything to caboose
114
- def init_routes
115
- puts "Adding the caboose routes..."
116
-
117
- filename = File.join(@app_path,'config','routes.rb')
118
- return if !File.exists?(filename)
119
- return if !@force
120
-
121
- str = ""
122
- str << "\t# Catch everything with caboose\n"
123
- str << "\tmount Caboose::Engine => '/'\n"
124
- str << "\tmatch '*path' => 'caboose/pages#show'\n"
125
- str << "\troot :to => 'caboose/pages#show'\n"
126
- file = File.open(filename, 'rb')
127
- contents = file.read
128
- file.close
129
- if (contents.index(str).nil?)
130
- arr = contents.split('end', -1)
131
- str2 = arr[0] + "\n" + str + "\nend" + arr[1]
132
- File.open(filename, 'w') {|file| file.write(str2) }
133
- end
134
- end
135
-
136
- def init_assets
137
- puts "Adding the layout files..."
138
- init_file('app/views/layouts/layout_default.html.erb')
139
- puts "Adding the layout files..."
140
- init_file('app/assets/stylesheets/login.css')
141
- end
142
-
143
- def init_tinymce
144
- puts "Adding the tinymce config file..."
145
- init_file('config/tinymce.yml')
146
- end
147
-
148
- def init_session
149
- puts "Setting the session config..."
150
-
151
- lines = []
152
- str = File.open(File.join(@app_path,'config','initializers','session_store.rb')).read
153
- str.gsub!(/\r\n?/, "\n")
154
- str.each_line do |line|
155
- line = '#' + line if !line.index(':cookie_store').nil? && !line.start_with?('#')
156
- line[0] = '' if !line.index(':active_record_store').nil? && line.start_with?('#')
157
- lines << line.strip
158
- end
159
- str = lines.join("\n")
160
- File.open(File.join(@app_path,'config','initializers','session_store.rb'), 'w') {|file| file.write(str) }
161
- end
162
52
  end
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.3.101'
2
+ VERSION = '0.3.110'
3
3
  end
@@ -0,0 +1,25 @@
1
+ source 'https://rubygems.org'
2
+ ruby '1.9.3'
3
+
4
+ gem 'rails', '3.2.15'
5
+
6
+ # For heroku
7
+ # gem 'rails_12factor', :group => :production
8
+
9
+ gem 'pg'
10
+
11
+ group :assets do
12
+ gem 'sass-rails', '~> 3.2.3'
13
+ gem 'coffee-rails', '~> 3.2.1'
14
+ gem 'compass-rails'
15
+ gem 'uglifier', '>= 1.0.3'
16
+ end
17
+
18
+ gem 'jquery-rails'
19
+ gem 'ejs'
20
+ #gem 'unicorn'
21
+
22
+ gem 'caboose-cms', '|CABOOSE_VERSION|'
23
+ gem 'asset_sync'
24
+ gem 'unf'
25
+ gem 'aws-sdk'
@@ -0,0 +1,4 @@
1
+ class ApplicationController < Caboose::ApplicationController
2
+ protect_from_forgery
3
+ layout "layouts/caboose/application"
4
+ end
@@ -0,0 +1,84 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+ require 'caboose'
5
+
6
+ if defined?(Bundler)
7
+ # If you precompile assets before deploying to production, use this line
8
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
9
+ # If you want your assets lazily compiled in production, use this line
10
+ # Bundler.require(:default, :assets, Rails.env)
11
+ end
12
+
13
+ module |APP_NAME|
14
+ class Application < Rails::Application
15
+ # Settings in config/environments/* take precedence over those specified here.
16
+ # Application configuration should go into files in config/initializers
17
+ # -- all .rb files in that directory are automatically loaded.
18
+
19
+ # Custom directories with classes and modules you want to be autoloadable.
20
+ # config.autoload_paths += %W(#{config.root}/extras)
21
+
22
+ # Only load the plugins named here, in the order given (default is alphabetical).
23
+ # :all can be used as a placeholder for all plugins not explicitly named.
24
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
25
+
26
+ # Activate observers that should always be running.
27
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
28
+
29
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
30
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
31
+ # config.time_zone = 'Central Time (US & Canada)'
32
+
33
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
34
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
35
+ # config.i18n.default_locale = :de
36
+
37
+ # Configure the default encoding used in templates for Ruby 1.9.
38
+ config.encoding = "utf-8"
39
+
40
+ # Configure sensitive parameters which will be filtered from the log file.
41
+ config.filter_parameters += [:password]
42
+
43
+ # Enable escaping HTML in JSON.
44
+ config.active_support.escape_html_entities_in_json = true
45
+
46
+ # Make sure initializers are run when we precompile
47
+ config.assets.initialize_on_precompile = true
48
+
49
+ # Use SQL instead of Active Record's schema dumper when creating the database.
50
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
51
+ # like if you have constraints or database-specific column types
52
+ # config.active_record.schema_format = :sql
53
+
54
+ # Enforce whitelist mode for mass assignment.
55
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
56
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
57
+ # parameters by using an attr_accessible or attr_protected declaration.
58
+ config.active_record.whitelist_attributes = true
59
+
60
+ # Enable the asset pipeline
61
+ config.assets.enabled = true
62
+
63
+ # Version of your assets, change this if you want to expire all your assets
64
+ config.assets.version = '1.0'
65
+
66
+ # Add /assets/templates to asset paths
67
+ config.assets.paths << "#{Rails.root}/app/templates"
68
+
69
+ # Action mailer settings
70
+ config.action_mailer.delivery_method = :smtp
71
+ config.action_mailer.smtp_settings = {
72
+ address: '|SMTP_SERVER|',
73
+ port: 587,
74
+ domain: '|SMTP_DOMAIN|',
75
+ user_name: '|SMTP_USER|',
76
+ password: '|SMTP_PASSWORD|',
77
+ authentication: 'plain',
78
+ enable_starttls_auto: true
79
+ }
80
+
81
+ # Make sure caboose loads first
82
+ #config.railties_order = [Caboose::Engine, :main_app, :all]
83
+ end
84
+ end
@@ -0,0 +1,9 @@
1
+
2
+ # Action mailer settings
3
+ config.action_mailer.delivery_method = :smtp
4
+ config.action_mailer.smtp_settings = {
5
+ address: '<outgoing_mail_server>',
6
+ user_name: '<username>',
7
+ password: '<password>',
8
+ authentication: 'plain'
9
+ }
@@ -0,0 +1,7 @@
1
+ AssetSync.configure do |config|
2
+ config.fog_provider = 'AWS'
3
+ config.fog_directory = '<bucket_name>'
4
+ config.aws_access_key_id = '<s3_key_id>'
5
+ config.aws_secret_access_key = '<s3_access_key>'
6
+ config.run_on_precompile = true
7
+ end
@@ -0,0 +1,19 @@
1
+
2
+ # Salt to ensure passwords are encrypted securely
3
+ Caboose::salt = '79f15ebc0541f4942dc7fb5fa3a27fe96a255c12'
4
+
5
+ # Where page asset files will be uploaded
6
+ Caboose::assets_path = Rails.root.join('app', 'assets', 'caboose')
7
+
8
+ # Register any caboose plugins
9
+ Caboose::plugins << 'RepconnexPlugin'
10
+
11
+ Caboose::use_url_params = false
12
+
13
+ Caboose::website_name = "RepConnex"
14
+ Caboose::website_domain = "http://tampa.repconnex.com"
15
+ Caboose::cdn_domain = "//d3w3nonj6twazr.cloudfront.net"
16
+ Caboose::email_from = "contact@repconnex.com"
17
+ Caboose::authenticator_class = 'Authenticator'
18
+ Caboose::use_ab_testing = false
19
+ Caboose::session_length = 24 # hours
@@ -0,0 +1,11 @@
1
+ # Paperclip config for S3 assets
2
+ config.paperclip_defaults = {
3
+ :storage => :s3,
4
+ :s3_credentials => {
5
+ :bucket => '<s3_bucket_name>',
6
+ :access_key_id => '<s3_key_id>',
7
+ :secret_access_key => '<s3_access_key>'
8
+ },
9
+ :url => ':s3_alias_url',
10
+ :s3_host_alias => '<cloudfront_url>'
11
+ }
@@ -0,0 +1 @@
1
+ |APP_NAME|::Application.config.session_store :active_record_store
@@ -0,0 +1,8 @@
1
+ |APP_NAME|::Application.routes.draw do
2
+
3
+ # Catch everything with caboose
4
+ mount Caboose::Engine => '/'
5
+ match '*path' => 'caboose/pages#show'
6
+ root :to => 'caboose/pages#show'
7
+
8
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.101
4
+ version: 0.3.110
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2014-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -392,10 +392,19 @@ files:
392
392
  - lib/caboose/migrations.rb
393
393
  - lib/caboose/version.rb
394
394
  - lib/caboose.rb
395
- - lib/sample_files/layout_default.html.erb
396
- - lib/sample_files/login.css
395
+ - lib/sample_files/app/assets/stylesheets/login.css
396
+ - lib/sample_files/app/controllers/application_controller.rb
397
+ - lib/sample_files/app/views/layouts/layout_default.html.erb
398
+ - lib/sample_files/config/application.rb
399
+ - lib/sample_files/config/initializers/action_mailer.rb
400
+ - lib/sample_files/config/initializers/asset_sync.rb
401
+ - lib/sample_files/config/initializers/caboose.rb
402
+ - lib/sample_files/config/initializers/paperclip.rb
403
+ - lib/sample_files/config/initializers/session_store.rb
404
+ - lib/sample_files/config/routes.rb
405
+ - lib/sample_files/config/tinymce.yml
406
+ - lib/sample_files/Gemfile
397
407
  - lib/sample_files/timezone_abbreviations.csv
398
- - lib/sample_files/tinymce.yml
399
408
  - lib/tasks/caboose.rake
400
409
  - MIT-LICENSE
401
410
  - Rakefile