automigration 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## Automigration 1.0.1 (March 30, 2012)
4
+
5
+ * Devise fields works well
6
+
3
7
  ## Automigration 1.0.0 (March 23, 2012)
4
8
 
5
9
  * Clean API
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in automigration.gemspec
4
4
  gemspec
5
+
6
+ gem 'devise'
data/README.md CHANGED
@@ -23,14 +23,14 @@ end
23
23
 
24
24
  Fire in console:
25
25
 
26
- ``
26
+ ```
27
27
  rake db:migrate
28
28
  ```
29
29
 
30
30
  To keep some system tables add to <tt>config/application.rb</tt>
31
31
 
32
32
  ```
33
- config.automigration.system_tables << %w[hits very_system_table]
33
+ config.automigration.system_tables += %w[hits very_system_table]
34
34
  ```
35
35
 
36
36
  Supported fields:
@@ -64,8 +64,8 @@ end
64
64
 
65
65
  ## Timestamps
66
66
 
67
- By default in models with has_fields always columns updated_at and created_at created. To ignore
68
- use has_fields(:timestamps => false)
67
+ By default in models with <tt>has_fields</tt> always columns updated_at and created_at created. To ignore
68
+ use <tt>has_fields(:timestamps => false)</tt>
69
69
 
70
70
  ## Status
71
71
 
@@ -25,4 +25,5 @@ Gem::Specification.new do |s|
25
25
  s.add_development_dependency 'rspec-rails'
26
26
  s.add_development_dependency 'database_cleaner'
27
27
  s.add_development_dependency 'factory_girl_rails'
28
+ s.add_development_dependency 'devise'
28
29
  end
@@ -24,7 +24,8 @@ module Automigration
24
24
 
25
25
  @@model_paths.each do |path|
26
26
  Dir[File.expand_path("**/*.rb", path)].each do |file|
27
- require file
27
+ name = file.sub(path.to_s + '/', '').sub(Regexp.new(File.extname(file) + '$'), '')
28
+ ActiveSupport::Dependencies.constantize(name.classify)
28
29
  end
29
30
  end
30
31
 
