cybele 0.5.0 → 0.6.0

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: 92d5ea6771cb0f8ed0c7d111e11373bd1dd10ddd
4
- data.tar.gz: 2960dc5f628e0378929078edb70fe9c22673cce3
3
+ metadata.gz: 32003045eebb360f0c90d67476343d7fc081bfec
4
+ data.tar.gz: 7d97ebb04a03d9ab9adea79f9edf3ef386653451
5
5
  SHA512:
6
- metadata.gz: 0f66b5dc25b7108472d569dcf79b6bfe42c3daf01cfa8ca5ec0a22496c06d930c4e567f97c379717f088ffed7b453033363e202e3efcc10892b88ea88f64d424
7
- data.tar.gz: 0195c08e6a681b2d2f98f4021bef4d6b7053ebaa0628ac511ddf67e5f0017f5c6064a7c28fe6fce977a6821f3bec58ddfc151cf68d2e2e170cd5349abaa6d93b
6
+ metadata.gz: 9e244a461af2bdceb6b8a5b7fab3fa92015e27f8b75bdeb7744d0338c0ab59565d81928748ca7d5eed6b107e09163db1ab2b48971d11298b3a5b241bf91213ae
7
+ data.tar.gz: 249907433a0922ad005dbc0763e583177d6601916fa1cbb7dfac02f1c0614d9f3015de31403789d96ac1d704855d548bfb81dbc53530c5f7d33a9446a3abc6dd
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cybele (0.4.1)
4
+ cybele (0.5.0)
5
5
  bundler (~> 1.3)
6
6
  rails (~> 4.0.0)
7
7
 
@@ -25,7 +25,7 @@ GEM
25
25
  activerecord-deprecated_finders (~> 1.0.2)
26
26
  activesupport (= 4.0.0)
27
27
  arel (~> 4.0.0)
28
- activerecord-deprecated_finders (1.0.3)
28
+ activerecord-deprecated_finders (1.0.2)
29
29
  activesupport (4.0.0)
30
30
  i18n (~> 0.6, >= 0.6.4)
31
31
  minitest (~> 4.2)
@@ -33,17 +33,18 @@ GEM
33
33
  thread_safe (~> 0.1)
34
34
  tzinfo (~> 0.3.37)
35
35
  arel (4.0.0)
36
- atomic (1.1.10)
36
+ atomic (1.1.9)
37
37
  builder (3.1.4)
38
38
  erubis (2.7.0)
39
- hike (1.2.3)
39
+ hike (1.2.2)
40
40
  i18n (0.6.4)
41
- mail (2.5.4)
41
+ mail (2.5.3)
42
+ i18n (>= 0.4.0)
42
43
  mime-types (~> 1.16)
43
44
  treetop (~> 1.4.8)
44
45
  mime-types (1.23)
45
- minitest (4.7.5)
46
- multi_json (1.7.7)
46
+ minitest (4.3.2)
47
+ multi_json (1.7.2)
47
48
  polyglot (0.3.3)
48
49
  rack (1.5.2)
49
50
  rack-test (0.6.2)
@@ -62,7 +63,7 @@ GEM
62
63
  rake (>= 0.8.7)
63
64
  thor (>= 0.18.1, < 2.0)
64
65
  rake (10.0.4)
65
- sprockets (2.10.0)
66
+ sprockets (2.9.3)
66
67
  hike (~> 1.2)
67
68
  multi_json (~> 1.0)
68
69
  rack (~> 1.0)
@@ -75,7 +76,7 @@ GEM
75
76
  thread_safe (0.1.0)
76
77
  atomic
77
78
  tilt (1.4.1)
78
- treetop (1.4.14)
79
+ treetop (1.4.12)
79
80
  polyglot
80
81
  polyglot (>= 0.3.1)
81
82
  tzinfo (0.3.37)
data/README.md CHANGED
@@ -28,6 +28,38 @@ cybele project_name
28
28
 
29
29
  ## What cybele do and included?
30
30
 
