cambium 0.0.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cambium +3 -7
  3. data/cambium.gemspec +1 -1
  4. data/lib/cambium/version.rb +1 -1
  5. data/lib/generators/cambium/{setup/views_generator.rb → install/admin_generator.rb} +39 -13
  6. data/lib/generators/cambium/{setup/javascripts_generator.rb → install/app_generator.rb} +74 -14
  7. data/lib/generators/cambium/{setup → install}/config_generator.rb +1 -1
  8. data/lib/generators/cambium/{setup/controllers_generator.rb → install/users_generator.rb} +26 -23
  9. data/lib/generators/cambium/{setup → install}/utilities_generator.rb +17 -1
  10. data/lib/generators/cambium/templates/Gemfile.erb +1 -1
  11. data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/admin.js.coffee → admin.js.coffee} +10 -0
  12. data/lib/generators/cambium/templates/app/assets/javascripts/admin/models/.gitkeep +0 -0
  13. data/lib/generators/cambium/templates/app/assets/javascripts/application.js +6 -3
  14. data/lib/generators/cambium/templates/app/assets/javascripts/backbone/app.js.coffee +0 -6
  15. data/lib/generators/cambium/templates/app/assets/javascripts/backbone/collections/.keep +0 -0
  16. data/lib/generators/cambium/templates/app/assets/javascripts/backbone/models/.keep +0 -0
  17. data/lib/generators/cambium/templates/app/assets/javascripts/backbone/templates/.keep +0 -0
  18. data/lib/generators/cambium/templates/app/views/admin/edit.html.erb +1 -1
  19. metadata +34 -35
  20. data/lib/generators/cambium/setup/devise_generator.rb +0 -78
  21. data/lib/generators/cambium/setup/helpers_generator.rb +0 -71
  22. data/lib/generators/cambium/setup/models_generator.rb +0 -116
  23. data/lib/generators/cambium/setup/stylesheets_generator.rb +0 -86
  24. data/lib/generators/cambium/templates/app/assets/javascripts/admin/admin.js +0 -12
  25. /data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/models → collections}/.gitkeep +0 -0
  26. /data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/routers → routers}/router.js.coffee +0 -0
  27. /data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/templates → templates}/paginator_controls.jst.ejs +0 -0
  28. /data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/templates → templates}/paginator_nav.jst.ejs +0 -0
  29. /data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/views → views}/accordion.js.coffee +0 -0
  30. /data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/views → views}/counter.js.coffee +0 -0
  31. /data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/views → views}/dropdown_toggle.js.coffee +0 -0
  32. /data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/views → views}/init_counter.js.coffee +0 -0
  33. /data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/views → views}/paginator.js.coffee +0 -0
  34. /data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/views → views}/publishable.js.coffee +0 -0
  35. /data/lib/generators/cambium/templates/app/assets/javascripts/admin/{backbone/views → views}/wysiwyg.js.coffee +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51a3c4b8209ac4b348b16e1c852d6d71f9f4cbdf
4
- data.tar.gz: e3e021298a50f0253858e5c086ab211ecf0294db
3
+ metadata.gz: 6a407bf17c4e0804831ae03956003662b4fa1c4a
4
+ data.tar.gz: 87aebe626dda6a7065ef2b1d12033dc9b16c3e74
5
5
  SHA512:
6
- metadata.gz: bb15ad72c5660eb5d50fef183221027b1406a278fd844945a276dfe8affb8a0d85d18f2ee4991034ae4c47868609af22496dd023edee3b4245f6008b382c8770
7
- data.tar.gz: d1761401c0993206ac32f755e5d1ad5a98ec7333499c4bac2b646b9b5f3de1fd9392e4a39526e3b722f97f2fa1d833112ae0cfad1bdf100bf5705155a5362c91
6
+ metadata.gz: 7e74609d438d4041935a3a12531f802cc21151efd6a7999812a10db4959412133e8d31dcc86fa61c8db821a1540603104f1e4448630fb46f172230b5aa1c3a91
7
+ data.tar.gz: 676135f57334756b6a36d0d67e49535f88312279a9bf921f43a4854d29050445d456ff8d4b0a3e0dfd79e74d0d0a4a3ad2874f8436b2237e4d0b7bf984e51eda
data/bin/cambium CHANGED
@@ -6,13 +6,9 @@
6
6
  case ARGV.first