@@ -1,3 +1,3 @@
1
1
  module Automigration
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -0,0 +1,10 @@
1
+ class User < ActiveRecord::Base
2
+ devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
3
+
4
+ has_fields do |t|
5
+ t.devise_database_authenticatable :null => false
6
+ t.devise_recoverable
7
+ t.devise_rememberable
8
+ t.devise_trackable
9
+ end
10
+ end
@@ -0,0 +1,223 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # ==> Mailer Configuration
5
+ # Configure the e-mail address which will be shown in Devise::Mailer,
6
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7
+ config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
8
+
9
+ # Configure the class responsible to send e-mails.
10
+ # config.mailer = "Devise::Mailer"
11
+
12
+ # Automatically apply schema changes in tableless databases
13
+ config.apply_schema = false
14
+
15
+ # ==> ORM configuration
16
+ # Load and configure the ORM. Supports :active_record (default) and
17
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
18
+ # available as additional gems.
19
+ require 'devise/orm/active_record'
20
+
21
+ # ==> Configuration for any authentication mechanism
22
+ # Configure which keys are used when authenticating a user. The default is
23
+ # just :email. You can configure it to use [:username, :subdomain], so for
24
+ # authenticating a user, both parameters are required. Remember that those
25
+ # parameters are used only when authenticating and not when retrieving from
26
+ # session. If you need permissions, you should implement that in a before filter.
27
+ # You can also supply a hash where the value is a boolean determining whether
28
+ # or not authentication should be aborted when the value is not present.
29
+ # config.authentication_keys = [ :email ]
30
+
31
+ # Configure parameters from the request object used for authentication. Each entry
32
+ # given should be a request method and it will automatically be passed to the
33
+ # find_for_authentication method and considered in your model lookup. For instance,
34
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
35
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
36
+ # config.request_keys = []
37
+
38
+ # Configure which authentication keys should be case-insensitive.
39
+ # These keys will be downcased upon creating or modifying a user and when used
40
+ # to authenticate or find a user. Default is :email.
41
+ config.case_insensitive_keys = [ :email ]
42
+
43
+ # Configure which authentication keys should have whitespace stripped.
44
+ # These keys will have whitespace before and after removed upon creating or
45
+ # modifying a user and when used to authenticate or find a user. Default is :email.
46
+ config.strip_whitespace_keys = [ :email ]
47
+
48
+ # Tell if authentication through request.params is enabled. True by default.
49
+ # It can be set to an array that will enable params authentication only for the
50
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
51
+ # enable it only for database (email + password) authentication.
52
+ # config.params_authenticatable = true
53
+
54
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
55
+ # It can be set to an array that will enable http authentication only for the
56
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
57
+ # enable it only for token authentication.
58
+ # config.http_authenticatable = false
59
+
60
+ # If http headers should be returned for AJAX requests. True by default.
61
+ # config.http_authenticatable_on_xhr = true
62
+
63
+ # The realm used in Http Basic Authentication. "Application" by default.
64
+ # config.http_authentication_realm = "Application"
65
+
66
+ # It will change confirmation, password recovery and other workflows
67
+ # to behave the same regardless if the e-mail provided was right or wrong.
68
+ # Does not affect registerable.
69
+ # config.paranoid = true
70
+
71
+ # By default Devise will store the user in session. You can skip storage for
72
+ # :http_auth and :token_auth by adding those symbols to the array below.
73
+ # Notice that if you are skipping storage for all authentication paths, you
74
+ # may want to disable generating routes to Devise's sessions controller by
75
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
76
+ config.skip_session_storage = [:http_auth]
77
+
78
+ # ==> Configuration for :database_authenticatable
79
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
80
+ # using other encryptors, it sets how many times you want the password re-encrypted.
81
+ #
82
+ # Limiting the stretches to just one in testing will increase the performance of
83
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
84
+ # a value less than 10 in other environments.
85
+ config.stretches = Rails.env.test? ? 1 : 10
86
+
87
+ # Setup a pepper to generate the encrypted password.
88
+ # config.pepper = "0f9c6bf0ac9d3d5a8cca8c75c5966d3215e40039fdcbdad193a7a3efa0a74f12480cd473dd19a280386d497c23a04e225ecc7e554917259beec1a5e9bd4c32f6"
89
+
90
+ # ==> Configuration for :confirmable
91
+ # A period that the user is allowed to access the website even without
92
+ # confirming his account. For instance, if set to 2.days, the user will be
93
+ # able to access the website for two days without confirming his account,
94
+ # access will be blocked just in the third day. Default is 0.days, meaning
95
+ # the user cannot access the website without confirming his account.
96
+ # config.allow_unconfirmed_access_for = 2.days
97
+
98
+ # If true, requires any email changes to be confirmed (exctly the same way as
99
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
100
+ # db field (see migrations). Until confirmed new email is stored in
101
+ # unconfirmed email column, and copied to email column on successful confirmation.
102
+ config.reconfirmable = true
103
+
104
+ # Defines which key will be used when confirming an account
105
+ # config.confirmation_keys = [ :email ]
106
+
107
+ # ==> Configuration for :rememberable
108
+ # The time the user will be remembered without asking for credentials again.
109
+ # config.remember_for = 2.weeks
110
+
111
+ # If true, extends the user's remember period when remembered via cookie.
112
+ # config.extend_remember_period = false
113
+
114
+ # If true, uses the password salt as remember token. This should be turned
115
+ # to false if you are not using database authenticatable.
116
+ config.use_salt_as_remember_token = true
117
+
118
+ # Options to be passed to the created cookie. For instance, you can set
119
+ # :secure => true in order to force SSL only cookies.
120
+ # config.cookie_options = {}
121
+
122
+ # ==> Configuration for :validatable
123
+ # Range for password length. Default is 6..128.
124
+ # config.password_length = 6..128
125
+
126
+ # Email regex used to validate email formats. It simply asserts that
127
+ # an one (and only one) @ exists in the given string. This is mainly
128
+ # to give user feedback and not to assert the e-mail validity.
129
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
130
+
131
+ # ==> Configuration for :timeoutable
132
+ # The time you want to timeout the user session without activity. After this
133
+ # time the user will be asked for credentials again. Default is 30 minutes.
134
+ # config.timeout_in = 30.minutes
135
+
136
+ # ==> Configuration for :lockable
137
+ # Defines which strategy will be used to lock an account.
138
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
139
+ # :none = No lock strategy. You should handle locking by yourself.
140
+ # config.lock_strategy = :failed_attempts
141
+
142
+ # Defines which key will be used when locking and unlocking an account
143
+ # config.unlock_keys = [ :email ]
144
+
145
+ # Defines which strategy will be used to unlock an account.
146
+ # :email = Sends an unlock link to the user email
147
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
148
+ # :both = Enables both strategies
149
+ # :none = No unlock strategy. You should handle unlocking by yourself.
150
+ # config.unlock_strategy = :both
151
+
152
+ # Number of authentication tries before locking an account if lock_strategy
153
+ # is failed attempts.
154
+ # config.maximum_attempts = 20
155
+
156
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
157
+ # config.unlock_in = 1.hour
158
+
159
+ # ==> Configuration for :recoverable
160
+ #
161
+ # Defines which key will be used when recovering the password for an account
162
+ # config.reset_password_keys = [ :email ]
163
+
164
+ # Time interval you can reset your password with a reset password key.
165
+ # Don't put a too small interval or your users won't have the time to
166
+ # change their passwords.
167
+ config.reset_password_within = 6.hours
168
+
169
+ # ==> Configuration for :encryptable
170
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
171
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
172
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
173
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
174
+ # REST_AUTH_SITE_KEY to pepper)
175
+ # config.encryptor = :sha512
176
+
177
+ # ==> Configuration for :token_authenticatable
178
+ # Defines name of the authentication token params key
179
+ # config.token_authentication_key = :auth_token
180
+
181
+ # ==> Scopes configuration
182
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
183
+ # "users/sessions/new". It's turned off by default because it's slower if you
184
+ # are using only default views.
185
+ # config.scoped_views = false
186
+
187
+ # Configure the default scope given to Warden. By default it's the first
188
+ # devise role declared in your routes (usually :user).
189
+ # config.default_scope = :user
190
+
191
+ # Configure sign_out behavior.
192
+ # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
193
+ # The default is true, which means any logout action will sign out all active scopes.
194
+ # config.sign_out_all_scopes = true
195
+
196
+ # ==> Navigation configuration
197
+ # Lists the formats that should be treated as navigational. Formats like
198
+ # :html, should redirect to the sign in page when the user does not have
199
+ # access, but formats like :xml or :json, should return 401.
200
+ #
201
+ # If you have any extra navigational formats, like :iphone or :mobile, you
202
+ # should add them to the navigational formats lists.
203
+ #
204
+ # The "*/*" below is required to match Internet Explorer requests.
205
+ # config.navigational_formats = ["*/*", :html]
206
+
207
+ # The default HTTP method used to sign out a resource. Default is :delete.
208
+ config.sign_out_via = :delete
209
+
210
+ # ==> OmniAuth
211
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
212
+ # up on your models and hooks.
213
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
214
+
215
+ # ==> Warden configuration
216
+ # If you want to use other strategies, that are not supported by Devise, or
217
+ # change the failure app, you can configure them inside the config.warden block.
218
+ #
219
+ # config.warden do |manager|
220
+ # manager.intercept_401 = false
221
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
222
+ # end
223
+ end
@@ -0,0 +1,57 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ errors:
5
+ messages:
6
+ expired: "has expired, please request a new one"
7
+ not_found: "not found"
8
+ already_confirmed: "was already confirmed, please try signing in"
9
+ not_locked: "was not locked"
10
+ not_saved:
11
+ one: "1 error prohibited this %{resource} from being saved:"
12
+ other: "%{count} errors prohibited this %{resource} from being saved:"
13
+
14
+ devise:
15
+ failure:
16
+ already_authenticated: 'You are already signed in.'
17
+ unauthenticated: 'You need to sign in or sign up before continuing.'
18
+ unconfirmed: 'You have to confirm your account before continuing.'
19
+ locked: 'Your account is locked.'
20
+ invalid: 'Invalid email or password.'
21
+ invalid_token: 'Invalid authentication token.'
22
+ timeout: 'Your session expired, please sign in again to continue.'
23
+ inactive: 'Your account was not activated yet.'
24
+ sessions:
25
+ signed_in: 'Signed in successfully.'
26
+ signed_out: 'Signed out successfully.'
27
+ passwords:
28
+ send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29
+ updated: 'Your password was changed successfully. You are now signed in.'
30
+ updated_not_active: 'Your password was changed successfully.'
31
+ send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
32
+ confirmations:
33
+ send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
34
+ send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
35
+ confirmed: 'Your account was successfully confirmed. You are now signed in.'
36
+ registrations:
37
+ signed_up: 'Welcome! You have signed up successfully.'
38
+ signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
39
+ signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
40
+ signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
41
+ updated: 'You updated your account successfully.'
42
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
43
+ destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
44
+ unlocks:
45
+ send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
46
+ unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
47
+ send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
48
+ omniauth_callbacks:
49
+ success: 'Successfully authorized from %{kind} account.'
50
+ failure: 'Could not authorize you from %{kind} because "%{reason}".'
51
+ mailer:
52
+ confirmation_instructions:
53
+ subject: 'Confirmation instructions'
54
+ reset_password_instructions:
55
+ subject: 'Reset password instructions'
56
+ unlock_instructions:
57
+ subject: 'Unlock Instructions'
@@ -1,4 +1,6 @@
1
1
  Dummy::Application.routes.draw do
