bootstrappers 0.1.0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,15 @@
1
1
  alpha
2
+
3
+ 0.2.0 (DEC 16, 2012)
2
4
  * add lib/tasks
3
5
  * fixing typo
4
6
  * fixing deploy file
7
+ * update to bootstrap-helper 2.2.0
8
+ * update to bootstrap-helper 2.1.2.1
9
+ * remove newrelic_rpm
10
+ * rvm-capistrano
11
+ * replace devise.email_sender to Setting.email_sender
12
+ * add login_required to application_controller
5
13
 
6
14
  0.1.0 (Nov 12, 2012)
7
15
  * add powder to Gemfile
data/README.md CHANGED
@@ -40,6 +40,7 @@ It includes application gems like:
40
40
 
41
41
  * [Capistrano](https://github.com/capistrano/capistrano)
42
42
  * [Cape](https://github.com/njonsson/cape)
43
+ * [rvm-capistrano](https://github.com/wayneeseguin/rvm-capistrano)
43
44
  * [Airbrake](https://github.com/airbrake/airbrake)
44
45
  * [NewRelic RPM](https://github.com/newrelic/rpm)
45
46
  * [Turbo Sprockets for Rails 3.2.x](https://github.com/ndbroadbent/turbo-sprockets-rails3) Speeds up your Rails 3 rake assets:precompile by only recompiling changed assets
@@ -50,7 +51,9 @@ It includes application gems like:
50
51
  * [Settingslogic](https://github.com/binarylogic/settingslogic)
51
52
  * [Pry](http://pryrepl.org/)
52
53
 
54
+ ### Dev Enviorments
53
55
 
56
+ * [Better Errors](https://github.com/charliesome/better_errors)
54
57
 
55
58
  ## Remind
56
59
 
data/TODO.md CHANGED
@@ -6,7 +6,6 @@
6
6
  - Facebook
7
7
  * Devise
8
8
  - Login Form refactor
9
- - replace sender to Setting.email_sender
10
9
  * Cancan
11
10
  * Testing Tool
12
11
  * Social
@@ -21,4 +20,8 @@
21
20
  - multistage
22
21
  * Amazon SES
23
22
  * Caching
24
- - add config.cache_stor t0 dali
23
+ - add config.cache_store to dali
24
+ * Refactor Devise Views
25
+ * add group hack to bootstrap css
26
+ * add require admin to applicaiton controller
27
+ * add admin to menu
@@ -2,6 +2,7 @@
2
2
 
3
3
  require File.expand_path(File.join('..', 'lib', 'bootstrappers', 'generators', 'app_generator'), File.dirname(__FILE__))
4
4
  require File.expand_path(File.join('..', 'lib', 'bootstrappers', 'actions'), File.dirname(__FILE__))
5
+ require File.expand_path(File.join('..', 'lib', 'bootstrappers', 'layout_actions'), File.dirname(__FILE__))
5
6
  require File.expand_path(File.join('..', 'lib', 'bootstrappers', 'app_builder'), File.dirname(__FILE__))
6
7
 
7
8
  templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
@@ -2,96 +2,27 @@ module Bootstrappers
2
2
  class AppBuilder < Rails::AppBuilder
3
3
 
4
4
  include Bootstrappers::Actions
5
+ include Bootstrappers::LayoutActions
5
6
 
6
- def readme
7
- template 'README.md.erb', 'README.md'
8
- end
9
-
10
- def remove_public_index
11
- remove_file 'public/index.html'
12
- end
13
-
14
- def remove_rails_logo_image
15
- remove_file 'app/assets/images/rails.png'
16
- end
17
7
 
18
8
  def raise_delivery_errors
19
- replace_in_file 'config/environments/development.rb',
20
- 'raise_delivery_errors = false', 'raise_delivery_errors = true'
9
+ replace_in_file 'config/environments/development.rb', 'raise_delivery_errors = false', 'raise_delivery_errors = true'
21
10
  end
22
11
 
23
- def create_partials_directory
24
- empty_directory 'app/views/application'
25
- empty_directory 'app/views/pages'
26
- empty_directory 'app/views/common'
27
- end
28
-
29
- def create_application_layout
30
- template 'bootstrappers_layout.html.erb.erb',
31
- 'app/views/layouts/application.html.erb',
32
- :force => true
33
- end
34
-
35
- def create_common_javascripts
36
- remove_file 'app/assets/javascripts/application.js'
37
- directory 'javascripts', 'app/assets/javascripts'
38
- end
39
-
40
- def create_common_stylesheets
41
- remove_file 'app/assets/stylesheets/application.css'
42
- directory 'stylesheets', 'app/assets/stylesheets'
43
- end
44
-
45
- def create_common_partial
46
- directory 'common', 'app/views/common'
47
- end
48
-
49
-
50
12
  def add_common_rake_tasks
51
13
  directory 'tasks', 'lib/tasks'
52
14
  end
53
15
 
54
- def add_jquery_ui
55
- inject_into_file 'app/assets/javascripts/application.js',
56
- "//= require jquery-ui\n", :before => '//= require_tree .'
57
- end
58
-
59
- def add_bootstrap_js
60
- inject_into_file 'app/assets/javascripts/application.js',
61
- "//= require twitter/bootstrap/alert\n", :before => '//= require_tree .'
62
- end
63
-
64
- def add_custom_gems
65
- additions_path = find_in_source_paths 'Gemfile_additions'
66
- new_gems = File.open(additions_path).read
67
- inject_into_file 'Gemfile', "\n#{new_gems}",
68
- :after => /gem 'jquery-rails'/
69
- end
70
-
71
16
  def add_devise_gem
72
17
  inject_into_file 'Gemfile', "\ngem 'devise'",
73
- :after => /gem 'jquery-rails'/
74
- end
75
-
76
- def use_mysql_config_template
77
-
78
- template 'mysql_database.yml.erb', 'config/database.yml',:force => true
79
- template 'mysql_database.yml.erb', 'config/database.yml.example', :force => true
80
-
81
- db_user_name = ask("What is your local database user name? [root]")
82
- db_password = ask("What is your local database password? ['']")
83
-
84
- replace_in_file 'config/database.yml', 'username: root', "username: #{db_user_name}" if db_user_name.present?
85
- replace_in_file 'config/database.yml', 'password: ""', "password: '#{db_password}'" if db_password.present?
86
-
87
-
18
+ :after => /gem 'jquery-rails'/
88
19
  end
89
20
 
90
21
  def create_capistrano_files
91
- template 'capistrano/deploy_rb.erb', 'config/deploy.rb',:force => true
92
- template 'capistrano/Capfile', 'Capfile',:force => true
93
- empty_directory 'config/deploy'
94
- directory 'capistrano/deploy', 'config/deploy'
22
+ template 'capistrano/deploy_rb.erb', 'config/deploy.rb',:force => true
23
+ template 'capistrano/Capfile', 'Capfile',:force => true
24
+ empty_directory 'config/deploy'
25
+ directory 'capistrano/deploy', 'config/deploy'
95
26
  end
96
27
 
97
28
  def create_database
@@ -103,21 +34,27 @@ module Bootstrappers
103
34
  generate 'devise User'
104
35
  end
105
36
 
106
- def customize_error_pages
107
- meta_tags =<<-EOS
108
- <meta charset='utf-8' />
109
- <meta name='ROBOTS' content='NOODP' />
110
- EOS
111
- style_tags =<<-EOS
112
- <link href='/assets/application.css' media='all' rel='stylesheet' type='text/css' />
113
- EOS
114
- %w(500 404 422).each do |page|
115
- inject_into_file "public/#{page}.html", meta_tags, :after => "<head>\n"
116
- replace_in_file "public/#{page}.html", /<style.+>.+<\/style>/mi, style_tags.strip
117
- replace_in_file "public/#{page}.html", /<!--.+-->\n/, ''
37
+ def replace_email_sender_for_devise
38
+ replace_in_file 'config/initializers/devise.rb', /config\.mailer_sender = \".+\"/ , "config.mailer_sender = Setting.email_sender"
39
+ end
40
+
41
+ def gitignore_files
42
+ concat_file 'bootstrappers_gitignore', '.gitignore'
43
+ ['app/models',
44
+ 'app/assets/images',
45
+ 'app/views/pages',
46
+ 'db/migrate',
47
+ 'log',
48
+ ].each do |dir|
49
+ empty_directory_with_gitkeep dir
118
50
  end
119
51
  end
120
52
 
53
+ def init_git
54
+ run "git init"
55
+ end
56
+
57
+
121
58
  def build_settings_from_config
122
59
 
123
60
  template 'setting.rb', 'app/models/setting.rb',:force => true
@@ -128,35 +65,27 @@ module Bootstrappers
128
65
  directory 'initializers', 'config/initializers'
129
66
  end
130
67
 
131
- def setup_stylesheets
132
- copy_file 'app/assets/stylesheets/application.css', 'app/assets/stylesheets/application.css.scss'
133
- remove_file 'app/assets/stylesheets/application.css'
134
- concat_file 'import_scss_styles', 'app/assets/stylesheets/application.css.scss'
68
+ def add_common_method_to_application_controller
69
+ template 'application_controller_rb', 'app/controllers/application_controller.rb',:force => true
135
70
  end
136
71
 
137
- def setup_root_route
138
- template 'welcome.html.erb', 'app/views/pages/welcome.html.erb',:force => true
139
- route "root :to => 'high_voltage/pages#show', :id => 'welcome'"
140
- end
141
72
 
142
73
  def remove_routes_comment_lines
143
74
  replace_in_file 'config/routes.rb', /Application\.routes\.draw do.*end/m, "Application.routes.draw do\nend"
144
75
  end
145
76
 
146
- def gitignore_files
147
- concat_file 'bootstrappers_gitignore', '.gitignore'
148
- ['app/models',
149
- 'app/assets/images',
150
- 'app/views/pages',
151
- 'db/migrate',
152
- 'log',
153
- ].each do |dir|
154
- empty_directory_with_gitkeep dir
155
- end
156
- end
77
+ def use_mysql_config_template
78
+ template 'mysql_database.yml.erb', 'config/database.yml',:force => true
79
+ template 'mysql_database.yml.erb', 'config/database.yml.example', :force => true
80
+
81
+ db_user_name = ask("What is your local database user name? [root]")
82
+ db_password = ask("What is your local database password? ['']")
83
+
84
+ replace_in_file 'config/database.yml', 'username: root', "username: #{db_user_name}" if db_user_name.present?
85
+ replace_in_file 'config/database.yml', 'password: ""', "password: '#{db_password}'" if db_password.present?
157
86
 
158
- def init_git
159
- run 'git init'
160
87
  end
88
+
89
+
161
90
  end
162
91
  end
@@ -28,6 +28,7 @@ module Bootstrappers
28
28
  invoke :configure_app
29
29
  invoke :create_initializers
30
30
  invoke :remove_routes_comment_lines
31
+ invoke :add_common_method_to_application_controller
31
32
  invoke :setup_root_route
32
33
  invoke :setup_git
33
34
  end
@@ -72,8 +73,6 @@ module Bootstrappers
72
73
  build :add_common_rake_tasks
73
74
  end
74
75
 
75
-
76
-
77
76
  def customize_gemfile
78
77
  build :add_custom_gems
79
78
  build :add_devise_gem
@@ -109,19 +108,22 @@ module Bootstrappers
109
108
 
110
109
  def setup_devise
111
110
  build :generate_devise
111
+ build :replace_email_sender_for_devise
112
112
  end
113
113
 
114
-
115
114
  def customize_error_pages
116
115
  say 'Customizing the 500/404/422 pages'
117
116
  build :customize_error_pages
118
117
  end
119
118
 
120
-
121
119
  def remove_routes_comment_lines
122
120
  build :remove_routes_comment_lines
123
121
  end
124
122
 
123
+ def add_common_method_to_application_controller
124
+ build :add_common_method_to_application_controller
125
+ end
126
+
125
127
  def setup_root_route
126
128
  build :setup_root_route
127
129
  end
@@ -0,0 +1,88 @@
1
+ module Bootstrappers
2
+ module LayoutActions
3
+
4
+ def readme
5
+ template 'README.md.erb', 'README.md'
6
+ end
7
+
8
+ def remove_public_index
9
+ remove_file 'public/index.html'
10
+ end
11
+
12
+ def remove_rails_logo_image
13
+ remove_file 'app/assets/images/rails.png'
14
+ end
15
+
16
+ def create_partials_directory
17
+ empty_directory 'app/views/application'
18
+ empty_directory 'app/views/pages'
19
+ empty_directory 'app/views/common'
20
+ end
21
+
22
+ def create_application_layout
23
+ template 'bootstrappers_layout.html.erb.erb',
24
+ 'app/views/layouts/application.html.erb',
25
+ :force => true
26
+ end
27
+
28
+ def create_common_javascripts
29
+ remove_file 'app/assets/javascripts/application.js'
30
+ directory 'javascripts', 'app/assets/javascripts'
31
+ end
32
+
33
+ def create_common_stylesheets
34
+ remove_file 'app/assets/stylesheets/application.css'
35
+ directory 'stylesheets', 'app/assets/stylesheets'
36
+ end
37
+
38
+ def create_common_partial
39
+ directory 'common', 'app/views/common'
40
+ end
41
+
42
+ def add_jquery_ui
43
+ inject_into_file 'app/assets/javascripts/application.js',
44
+ "//= require jquery-ui\n", :before => '//= require_tree .'
45
+ end
46
+
47
+ def add_bootstrap_js
48
+ inject_into_file 'app/assets/javascripts/application.js',
49
+ "//= require twitter/bootstrap/alert\n", :before => '//= require_tree .'
50
+ end
51
+
52
+ def add_custom_gems
53
+ additions_path = find_in_source_paths 'Gemfile_additions'
54
+ new_gems = File.open(additions_path).read
55
+ inject_into_file 'Gemfile', "\n#{new_gems}",
56
+ :after => /gem 'jquery-rails'/
57
+ end
58
+
59
+
60
+ def setup_stylesheets
61
+ copy_file 'app/assets/stylesheets/application.css', 'app/assets/stylesheets/application.css.scss'
62
+ remove_file 'app/assets/stylesheets/application.css'
63
+ concat_file 'import_scss_styles', 'app/assets/stylesheets/application.css.scss'
64
+ end
65
+
66
+ def setup_root_route
67
+ template 'welcome.html.erb', 'app/views/pages/welcome.html.erb',:force => true
68
+ route "root :to => 'high_voltage/pages#show', :id => 'welcome'"
69
+ end
70
+
71
+
72
+ def customize_error_pages
73
+ meta_tags =<<-EOS
74
+ <meta charset='utf-8' />
75
+ <meta name='ROBOTS' content='NOODP' />
76
+ EOS
77
+ style_tags =<<-EOS
78
+ <link href='/assets/application.css' media='all' rel='stylesheet' type='text/css' />
79
+ EOS
80
+ %w(500 404 422).each do |page|
81
+ inject_into_file "public/#{page}.html", meta_tags, :after => "<head>\n"
82
+ replace_in_file "public/#{page}.html", /<style.+>.+<\/style>/mi, style_tags.strip
83
+ replace_in_file "public/#{page}.html", /<!--.+-->\n/, ''
84
+ end
85
+ end
86
+
87
+ end
88
+ end
@@ -1,3 +1,3 @@
1
1
  module Bootstrappers
2
- VERSION = "0.1.0.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,4 +1,3 @@
1
-
2
1
  gem "seo_helper", "~> 1.0"
3
2
  gem "open_graph_helper"
4
3
 
@@ -8,8 +7,8 @@ gem "carrierwave-meta"
8
7
 
9
8
  gem "settingslogic"
10
9
 
11
- gem "anjlab-bootstrap-rails", ">= 2.1", :require => "bootstrap-rails"
12
- gem "bootstrap_helper", ">= 2.1.2"
10
+ gem "anjlab-bootstrap-rails", ">= 2.2.2", :require => "bootstrap-rails"
11
+ gem "bootstrap_helper", ">= 2.1.2.1"
13
12
  gem "simple_form", "2.0.3"
14
13
  gem "will_paginate", "3.0.3"
15
14
 
@@ -18,6 +17,9 @@ gem "high_voltage"
18
17
  gem "airbrake"
19
18
  gem "turbo-sprockets-rails3"
20
19
 
20
+ gem "rvm-capistrano"
21
+
22
+
21
23
  # Cache
22
24
  gem "dalli"
23
25
 
@@ -25,10 +27,12 @@ group :assets do
25
27
  gem "compass-rails"
26
28
  end
27
29
 
28
- group :development do
30
+ group :development do
29
31
  gem "capistrano"
30
32
  gem "capistrano-ext"
31
33
  gem "cape"
34
+ gem "binding_of_caller"
35
+ gem "better_errors"
32
36
  gem "magic_encoding"
33
37
  gem "annotate"
34
38
  gem "powder"
@@ -36,6 +40,3 @@ group :development do
36
40
  gem "pry-remote"
37
41
  end
38
42
 
39
- group :production do
40
- gem "newrelic_rpm"
41
- end
@@ -0,0 +1,22 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+
4
+ def login_required
5
+ if current_user.blank?
6
+ respond_to do |format|
7
+ format.html {
8
+ authenticate_user!
9
+ }
10
+ format.js{
11
+ render :partial => "common/not_logined"
12
+ }
13
+ format.all {
14
+ head(:unauthorized)
15
+ }
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+
22
+ end
@@ -2,4 +2,4 @@ load 'deploy'
2
2
  # Uncomment if you are using Rails' asset pipeline
3
3
  load 'deploy/assets'
4
4
  load 'config/deploy'
5
- load 'config/deploy/assets'
5
+ # load 'config/deploy/assets'
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "./config/boot"
4
4
  require "bundler/capistrano"
5
+ require "rvm-capistrano"
5
6
 
6
7
  default_environment["PATH"] = "/opt/ruby/bin:/usr/local/bin:/usr/bin:/bin"
7
8
 
@@ -19,6 +20,8 @@ set :deploy_to, "/home/apps/#{application}"
19
20
  set :runner, "apps"
20
21
  set :deploy_via, :remote_cache
21
22
  set :git_shallow_clone, 1
23
+ set :use_sudo, false
24
+ set :rvm_ruby_string, '1.9.3'
22
25
 
23
26
  role :web, "<%= app_name %>.com" # Your HTTP server, Apache/etc
24
27
  role :app, "<%= app_name %>.com" # This may be the same as your `Web` server
@@ -0,0 +1,4 @@
1
+ if (confirm("Please login first, proceed?") )
2
+ {
3
+ window.location = "/users/sign_in";
4
+ }
@@ -18,7 +18,7 @@
18
18
  </li>
19
19
 
20
20
  <% else %>
21
- <li> <%= link_to( "Sing Up" ,new_user_registration_path) %> </li>
21
+ <li> <%= link_to( "Sign Up" ,new_user_registration_path) %> </li>
22
22
  <li> <%= link_to( "Login", new_user_session_path ) %> </li>
23
23
  <% end %>
24
24
 
metadata CHANGED
@@ -4,10 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- - 1
10
- version: 0.1.0.1
9
+ version: 0.2.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - xdite
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2012-12-09 00:00:00 +08:00
17
+ date: 2012-12-16 00:00:00 +08:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -70,9 +69,11 @@ files:
70
69
  - lib/bootstrappers/actions.rb
71
70
  - lib/bootstrappers/app_builder.rb
72
71
  - lib/bootstrappers/generators/app_generator.rb
72
+ - lib/bootstrappers/layout_actions.rb
73
73
  - lib/bootstrappers/version.rb
74
74
  - templates/Gemfile_additions
75
75
  - templates/README.md.erb
76
+ - templates/application_controller_rb
76
77
  - templates/bootstrappers_gitignore
77
78
  - templates/bootstrappers_layout.html.erb.erb
78
79
  - templates/capistrano/Capfile
@@ -83,6 +84,7 @@ files:
83
84
  - templates/common/_footer.html.erb
84
85
  - templates/common/_google_analytics.html.erb
85
86
  - templates/common/_menu.html.erb
87
+ - templates/common/_not_logined.js.erb
86
88
  - templates/common/_search_form.html.erb
87
89
  - templates/common/_user_nav.html.erb
88
90
  - templates/config_yml.erb
@@ -111,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
113
  requirements:
112
114
  - - ">="
113
115
  - !ruby/object:Gem::Version
114
- hash: 1161174567482039437
116
+ hash: 4466259845967218522
115
117
  segments:
116
118
  - 0
117
119
  version: "0"
@@ -120,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
122
  requirements:
121
123
  - - ">="
122
124
  - !ruby/object:Gem::Version
123
- hash: 1161174567482039437
125
+ hash: 4466259845967218522
124
126
  segments:
125
127
  - 0
126
128
  version: "0"