7
7
  when "setup"
8
8
  system "#{@g} cambium:setup:config"
9
- system "#{@g} cambium:setup:devise"
10
- system "#{@g} cambium:setup:models"
11
- system "#{@g} cambium:setup:controllers"
12
- system "#{@g} cambium:setup:views"
13
- system "#{@g} cambium:setup:helpers"
14
- system "#{@g} cambium:setup:javascripts"
15
- system "#{@g} cambium:setup:stylesheets"
9
+ system "#{@g} cambium:setup:users"
10
+ system "#{@g} cambium:setup:app"
11
+ system "#{@g} cambium:setup:admin"
16
12
  system "#{@g} cambium:setup:utilities"
17
13
  else
18
14
  gem_root = Gem::Specification.find_by_name("cambium").gem_dir
data/cambium.gemspec CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  [
26
26
  'annotate',
27
+ 'backbone-on-rails',
27
28
  'bones-rails',
28
29
  'bourbon',
29
30
  'carrierwave',
@@ -35,7 +36,6 @@ Gem::Specification.new do |spec|
35
36
  'jbuilder',
36
37
  'jquery-rails',
37
38
  'pickadate-rails',
38
- 'rails-backbone',
39
39
  'sass-rails',
40
40
  'simple_form',
41
41
  'uglifier',
@@ -1,3 +1,3 @@
1
1
  module Cambium
2
- VERSION = "0.0.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -2,14 +2,28 @@ require 'rake'
2
2
  require 'rails/generators'
3
3
 
4
4
  module Cambium
5
- module Setup
6
- class ViewsGenerator < Rails::Generators::Base
7
- desc "Setup views for new rails project"
5
+ module Install
6
+ class AdminGenerator < Rails::Generators::Base
7
+ desc "Setup admin files for new rails project"
8
8
 
9
9
  # ------------------------------------------ Class Methods
10
10
 
11
11
  source_root File.expand_path('../../templates', __FILE__)
12
12
 
13
+ # ------------------------------------------ Admin Controller
14
+
15
+ def add_admin_controller
16
+ template "app/controllers/admin_controller.rb",
17
+ "app/controllers/admin_controller.rb"
18
+ end
19
+
20
+ # ------------------------------------------ Admin Users Controller
21
+
22
+ def add_admin_users_controller
23
+ template "app/controllers/admin/users_controller.rb",
24
+ "app/controllers/admin/users_controller.rb"
25
+ end
26
+
13
27
  # ------------------------------------------ Admin Views
14
28
 
15
29
  def add_admin_views
@@ -19,21 +33,33 @@ module Cambium
19
33
  # ------------------------------------------ Layouts
20
34
 
21
35
  def add_layouts
22
- @site_title = Rails.application.class.parent_name.humanize.titleize
23
- site_title = ask "\n#{set_color('App Title:', :green, :bold)} [default: #{@site_title}]"
36
+ @site_title = "#{Rails.application.class.parent_name.humanize.titleize} Admin"
37
+ site_title = ask "\n#{set_color('Admin Title:', :green, :bold)} [default: #{@site_title}]"
24
38
  @site_title = site_title unless site_title.blank?
25
-
26
- app = "app/views/layouts/application.html.erb"
39
+
27
40
  admin = "app/views/layouts/admin.html.erb"
28
- remove_file app
29
- template app, app
30
41
  template admin, admin
31
42
  end
32
43
 
33
- # ------------------------------------------ Public Views
44
+ # ------------------------------------------ Admin Helper
45
+
46
+ def add_admin_helper
47
+ template "app/helpers/admin_helper.rb",
48
+ "app/helpers/admin_helper.rb"
49
+ end
50
+
51
+ # ------------------------------------------ Admin Setup
52
+
53
+ def add_admin_files
54
+ directory "app/assets/javascripts/admin",
55
+ "app/assets/javascripts/admin"
56
+ end
57
+
58
+ # ------------------------------------------ Admin Styles
34
59
 
35
- def add_public_views
36
- directory "app/views/application", "app/views/application"
60
+ def add_admin_styles
61
+ directory "app/assets/stylesheets/admin",
62
+ "app/assets/stylesheets/admin"
37
63
  end
38
64
 
39
65
  # ------------------------------------------ Private Methods
@@ -76,7 +102,7 @@ module Cambium
76
102
 
77
103
  def confirm_ask(question)
78
104
  answer = ask("\n#{question}")
79
- match = ask("Confirm: #{question}")
105
+ match = ask("CONFIRM #{question}")
80
106
  if answer == match
81
107
  answer
82
108
  else
@@ -2,18 +2,48 @@ require 'rake'
2
2
  require 'rails/generators'
3
3
 
4
4
  module Cambium
5
- module Setup
6
- class JavascriptsGenerator < Rails::Generators::Base
7
- desc "Setup javascripts for new rails project"
8
-
9
- # ------------------------------------------ Class Methods
5
+ module Install
6
+ class AppGenerator < Rails::Generators::Base
7
+ desc "Setup app files for new rails project"
10
8
 
11
9
  source_root File.expand_path('../../templates', __FILE__)
12
10
 
11
+ # ------------------------------------------ Default Public Controller
12
+
13
+ def add_home_controller
14
+ run_cmd "#{g} controller home index"
15
+ end
16
+
17
+ # ------------------------------------------ Routes
18
+
19
+ def add_default_routes
20
+ remove_file "config/routes.rb"
21
+ template "config/routes.rb.erb", "config/routes.rb"
22
+ end
23
+
24
+ # ------------------------------------------ Public Views
25
+
26
+ def add_public_views
27
+ directory "app/views/application", "app/views/application"
28
+ end
29
+
30
+ # ------------------------------------------ Layouts
31
+
32
+ def add_layouts
33
+ @site_title = Rails.application.class.parent_name.humanize.titleize
34
+ site_title = ask "\n#{set_color('App Title:', :green, :bold)} [default: #{@site_title}]"
35
+ @site_title = site_title unless site_title.blank?
36
+
37
+ app = "app/views/layouts/application.html.erb"
38
+ remove_file app
39
+ template app, app
40
+ end
41
+
13
42
  # ------------------------------------------ Public Setup
14
43
 
15
44
  def install_backbone
16
- run_cmd "#{g} backbone:install"
45
+ directory "app/assets/javascripts/backbone",
46
+ "app/assets/javascripts"
17
47
  end
18
48
 
19
49
  def default_application_js
@@ -43,13 +73,6 @@ module Cambium
43
73
  "app/assets/javascripts/backbone/views/default_helpers.js.coffee"
44
74
  end
45
75
 
46
- # ------------------------------------------ Admin Setup
47
-
48
- def add_admin_files
49
- directory "app/assets/javascripts/admin",
50
- "app/assets/javascripts/admin"
51
- end
52
-
53
76
  # ------------------------------------------ Add Modernizr
54
77
 
55
78
  def add_modernizr
@@ -57,6 +80,27 @@ module Cambium
57
80
  copy_file modernizr, modernizr
58
81
  end
59
82
 
83
+ # ------------------------------------------ Public Styles
84
+
85
+ def add_public_manifest
86
+ ['css','scss','scss.css'].each { |ext| remove_file "app/assets/stylesheets/application.#{ext}" }
87
+ template "app/assets/stylesheets/application.scss",
88
+ "app/assets/stylesheets/application.scss"
89
+ end
90
+
91
+ # ------------------------------------------ Add Modernizr
92
+
93
+ def add_normalize
94
+ normalize = "vendor/assets/stylesheets/normalize.scss"
95
+ template normalize, normalize
96
+ end
97
+
98
+ # ------------------------------------------ Create Default User
99
+
100
+ def add_default_user
101
+ create_user
102
+ end
103
+
60
104
  # ------------------------------------------ Private Methods
61
105
 
62
106
  private
@@ -97,7 +141,7 @@ module Cambium
97
141
 
98
142
  def confirm_ask(question)
99
143
  answer = ask("\n#{question}")
100
- match = ask("Confirm: #{question}")
144
+ match = ask("CONFIRM #{question}")
101
145
  if answer == match
102
146
  answer
103
147
  else
@@ -106,6 +150,22 @@ module Cambium
106
150
  end
107
151
  end
108
152
 
153
+ def create_user
154
+ email = confirm_ask "#{set_color('Default User Email', :green, :bold)}:"
155
+ password = confirm_ask "#{set_color('Default User Password', :green, :bold)}:"
156
+ u = User.new(
157
+ :email => email,
158
+ :password => password,
159
+ :password_confirmation => password,
160
+ :is_admin => true
161
+ )
162
+ if u.save
163
+ say "User created successfully!"
164
+ else
165
+ create_user
166
+ end
167
+ end
168
+
109
169
  end
110
170
  end
111
171
  end
@@ -2,7 +2,7 @@ require 'rake'
2
2
  require 'rails/generators'
3
3
 
4
4
  module Cambium
5
- module Setup
5
+ module Install
6
6
  class ConfigGenerator < Rails::Generators::Base
7
7
  desc "Setup config files for new rails project"
8
8
 
@@ -2,39 +2,42 @@ require 'rake'
2
2
  require 'rails/generators'
3
3
 
4
4
  module Cambium
5
- module Setup
6
- class ControllersGenerator < Rails::Generators::Base
7
- desc "Setup controllers for new rails project"
8
-
9
- # ------------------------------------------ Class Methods
5
+ module Install
6
+ class UsersGenerator < Rails::Generators::Base
7
+ desc "Setup users model for new rails project"
10
8
 
11
9
  source_root File.expand_path('../../templates', __FILE__)
12
10
 
13
- # ------------------------------------------ Default Public Controller
11
+ # ------------------------------------------ Install Devise
14
12
 
15
- def add_home_controller
16
- run_cmd "#{g} controller home index"
13
+ def install_devise
14
+ unless File.exist?("#{Rails.root}/config/initializers/devise.rb")
15
+ run_cmd "#{g} devise:install"
16
+ end
17
+ unless File.exist?("#{Rails.root}/app/models/user.rb")
18
+ run_cmd "#{g} devise User"
19
+ end
17
20
  end
18
21
 
19
- # ------------------------------------------ Admin Controller
22
+ # ------------------------------------------ User Model
20
23
 
21
- def add_admin_controller
22
- template "app/controllers/admin_controller.rb",
23
- "app/controllers/admin_controller.rb"
24
+ def add_admin_column_to_users
25
+ file = Dir.glob("#{Rails.root}/db/migrate/*devise_create_users.rb").first
26
+ insert_into_file(
27
+ file,
28
+ "## Admin\n t.boolean :is_admin, :default => false \n\n ",
29
+ :before => "t.timestamps"
30
+ )
24
31
  end
25
32
 
26
- # ------------------------------------------ Admin Users Controller
27
-
28
- def add_admin_users_controller
29
- template "app/controllers/admin/users_controller.rb",
30
- "app/controllers/admin/users_controller.rb"
33
+ def add_user_model_file
34
+ remove_file "app/models/user.rb"
35
+ template "app/models/user.rb", "app/models/user.rb"
31
36
  end
32
37
 
33
- # ------------------------------------------ Routes
34
-
35
- def add_default_routes
36
- remove_file "config/routes.rb"
37
- template "config/routes.rb.erb", "config/routes.rb"
38
+ def migrate_and_annotate
39
+ run_cmd "#{rake} db:migrate"
40
+ run_cmd "#{be} annotate"
38
41
  end
39
42
 
40
43
  # ------------------------------------------ Log In/Out Redirects
@@ -87,7 +90,7 @@ module Cambium
87
90
 
88
91
  def confirm_ask(question)
89
92
  answer = ask("\n#{question}")
90
- match = ask("Confirm: #{question}")
93
+ match = ask("CONFIRM #{question}")
91
94
  if answer == match
92
95
  answer
93
96
  else
@@ -2,7 +2,7 @@ require 'rake'
2
2
  require 'rails/generators'
3
3
 
4
4
  module Cambium
5
- module Setup
5
+ module Install
6
6
  class UtilitiesGenerator < Rails::Generators::Base
7
7
  desc "Setup utilities for new rails project"
8
8
 
@@ -10,6 +10,22 @@ module Cambium
10
10
 
11
11
  source_root File.expand_path('../../templates', __FILE__)
12
12
 
13
+ # ------------------------------------------ Model Concerns
14
+
15
+ def add_model_concerns
16
+ [
17
+ 'idx',
18
+ 'name',
19
+ 'publishable',
20
+ 'slug',
21
+ 'tags',
22
+ 'title',
23
+ ].each do |concern|
24
+ copy_file "app/models/concerns/#{concern}.rb",
25
+ "app/models/concerns/#{concern}.rb"
26
+ end
27
+ end
28
+
13
29
  # ------------------------------------------ Settings Files
14
30
 
15
31
  def add_settings_files
@@ -14,7 +14,7 @@ gem 'coffee-rails'
14
14
  gem 'jquery-rails'
15
15
  gem 'bones-rails'
16
16
  gem 'bourbon'
17
- gem 'rails-backbone'
17
+ gem 'backbone-on-rails'
18
18
 
19
19
  # ------------------------------------------ View Helpers
20
20
 
@@ -1,6 +1,16 @@
1
+ #= require jquery
2
+ #= require jquery_ujs
3
+ #= require pickadate/picker
4
+ #= require pickadate/picker.date
5
+ #= require pickadate/picker.time
6
+ #= require admin/wysihtml5
7
+ #= require parser_rules/advanced
8
+ #= require underscore
9
+ #= require backbone
1
10
  #= require_self
2
11
  #= require_tree ./templates
3
12
  #= require_tree ./models
13
+ #= require_tree ./collections
4
14
  #= require_tree ./views
5
15
  #= require_tree ./routers
6
16
 
@@ -2,6 +2,9 @@
2
2
  //= require jquery_ujs
3
3
  //= require underscore
4
4
  //= require backbone
5
- //= require backbone_rails_sync
6
- //= require backbone_datalink
7
- //= require backbone/app
5
+ //= require app
6
+ //= require_tree ./templates
7
+ //= require_tree ./models
8
+ //= require_tree ./collections
9
+ //= require_tree ./views
10
+ //= require_tree ./routers
@@ -1,9 +1,3 @@
1
- #= require_self
2
- #= require_tree ./templates
3
- #= require_tree ./models
4
- #= require_tree ./views
5
- #= require_tree ./routers
6
-
7
1
  window.App =
8
2
  Models: {}
9
3
  Collections: {}
@@ -1,2 +1,2 @@
1
1
  <%= form_page :classname => @model.to_s, :index => @routes[:index],
2
- :title => "Edit #{@item.title.to_s}" %>
2
+ :title => "Edit #{@item.respond_to?(:title) ? @item.title.to_s : @item.send(@columns.first)}" %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cambium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean C Davis
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: bones-rails
70
+ name: backbone-on-rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: bourbon
84
+ name: bones-rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: carrierwave
98
+ name: bourbon
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: coffee-rails
112
+ name: carrierwave
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: devise
126
+ name: coffee-rails
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: factory_girl_rails
140
+ name: devise
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
@@ -151,7 +151,7 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: faker
154
+ name: factory_girl_rails
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
@@ -165,7 +165,7 @@ dependencies:
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
- name: hirb
168
+ name: faker
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - ">="
@@ -179,7 +179,7 @@ dependencies:
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
- name: jbuilder
182
+ name: hirb
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - ">="
@@ -193,7 +193,7 @@ dependencies:
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  - !ruby/object:Gem::Dependency
196
- name: jquery-rails
196
+ name: jbuilder
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - ">="
@@ -207,7 +207,7 @@ dependencies:
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  - !ruby/object:Gem::Dependency
210
- name: pickadate-rails
210
+ name: jquery-rails
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - ">="
@@ -221,7 +221,7 @@ dependencies:
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  - !ruby/object:Gem::Dependency
224
- name: rails-backbone
224
+ name: pickadate-rails
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - ">="
@@ -322,34 +322,33 @@ files:
322
322
  - lib/cambium.rb
323
323
  - lib/cambium/engine.rb
324
324
  - lib/cambium/version.rb
325
- - lib/generators/cambium/setup/config_generator.rb
326
- - lib/generators/cambium/setup/controllers_generator.rb
327
- - lib/generators/cambium/setup/devise_generator.rb
328
- - lib/generators/cambium/setup/helpers_generator.rb
329
- - lib/generators/cambium/setup/javascripts_generator.rb
330
- - lib/generators/cambium/setup/models_generator.rb
331
- - lib/generators/cambium/setup/stylesheets_generator.rb
332
- - lib/generators/cambium/setup/utilities_generator.rb
333
- - lib/generators/cambium/setup/views_generator.rb
325
+ - lib/generators/cambium/install/admin_generator.rb
326
+ - lib/generators/cambium/install/app_generator.rb
327
+ - lib/generators/cambium/install/config_generator.rb
328
+ - lib/generators/cambium/install/users_generator.rb
329
+ - lib/generators/cambium/install/utilities_generator.rb
334
330
  - lib/generators/cambium/templates/Gemfile.erb
335
331
  - lib/generators/cambium/templates/app/assets/javascripts/.DS_Store
336
- - lib/generators/cambium/templates/app/assets/javascripts/admin/admin.js
337
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/admin.js.coffee
338
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/models/.gitkeep
339
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/routers/router.js.coffee
340
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/templates/paginator_controls.jst.ejs
341
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/templates/paginator_nav.jst.ejs
342
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/views/accordion.js.coffee
343
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/views/counter.js.coffee
344
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/views/dropdown_toggle.js.coffee
345
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/views/init_counter.js.coffee
346
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/views/paginator.js.coffee
347
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/views/publishable.js.coffee
348
- - lib/generators/cambium/templates/app/assets/javascripts/admin/backbone/views/wysiwyg.js.coffee
332
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/admin.js.coffee
333
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/collections/.gitkeep
334
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/models/.gitkeep
335
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/routers/router.js.coffee
336
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/templates/paginator_controls.jst.ejs
337
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/templates/paginator_nav.jst.ejs
338
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/views/accordion.js.coffee
339
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/views/counter.js.coffee
340
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/views/dropdown_toggle.js.coffee
341
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/views/init_counter.js.coffee
342
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/views/paginator.js.coffee
343
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/views/publishable.js.coffee
344
+ - lib/generators/cambium/templates/app/assets/javascripts/admin/views/wysiwyg.js.coffee
349
345
  - lib/generators/cambium/templates/app/assets/javascripts/admin/wysihtml5.js
350
346
  - lib/generators/cambium/templates/app/assets/javascripts/application.js
351
347
  - lib/generators/cambium/templates/app/assets/javascripts/backbone/app.js.coffee
348
+ - lib/generators/cambium/templates/app/assets/javascripts/backbone/collections/.keep
349
+ - lib/generators/cambium/templates/app/assets/javascripts/backbone/models/.keep
352
350
  - lib/generators/cambium/templates/app/assets/javascripts/backbone/routers/router.js.coffee
351
+ - lib/generators/cambium/templates/app/assets/javascripts/backbone/templates/.keep
353
352
  - lib/generators/cambium/templates/app/assets/javascripts/backbone/views/default_helpers.js.coffee
354
353
  - lib/generators/cambium/templates/app/assets/stylesheets/admin/admin.scss
355
354
  - lib/generators/cambium/templates/app/assets/stylesheets/admin/bones/bones-config/__default.scss
@@ -1,78 +0,0 @@
1
- require 'rake'
2
- require 'rails/generators'
3
-
4
- module Cambium
5
- module Setup
6
- class DeviseGenerator < Rails::Generators::Base
7
- desc "Setup Devise for new rails project"
8
-
9
- # ------------------------------------------ Class Methods
10
-
11
- source_root File.expand_path('../../templates', __FILE__)
12
-
13
- # ------------------------------------------ Devise
14
-
15
- def install_devise
16
- unless File.exist?("#{Rails.root}/config/initializers/devise.rb")
17
- run_cmd "#{g} devise:install"
18
- end
19
- unless File.exist?("#{Rails.root}/app/models/user.rb")
20
- run_cmd "#{g} devise User"
21
- run_cmd "#{rake} db:migrate"
22
- end
23
- end
24
-
25
- # ------------------------------------------ Private Methods
26
-
27
- private
28
-
29
- def run_cmd(cmd, options = {})
30
- print_table(
31
- [
32
- [set_color("run", :green, :bold), cmd]
33
- ],
34
- :indent => 9
35
- )
36
- if options[:quiet] == true
37
- `#{cmd}`
38
- else
39
- system(cmd)
40
- end
41
- end
42
-
43
- def template_file(name)
44
- File.expand_path("../../templates/#{name}", __FILE__)
45
- end
46
-
47
- def file_contents(template)
48
- File.read(template_file(template))
49
- end
50
-
51
- def be
52
- "bundle exec"
53
- end
54
-
55
- def g
56
- "#{be} rails g"
57
- end
58
-
59
- def rake
60
- "#{be} rake"
61
- end
62
-
63
- def confirm_ask(question)
64
- answer = ask("\n#{question}")
65
- match = ask("Confirm: #{question}")
66
- if answer == match
67
- answer
68
- else
69
- say set_color("Did not match.", :red)
70
- confirm_ask(question)
71
- end
72
- end
73
-
74
- # ------------------------------------------
75
-
76
- end
77
- end
78
- end
@@ -1,71 +0,0 @@
1
- require 'rake'
2
- require 'rails/generators'
3
-
4
- module Cambium
5
- module Setup
6
- class HelpersGenerator < Rails::Generators::Base
7
- desc "Setup helpers for new rails project"
8
-
9
- # ------------------------------------------ Class Methods
10
-
11
- source_root File.expand_path('../../templates', __FILE__)
12
-
13
- # ------------------------------------------ Admin Helper
14
-
15
- def add_admin_helper
16
- template "app/helpers/admin_helper.rb",
17
- "app/helpers/admin_helper.rb"
18
- end
19
-
20
- # ------------------------------------------ Private Methods
21
-
22
- private
23
-
24
- def run_cmd(cmd, options = {})
25
- print_table(
26
- [
27
- [set_color("run", :green, :bold), cmd]
28
- ],
29
- :indent => 9
30
- )
31
- if options[:quiet] == true
32
- `#{cmd}`
33
- else
34
- system(cmd)
35
- end
36
- end
37
-
38
- def template_file(name)
39
- File.expand_path("../../templates/#{name}", __FILE__)
40
- end
41
-
42
- def file_contents(template)
43
- File.read(template_file(template))
44
- end
45
-
46
- def be
47
- "bundle exec"
48
- end
49
-
50
- def g
51
- "#{be} rails g"
52
- end
53
-
54
- def rake
55
- "#{be} rake"
56
- end
57
-
58
- def confirm_ask(question)
59
- answer = ask("\n#{question}")
60
- match = ask("Confirm: #{question}")
61
- if answer == match
62
- answer
63
- else
64
- say set_color("Did not match.", :red)
65
- confirm_ask(question)
66
- end
67
- end
68
-
69
- end
70
- end
71
- end
@@ -1,116 +0,0 @@
1
- require 'rake'
2
- require 'rails/generators'
3
-
4
- module Cambium
5
- module Setup
6
- class ModelsGenerator < Rails::Generators::Base
7
- desc "Setup models for new rails project"
8
-
9
- # ------------------------------------------ Class Methods
10
-
11
- source_root File.expand_path('../../templates', __FILE__)
12
-
13
- # ------------------------------------------ User Model
14
-
15
- def add_admin_column_to_users
16
- unless User.column_names.include?('is_admin')
17
- run_cmd "#{g} migration add_is_admin_to_users is_admin:boolean"
18
- run_cmd "#{rake} db:migrate"
19
- end
20
- end
21
-
22
- def add_user_model_file
23
- remove_file "app/models/user.rb"
24
- template "app/models/user.rb", "app/models/user.rb"
25
- run_cmd "#{be} annotate"
26
- end
27
-
28
- def add_default_user
29
- User.reset_column_information
30
- create_user
31
- end
32
-
33
- # ------------------------------------------ Model Concerns
34
-
35
- def add_model_concerns
36
- [
37
- 'idx',
38
- 'name',
39
- 'publishable',
40
- 'slug',
41
- 'tags',
42
- 'title',
43
- ].each do |concern|
44
- copy_file "app/models/concerns/#{concern}.rb",
45
- "app/models/concerns/#{concern}.rb"
46
- end
47
- end
48
-
49
- # ------------------------------------------ Private Methods
50
-
51
- private
52
-
53
- def run_cmd(cmd, options = {})
54
- print_table(
55
- [
56
- [set_color("run", :green, :bold), cmd]
57
- ],
58
- :indent => 9
59
- )
60
- if options[:quiet] == true
61
- `#{cmd}`
62
- else
63
- system(cmd)
64
- end
65
- end
66
-
67
- def template_file(name)
68
- File.expand_path("../../templates/#{name}", __FILE__)
69
- end
70
-
71
- def file_contents(template)
72
- File.read(template_file(template))
73
- end
74
-
75
- def be
76
- "bundle exec"
77
- end
78
-
79
- def g
80
- "#{be} rails g"
81
- end
82
-
83
- def rake
84
- "#{be} rake"
85
- end
86
-
87
- def confirm_ask(question)
88
- answer = ask("\n#{question}")
89
- match = ask("CONFIRM #{question}")
90
- if answer == match
91
- answer
92
- else
93
- say set_color("Did not match.", :red)
94
- confirm_ask(question)
95
- end
96
- end
97
-
98
- def create_user
99
- email = confirm_ask "#{set_color('Default User Email', :green, :bold)}:"
100
- password = confirm_ask "#{set_color('Default User Password', :green, :bold)}:"
101
- u = User.new(
102
- :email => email,
103
- :password => password,
104
- :password_confirmation => password,
105
- :is_admin => true
106
- )
107
- if u.save
108
- say "User created successfully!"
109
- else
110
- create_user
111
- end
112
- end
113
-
114
- end
115
- end
116
- end
@@ -1,86 +0,0 @@
1
- require 'rake'
2
- require 'rails/generators'
3
-
4
- module Cambium
5
- module Setup
6
- class StylesheetsGenerator < Rails::Generators::Base
7
- desc "Setup stylesheets for new rails project"
8
-
9
- # ------------------------------------------ Class Methods
10
-
11
- source_root File.expand_path('../../templates', __FILE__)
12
-
13
- # ------------------------------------------ Public Styles
14
-
15
- def add_public_manifest
16
- ['css','scss','scss.css'].each { |ext| remove_file "app/assets/stylesheets/application.#{ext}" }
17
- template "app/assets/stylesheets/application.scss",
18
- "app/assets/stylesheets/application.scss"
19
- end
20
-
21
- # ------------------------------------------ Admin Styles
22
-
23
- def add_admin_styles
24
- directory "app/assets/stylesheets/admin",
25
- "app/assets/stylesheets/admin"
26
- end
27
-
28
- # ------------------------------------------ Add Modernizr
29
-
30
- def add_normalize
31
- normalize = "vendor/assets/stylesheets/normalize.scss"
32
- template normalize, normalize
33
- end
34
-
35
- # ------------------------------------------ Private Methods
36
-
37
- private
38
-
39
- def run_cmd(cmd, options = {})
40
- print_table(
41
- [
42
- [set_color("run", :green, :bold), cmd]
43
- ],
44
- :indent => 9
45
- )
46
- if options[:quiet] == true
47
- `#{cmd}`
48
- else
49
- system(cmd)
50
- end
51
- end
52
-
53
- def template_file(name)
54
- File.expand_path("../../templates/#{name}", __FILE__)
55
- end
56
-
57
- def file_contents(template)
58
- File.read(template_file(template))
59
- end
60
-
61
- def be
62
- "bundle exec"
63
- end
64
-
65
- def g
66
- "#{be} rails g"
67
- end
68
-
69
- def rake
70
- "#{be} rake"
71
- end
72
-
73
- def confirm_ask(question)
74
- answer = ask("\n#{question}")
75
- match = ask("Confirm: #{question}")
76
- if answer == match
77
- answer
78
- else
79
- say set_color("Did not match.", :red)
80
- confirm_ask(question)
81
- end
82
- end
83
-
84
- end
85
- end
86
- end
@@ -1,12 +0,0 @@
1
- //= require jquery
2
- //= require jquery_ujs
3
- //= require pickadate/picker
4
- //= require pickadate/picker.date
5
- //= require pickadate/picker.time
6
- //= require admin/wysihtml5
7
- //= require parser_rules/advanced
8
- //= require underscore
9
- //= require backbone
10
- //= require backbone_rails_sync
11
- //= require backbone_datalink
12
- //= require admin/backbone/admin