2
+ devise_for :users
3
+
2
4
  # The priority is based upon order of creation:
3
5
  # first created -> highest priority.
4
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: automigration
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-23 00:00:00.000000000 Z
12
+ date: 2012-03-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &83783970 !ruby/object:Gem::Requirement
16
+ requirement: &80967970 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *83783970
24
+ version_requirements: *80967970
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ansi
27
- requirement: &83783610 !ruby/object:Gem::Requirement
27
+ requirement: &80985520 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *83783610
35
+ version_requirements: *80985520
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: pg
38
- requirement: &83782900 !ruby/object:Gem::Requirement
38
+ requirement: &80984530 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *83782900
46
+ version_requirements: *80984530
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec-rails
49
- requirement: &83782070 !ruby/object:Gem::Requirement
49
+ requirement: &80983460 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *83782070
57
+ version_requirements: *80983460
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: database_cleaner
60
- requirement: &83780030 !ruby/object:Gem::Requirement
60
+ requirement: &80982720 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *83780030
68
+ version_requirements: *80982720
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: factory_girl_rails
71
- requirement: &83903880 !ruby/object:Gem::Requirement
71
+ requirement: &80982250 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,18 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *83903880
79
+ version_requirements: *80982250
80
+ - !ruby/object:Gem::Dependency
81
+ name: devise
82
+ requirement: &80981730 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *80981730
80
91
  description: Store your migrations direct in models