31
+ Let's look the Gemfile
32
+
33
+ source 'https://rubygems.org'
34
+
35
+ ```
36
+ gem 'rails', '~> 4.0.0'
37
+ gem 'pg', '~> 0.15.1'
38
+ gem 'sass-rails', '~> 4.0.0'
39
+ gem 'uglifier', '>= 1.3.0'
40
+ gem 'coffee-rails', '~> 4.0.0'
41
+ gem 'jquery-rails', '~> 3.0.4'
42
+ gem 'turbolinks', '~> 1.3.0'
43
+ gem 'haml', '~> 4.0.2'
44
+ gem 'haml-rails'
45
+ gem 'bootstrap-sass', '~> 2.3.1.0'
46
+ gem 'responders', '~> 1.0.0.rc'
47
+ gem 'exception_notification', '~> 4.0.0'
48
+ gem 'simple_form', '~> 3.0.0.rc'
49
+ gem 'rails_config', '~> 0.3.3'
50
+ gem 'compass-rails', github: 'Compass/compass-rails', branch: 'rails4-hack'
51
+ gem 'devise', '~> 3.0.0'
52
+
53
+ group :doc do
54
+ gem 'sdoc', require: false
55
+ end
56
+
57
+ group :development, :test do
58
+ gem 'better_errors'
59
+ gem 'binding_of_caller'
60
+ gem 'letter_opener'
61
+ end
62
+ ``
31
63
 
32
64
  ## Bugs and Feedback
33
65
 
@@ -145,6 +145,32 @@ config.action_mailer.delivery_method = :smtp
145
145
  def leftovers
146
146
  end
147
147
 
148
+ # Internal: Setup Rails Config
149
+ def generate_rails_config
150
+ generate 'rails_config:install'
151
+ end
152
+
153
+ # Internal: Setup devise
154
+ def generate_devise_settings
155
+ generate 'devise:install'
156
+ gsub_file 'config/initializers/filter_parameter_logging.rb', /:password/, ':password, :password_confirmation'
157
+ gsub_file 'config/initializers/devise.rb', /please-change-me-at-config-initializers-devise@example.com/, 'CHANGEME@example.com'
158
+
159
+ end
160
+
161
+ # Internal: Generate devise model
162
+ def generate_devise_model(model_name)
163
+ generate "devise #{model_name} name:string"
164
+
165
+ generate_devise_strong_parameters(model_name)
166
+ end
167
+
168
+ # Internal: Generate devise views
169
+ def generate_devise_views
170
+ # generate "devise:views"
171
+ directory 'app/views/devise', 'app/views/devise'
172
+ end
173
+
148
174
  private
149
175
 
150
176
  # Internal: Set action mailer hostname
@@ -172,5 +198,52 @@ config.action_mailer.delivery_method = :smtp
172
198
  def configure_environment(rails_env, config)
173
199
  inject_into_file("config/environments/#{rails_env}.rb", "\n\n #{config}", before: "\nend")
174
200
  end
201
+
202
+ # Setup strong params for devise
203
+ def generate_devise_strong_parameters(model_name)
204
+ create_sanitizer_lib(model_name)
205
+ create_sanitizer_initializer(model_name)
206
+ devise_parameter_sanitizer(model_name)
207
+ end
208
+
209
+
210
+ # Internal: Create devise ParameterSanitizer library
211
+ def create_sanitizer_lib(model_name)
212
+ create_file "lib/#{model_name.parameterize}_sanitizer.rb", <<-CODE
213
+ class #{model_name.classify}::ParameterSanitizer < Devise::ParameterSanitizer
214
+ private
215
+ def sign_up
216
+ default_params.permit(:name, :email, :password, :password_confirmation) # TODO add other params here
217
+ end
218
+ end
219
+ CODE
220
+ end
221
+
222
+ # Internal: Create devise ParameterSanitizer library initializer
223
+ def create_sanitizer_initializer(model_name)
224
+ path = "#"
225
+ path << "{Rails.application.root}"
226
+ path << "/lib/#{model_name.parameterize}_sanitizer.rb"
227
+ initializer 'sanitizers.rb', <<-CODE
228
+ require "#{path}"
229
+ CODE
230
+ end
231
+
232
+ # Internal: Add devise_parameter_sanitizer method to app/controller/applications_controller.rb
233
+ def devise_parameter_sanitizer(model_name)
234
+ inject_into_file 'app/controllers/application_controller.rb', :after => 'protect_from_forgery with: :exception' do <<-CODE
235
+
236
+ protected
237
+
238
+ def devise_parameter_sanitizer
239
+ if resource_class == #{model_name.classify}
240
+ #{model_name.classify}::ParameterSanitizer.new(#{model_name.classify}, :#{model_name.parameterize}, params)
241
+ else
242
+ super # Use the default one
243
+ end
244
+ end
245
+ CODE
246
+ end
247
+ end
175
248
  end
176
249
  end
@@ -93,7 +93,6 @@ module Cybele #:nodoc:#
93
93
  say 'Setup mail settings'
94
94
  build :configure_action_mailer
95
95
  build :configure_smtp
96
- #build :set_exception_notification
97
96
  build :setup_letter_opener
98
97
  end
99
98
 
@@ -110,6 +109,21 @@ module Cybele #:nodoc:#
110
109
  build :generate_exception_notification
111
110
  end
112
111
 
112
+ # Internal: Setup Rails Config
113
+ def setup_rails_config
114
+ say 'Generate rails config'
115
+ build :generate_rails_config
116
+ end
117
+
118
+ # Internal: Setup Devise
119
+ def setup_devise
120
+ say 'Generate devise'
121
+ build :generate_devise_settings
122
+ say 'Adding devise user model'
123
+ build :generate_devise_model, 'user'
124
+ build :generate_devise_views
125
+ end
126
+
113
127
 
114
128
  # Internal: Let's not: We'll bundle manually at the right spot.
115
129
  def run_bundle
@@ -1,4 +1,4 @@
1
1
  module Cybele #:nodoc:
2
2
  # Public: Cybele version
3
- VERSION = '0.5.0'
3
+ VERSION = '0.6.0'
4
4
  end
@@ -9,4 +9,8 @@
9
9
  * compiled file, but it's generally better to create a new file per style scope.
10
10
  *
11
11
  *= require_self
12
- *= require_tree .
12
+ *= require_tree .
13
+
14
+ @import "compass"
15
+ @import "bootstrap"
16
+ @import "bootstrap-responsive"
@@ -0,0 +1,9 @@
1
+ %h2 Resend confirmation instructions
2
+ = simple_form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f|
3
+ = f.error_notification
4
+ = f.full_error :confirmation_token
5
+ .form-inputs
6
+ = f.input :email, :required => true, :autofocus => true
7
+ .form-actions
8
+ = f.button :submit, "Resend confirmation instructions"
9
+ = render "devise/shared/links"
@@ -0,0 +1,4 @@
1
+ %p
2
+ Welcome #{@email}!
3
+ %p You can confirm your account email through the link below:
4
+ %p= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
@@ -0,0 +1,6 @@
1
+ %p
2
+ Hello #{@resource.email}!
3
+ %p Someone has requested a link to change your password. You can do this through the link below.
4
+ %p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)
5
+ %p If you didn't request this, please ignore this email.
6
+ %p Your password won't change until you access the link above and create a new one.
@@ -0,0 +1,5 @@
1
+ %p
2
+ Hello #{@resource.email}!
3
+ %p Your account has been locked due to an excessive number of unsuccessful sign in attempts.
4
+ %p Click the link below to unlock your account:
5
+ %p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token)
@@ -0,0 +1,11 @@
1
+ %h2 Change your password
2
+ = simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f|
3
+ = f.error_notification
4
+ = f.input :reset_password_token, :as => :hidden
5
+ = f.full_error :reset_password_token
6
+ .form-inputs
7
+ = f.input :password, :label => "New password", :required => true, :autofocus => true
8
+ = f.input :password_confirmation, :label => "Confirm your new password", :required => true
9
+ .form-actions
10
+ = f.button :submit, "Change my password"
11
+ = render "devise/shared/links"
@@ -0,0 +1,8 @@
1
+ %h2 Forgot your password?
2
+ = simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f|
3
+ = f.error_notification
4
+ .form-inputs
5
+ = f.input :email, :required => true, :autofocus => true
6
+ .form-actions
7
+ = f.button :submit, "Send me reset password instructions"
8
+ = render "devise/shared/links"
@@ -0,0 +1,18 @@
1
+ %h2
2
+ Edit #{resource_name.to_s.humanize}
3
+ = simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f|
4
+ = f.error_notification
5
+ .form-inputs
6
+ = f.input :email, :required => true, :autofocus => true
7
+ - if devise_mapping.confirmable? && resource.pending_reconfirmation?
8
+ %p
9
+ Currently waiting confirmation for: #{resource.unconfirmed_email}
10
+ = f.input :password, :autocomplete => "off", :hint => "leave it blank if you don't want to change it", :required => false
11
+ = f.input :password_confirmation, :required => false
12
+ = f.input :current_password, :hint => "we need your current password to confirm your changes", :required => true
13
+ .form-actions
14
+ = f.button :submit, "Update"
15
+ %h3 Cancel my account
16
+ %p
17
+ Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete}
18
+ = link_to "Back", :back
@@ -0,0 +1,11 @@
1
+ %h2 Sign up
2
+ = simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
3
+ = f.error_notification
4
+ .form-inputs
5
+ = f.input :name, :autofocus => true
6
+ = f.input :email, :required => true
7
+ = f.input :password, :required => true
8
+ = f.input :password_confirmation, :required => true
9
+ .form-actions
10
+ = f.button :submit, "Sign up"
11
+ = render "devise/shared/links"
@@ -0,0 +1,9 @@
1
+ %h2 Sign in
2
+ = simple_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
3
+ .form-inputs
4
+ = f.input :email, :required => false, :autofocus => true
5
+ = f.input :password, :required => false
6
+ = f.input :remember_me, :as => :boolean if devise_mapping.rememberable?
7
+ .form-actions
8
+ = f.button :submit, "Sign in"
9
+ = render "devise/shared/links"
@@ -0,0 +1,19 @@
1
+ - if controller_name != 'sessions'
2
+ = link_to "Sign in", new_session_path(resource_name)
3
+ %br/
4
+ - if devise_mapping.registerable? && controller_name != 'registrations'
5
+ = link_to "Sign up", new_registration_path(resource_name)
6
+ %br/
7
+ - if devise_mapping.recoverable? && controller_name != 'passwords'
8
+ = link_to "Forgot your password?", new_password_path(resource_name)
9
+ %br/
10
+ - if devise_mapping.confirmable? && controller_name != 'confirmations'
11
+ = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
12
+ %br/
13
+ - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
14
+ = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)
15
+ %br/
16
+ - if devise_mapping.omniauthable?
17
+ - resource_class.omniauth_providers.each do |provider|
18
+ = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider)
19
+ %br/
@@ -0,0 +1,9 @@
1
+ %h2 Resend unlock instructions
2
+ = simple_form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f|
3
+ = f.error_notification
4
+ = f.full_error :unlock_token
5
+ .form-inputs
6
+ = f.input :email, :required => true, :autofocus => true
7
+ .form-actions
8
+ = f.button :submit, "Resend unlock instructions"
9
+ = render "devise/shared/links"
@@ -1,18 +1,21 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 4.0.0'
4
- gem 'pg'
4
+ gem 'pg', '~> 0.15.1'
5
5
  gem 'sass-rails', '~> 4.0.0'
6
6
  gem 'uglifier', '>= 1.3.0'
7
7
  gem 'coffee-rails', '~> 4.0.0'
8
- gem 'jquery-rails'
9
- gem 'turbolinks'
8
+ gem 'jquery-rails', '~> 3.0.4'
9
+ gem 'turbolinks', '~> 1.3.0'
10
10
  gem 'haml', '~> 4.0.2'
11
- gem 'haml-rails', '~> 0.4'
11
+ gem 'haml-rails'
12
12
  gem 'bootstrap-sass', '~> 2.3.1.0'
13
- gem 'responders'
14
- gem 'exception_notification', github: 'smartinez87/exception_notification'
13
+ gem 'responders', '~> 1.0.0.rc'
14
+ gem 'exception_notification', '~> 4.0.0'
15
15
  gem 'simple_form', '~> 3.0.0.rc'
16
+ gem 'rails_config', '~> 0.3.3'
17
+ gem 'compass-rails', github: 'Compass/compass-rails', branch: 'rails4-hack'
18
+ gem 'devise', '~> 3.0.0'
16
19
 
17
20
  group :doc do
18
21
  gem 'sdoc', require: false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cybele
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lab2023
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-07 00:00:00.000000000 Z
11
+ date: 2013-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,6 +91,17 @@ files:
91
91
  - templates/app/assets/javascripts/application.js.coffee
92
92
  - templates/app/assets/stylesheets/application.css.sass
93
93
  - templates/app/controllers/application_controller.rb
94
+ - templates/app/views/devise/confirmations/new.html.haml
95
+ - templates/app/views/devise/mailer/confirmation_instructions.html.haml
96
+ - templates/app/views/devise/mailer/reset_password_instructions.html.haml
97
+ - templates/app/views/devise/mailer/unlock_instructions.html.haml
98
+ - templates/app/views/devise/passwords/edit.html.haml
99
+ - templates/app/views/devise/passwords/new.html.haml
100
+ - templates/app/views/devise/registrations/edit.html.haml
101
+ - templates/app/views/devise/registrations/new.html.haml
102
+ - templates/app/views/devise/sessions/new.html.haml
103
+ - templates/app/views/devise/shared/_links.haml
104
+ - templates/app/views/devise/unlocks/new.html.haml
94
105
  - templates/app/views/layouts/application.html.haml.erb
95
106
  - templates/config/database.yml.erb
96
107
  - templates/config/initializers/mail.rb
@@ -120,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
131
  version: '0'
121
132
  requirements: []
122
133
  rubyforge_project:
123
- rubygems_version: 2.0.3
134
+ rubygems_version: 2.0.5
124
135
  signing_key:
125
136
  specification_version: 4
126
137
  summary: Rails 4.x template with responder, simple form, haml, exception notification,