81
92
  email:
82
93
  - vakhov@gmail.com
@@ -126,6 +137,7 @@ files:
126
137
  - spec/dummy/app/models/not_automigrable.rb
127
138
  - spec/dummy/app/models/searchable.rb
128
139
  - spec/dummy/app/models/simple.rb
140
+ - spec/dummy/app/models/user.rb
129
141
  - spec/dummy/app/models/user1.rb
130
142
  - spec/dummy/app/views/layouts/application.html.erb
131
143
  - spec/dummy/config.ru
@@ -137,11 +149,13 @@ files:
137
149
  - spec/dummy/config/environments/production.rb
138
150
  - spec/dummy/config/environments/test.rb
139
151
  - spec/dummy/config/initializers/backtrace_silencers.rb
152
+ - spec/dummy/config/initializers/devise.rb
140
153
  - spec/dummy/config/initializers/inflections.rb
141
154
  - spec/dummy/config/initializers/mime_types.rb
142
155
  - spec/dummy/config/initializers/secret_token.rb
143
156
  - spec/dummy/config/initializers/session_store.rb
144
157
  - spec/dummy/config/initializers/wrap_parameters.rb
158
+ - spec/dummy/config/locales/devise.en.yml
145
159
  - spec/dummy/config/locales/en.yml
146
160
  - spec/dummy/config/routes.rb
147
161
  - spec/dummy/db/.gitkeep
@@ -172,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
186
  version: '0'
173
187
  segments:
174
188
  - 0
175
- hash: 690410381
189
+ hash: -575979185
176
190
  required_rubygems_version: !ruby/object:Gem::Requirement
177
191
  none: false
178
192
  requirements:
@@ -181,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
195
  version: '0'
182
196
  segments:
183
197
  - 0
184
- hash: 690410381
198
+ hash: -575979185
185
199
  requirements: []
186
200
  rubyforge_project: automigration
187
201
  rubygems_version: 1.8.17