txtblx 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/txtblx/textblocks_controller.rb +13 -0
  3. data/app/helpers/txtblx/textblocks_helper.rb +1 -1
  4. data/config/routes.rb +1 -0
  5. data/lib/tasks/txtblx_tasks.rake +8 -0
  6. data/lib/txtblx/version.rb +1 -1
  7. data/spec/controllers/txtblx/textblocks_controller_spec.rb +30 -0
  8. data/spec/dummy/app/models/ability.rb +16 -0
  9. data/spec/dummy/app/models/user.rb +6 -0
  10. data/spec/dummy/app/views/layouts/application.html.erb +3 -0
  11. data/spec/dummy/config/environments/development.rb +1 -0
  12. data/spec/dummy/config/initializers/devise.rb +259 -0
  13. data/spec/dummy/config/locales/devise.en.yml +60 -0
  14. data/spec/dummy/config/routes.rb +1 -0
  15. data/spec/dummy/db/development.sqlite3 +0 -0
  16. data/spec/dummy/db/migrate/20150419175857_devise_create_users.rb +42 -0
  17. data/spec/dummy/db/migrate/20150419222125_add_role_to_user.rb +5 -0
  18. data/spec/dummy/db/schema.rb +20 -1
  19. data/spec/dummy/db/test.sqlite3 +0 -0
  20. data/spec/dummy/log/development.log +24 -14
  21. data/spec/dummy/log/test.log +2954 -77
  22. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  23. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  24. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  25. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  26. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  27. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  28. data/spec/factories/users.rb +6 -0
  29. data/spec/spec_helper.rb +3 -0
  30. metadata +90 -61
  31. data/spec/dummy/config/initializers/txtblx.rb +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 875453f25d4ee37a2e911b8645c2b01e4f217b6e
4
- data.tar.gz: 8a65c28bd93a5ec1606b2cb713273ae2b7f27c34
3
+ metadata.gz: dfa7c331db610c440ff85b697cedeb05b04a74a3
4
+ data.tar.gz: 46c1352db58924fccc5047006cdf137afc4bef54
5
5
  SHA512:
6
- metadata.gz: 0541bb623490b597e5f05d3c477dc51adfa3fea55ff0cabf0e3e3c4fe239560d66f3c68dd82fac98eb96f859129f27c34a4bb2dc9bff72e083b74bcb5e0a99a6
7
- data.tar.gz: 995403047749f836f44bd85f957ef0f1e6d5dbb4d9eb3c876d3920019b8f00a853b78551b3640a36d27e10d78294f16badffd927f2ce7fc1f5ba638089423435
6
+ metadata.gz: 4216335e0fcde868f5c0bd629ccf0b0d44f600251379a67252816b1d57411a903649373e578a22a241910b72acb56c45e27a4a33d57b6fb703d664a91014dffa
7
+ data.tar.gz: eb112ac0d3c05bd1091a9951dc5cf33b6e9aad9b2d74196e2aeb4e6e05f794044643536d84c6f0c79377499a17d000a518c8c2fc6005385fd01663590d7773c1
@@ -0,0 +1,13 @@
1
+ module Txtblx
2
+ class TextblocksController < Txtblx::ApplicationController
3
+ def update
4
+ @textblock = Textblock.drafts.where(perma_id: params[:id]).first!
5
+ authorize!(:update, @textblock)
6
+
7
+ @textblock.text = params[:textblock][:text]
8
+ @textblock.save
9
+ @textblock.publish
10
+ render json: @textblock
11
+ end
12
+ end
13
+ end
@@ -8,7 +8,7 @@ module Txtblx
8
8
  text = I18n.t('txtblx.missing_key', key: key)
9
9
  end
10
10
 
11
- content_tag(:div, text)
11
+ content_tag(:div, raw(text))
12
12
  end
13
13
  end
14
14
  end
data/config/routes.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  Txtblx::Engine.routes.draw do
2
+ resources :textblocks, only: [:update]
2
3
  end
@@ -32,4 +32,12 @@ namespace :txtblx do
32
32
  end
33
33
  end
34
34
  end
35
+
36
+ desc 'Print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.'
37
+ task routes: :environment do
38
+ all_routes = Txtblx::Engine.routes.routes
39
+ require 'action_dispatch/routing/inspector'
40
+ inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes)
41
+ puts inspector.format(ActionDispatch::Routing::ConsoleFormatter.new, ENV['CONTROLLER'])
42
+ end
35
43
  end
@@ -1,3 +1,3 @@
1
1
  module Txtblx
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ module Txtblx
4
+ RSpec.describe TextblocksController, type: :controller do
5
+ before :each do
6
+ @textblock = Textblock.create(key: 'test')
7
+ @textblock.publish
8
+ end
9
+
10
+ describe '#update' do
11
+ it 'updates text and text_html' do
12
+ sign_in(create(:user, role: 'editor'))
13
+
14
+ put(:update, id: @textblock, use_route: 'textblock', textblock: { text: 'Some Text' })
15
+
16
+ txt = Textblock.published.find_by_perma_id(@textblock.perma_id)
17
+ expect(txt.text).to eq('Some Text')
18
+ expect(txt.text_html).to include('Some Text')
19
+ end
20
+
21
+ it 'raises error if user is not authenticated' do
22
+ sign_in(create(:user))
23
+
24
+ expect {
25
+ put(:update, id: @textblock, use_route: 'textblock', textblock: { text: 'Some Text' })
26
+ }.to raise_error(CanCan::AccessDenied)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,16 @@
1
+ class Ability
2
+ include CanCan::Ability
3
+ include Txtblx::AbilityMixin
4
+
5
+ def initialize(user)
6
+ return if user.nil?
7
+
8
+ if user.role == 'editor'
9
+ txtblx_editor_abilities(user)
10
+ end
11
+
12
+ if user.role == 'admin'
13
+ txtblx_full_abilities(user)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,6 @@
1
+ class User < ActiveRecord::Base
2
+ # Include default devise modules. Others available are:
3
+ # :confirmable, :lockable, :timeoutable and :omniauthable
4
+ devise :database_authenticatable, :registerable,
5
+ :recoverable, :rememberable, :trackable, :validatable
6
+ end
@@ -8,6 +8,9 @@
8
8
  </head>
9
9
  <body>
10
10
 
11
+ <p class="notice"><%= notice %></p>
12
+ <p class="alert"><%= alert %></p>
13
+
11
14
  <%= yield %>
12
15
 
13
16
  </body>
@@ -15,6 +15,7 @@ Rails.application.configure do
15
15
 
16
16
  # Don't care if the mailer can't send.
17
17
  config.action_mailer.raise_delivery_errors = false
18
+ config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
18
19
 
19
20
  # Print deprecation notices to the Rails logger.
20
21
  config.active_support.deprecation = :log
@@ -0,0 +1,259 @@
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
+ # The secret key used by Devise. Devise uses this key to generate
5
+ # random tokens. Changing this key will render invalid all existing
6
+ # confirmation, reset password and unlock tokens in the database.
7
+ # config.secret_key = 'ceeede74ce0dc4737ac7d01fa808d757050c969a929af9b953e3301e23c1aac834b4e16f0a0cf612fca6bfc949b2f34f13d7cac8295896a31d12bd45e4ee5d8b'
8
+
9
+ # ==> Mailer Configuration
10
+ # Configure the e-mail address which will be shown in Devise::Mailer,
11
+ # note that it will be overwritten if you use your own mailer class
12
+ # with default "from" parameter.
13
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
14
+
15
+ # Configure the class responsible to send e-mails.
16
+ # config.mailer = 'Devise::Mailer'
17
+
18
+ # ==> ORM configuration
19
+ # Load and configure the ORM. Supports :active_record (default) and
20
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
21
+ # available as additional gems.
22
+ require 'devise/orm/active_record'
23
+
24
+ # ==> Configuration for any authentication mechanism
25
+ # Configure which keys are used when authenticating a user. The default is
26
+ # just :email. You can configure it to use [:username, :subdomain], so for
27
+ # authenticating a user, both parameters are required. Remember that those
28
+ # parameters are used only when authenticating and not when retrieving from
29
+ # session. If you need permissions, you should implement that in a before filter.
30
+ # You can also supply a hash where the value is a boolean determining whether
31
+ # or not authentication should be aborted when the value is not present.
32
+ # config.authentication_keys = [ :email ]
33
+
34
+ # Configure parameters from the request object used for authentication. Each entry
35
+ # given should be a request method and it will automatically be passed to the
36
+ # find_for_authentication method and considered in your model lookup. For instance,
37
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
38
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
39
+ # config.request_keys = []
40
+
41
+ # Configure which authentication keys should be case-insensitive.
42
+ # These keys will be downcased upon creating or modifying a user and when used
43
+ # to authenticate or find a user. Default is :email.
44
+ config.case_insensitive_keys = [ :email ]
45
+
46
+ # Configure which authentication keys should have whitespace stripped.
47
+ # These keys will have whitespace before and after removed upon creating or
48
+ # modifying a user and when used to authenticate or find a user. Default is :email.
49
+ config.strip_whitespace_keys = [ :email ]
50
+
51
+ # Tell if authentication through request.params is enabled. True by default.
52
+ # It can be set to an array that will enable params authentication only for the
53
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
54
+ # enable it only for database (email + password) authentication.
55
+ # config.params_authenticatable = true
56
+
57
+ # Tell if authentication through HTTP Auth is enabled. False by default.
58
+ # It can be set to an array that will enable http authentication only for the
59
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
60
+ # enable it only for database authentication. The supported strategies are:
61
+ # :database = Support basic authentication with authentication key + password
62
+ # config.http_authenticatable = false
63
+
64
+ # If 401 status code should be returned for AJAX requests. True by default.
65
+ # config.http_authenticatable_on_xhr = true
66
+
67
+ # The realm used in Http Basic Authentication. 'Application' by default.
68
+ # config.http_authentication_realm = 'Application'
69
+
70
+ # It will change confirmation, password recovery and other workflows
71
+ # to behave the same regardless if the e-mail provided was right or wrong.
72
+ # Does not affect registerable.
73
+ # config.paranoid = true
74
+
75
+ # By default Devise will store the user in session. You can skip storage for
76
+ # particular strategies by setting this option.
77
+ # Notice that if you are skipping storage for all authentication paths, you
78
+ # may want to disable generating routes to Devise's sessions controller by
79
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
80
+ config.skip_session_storage = [:http_auth]
81
+
82
+ # By default, Devise cleans up the CSRF token on authentication to
83
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
84
+ # requests for sign in and sign up, you need to get a new CSRF token
85
+ # from the server. You can disable this option at your own risk.
86
+ # config.clean_up_csrf_token_on_authentication = true
87
+
88
+ # ==> Configuration for :database_authenticatable
89
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
90
+ # using other encryptors, it sets how many times you want the password re-encrypted.
91
+ #
92
+ # Limiting the stretches to just one in testing will increase the performance of
93
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
94
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
95
+ # encryptor), the cost increases exponentially with the number of stretches (e.g.
96
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
97
+ config.stretches = Rails.env.test? ? 1 : 10
98
+
99
+ # Setup a pepper to generate the encrypted password.
100
+ # config.pepper = 'bfaf3c1eafdb08229d9e6d2a060c609a1c981cfe858e51e90f0e1a1778a4a220a759e5d163ce3898ac5fd9ec2f783f97c2b271399a3cb9ffd233b4529c10feb7'
101
+
102
+ # ==> Configuration for :confirmable
103
+ # A period that the user is allowed to access the website even without
104
+ # confirming their account. For instance, if set to 2.days, the user will be
105
+ # able to access the website for two days without confirming their account,
106
+ # access will be blocked just in the third day. Default is 0.days, meaning
107
+ # the user cannot access the website without confirming their account.
108
+ # config.allow_unconfirmed_access_for = 2.days
109
+
110
+ # A period that the user is allowed to confirm their account before their
111
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
112
+ # their account within 3 days after the mail was sent, but on the fourth day
113
+ # their account can't be confirmed with the token any more.
114
+ # Default is nil, meaning there is no restriction on how long a user can take
115
+ # before confirming their account.
116
+ # config.confirm_within = 3.days
117
+
118
+ # If true, requires any email changes to be confirmed (exactly the same way as
119
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
120
+ # db field (see migrations). Until confirmed, new email is stored in
121
+ # unconfirmed_email column, and copied to email column on successful confirmation.
122
+ config.reconfirmable = true
123
+
124
+ # Defines which key will be used when confirming an account
125
+ # config.confirmation_keys = [ :email ]
126
+
127
+ # ==> Configuration for :rememberable
128
+ # The time the user will be remembered without asking for credentials again.
129
+ # config.remember_for = 2.weeks
130
+
131
+ # Invalidates all the remember me tokens when the user signs out.
132
+ config.expire_all_remember_me_on_sign_out = true
133
+
134
+ # If true, extends the user's remember period when remembered via cookie.
135
+ # config.extend_remember_period = false
136
+
137
+ # Options to be passed to the created cookie. For instance, you can set
138
+ # secure: true in order to force SSL only cookies.
139
+ # config.rememberable_options = {}
140
+
141
+ # ==> Configuration for :validatable
142
+ # Range for password length.
143
+ config.password_length = 8..128
144
+
145
+ # Email regex used to validate email formats. It simply asserts that
146
+ # one (and only one) @ exists in the given string. This is mainly
147
+ # to give user feedback and not to assert the e-mail validity.
148
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
149
+
150
+ # ==> Configuration for :timeoutable
151
+ # The time you want to timeout the user session without activity. After this
152
+ # time the user will be asked for credentials again. Default is 30 minutes.
153
+ # config.timeout_in = 30.minutes
154
+
155
+ # If true, expires auth token on session timeout.
156
+ # config.expire_auth_token_on_timeout = false
157
+
158
+ # ==> Configuration for :lockable
159
+ # Defines which strategy will be used to lock an account.
160
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
161
+ # :none = No lock strategy. You should handle locking by yourself.
162
+ # config.lock_strategy = :failed_attempts
163
+
164
+ # Defines which key will be used when locking and unlocking an account
165
+ # config.unlock_keys = [ :email ]
166
+
167
+ # Defines which strategy will be used to unlock an account.
168
+ # :email = Sends an unlock link to the user email
169
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
170
+ # :both = Enables both strategies
171
+ # :none = No unlock strategy. You should handle unlocking by yourself.
172
+ # config.unlock_strategy = :both
173
+
174
+ # Number of authentication tries before locking an account if lock_strategy
175
+ # is failed attempts.
176
+ # config.maximum_attempts = 20
177
+
178
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
179
+ # config.unlock_in = 1.hour
180
+
181
+ # Warn on the last attempt before the account is locked.
182
+ # config.last_attempt_warning = true
183
+
184
+ # ==> Configuration for :recoverable
185
+ #
186
+ # Defines which key will be used when recovering the password for an account
187
+ # config.reset_password_keys = [ :email ]
188
+
189
+ # Time interval you can reset your password with a reset password key.
190
+ # Don't put a too small interval or your users won't have the time to
191
+ # change their passwords.
192
+ config.reset_password_within = 6.hours
193
+
194
+ # ==> Configuration for :encryptable
195
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
196
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
197
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
198
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
199
+ # REST_AUTH_SITE_KEY to pepper).
200
+ #
201
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
202
+ # config.encryptor = :sha512
203
+
204
+ # ==> Scopes configuration
205
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
206
+ # "users/sessions/new". It's turned off by default because it's slower if you
207
+ # are using only default views.
208
+ # config.scoped_views = false
209
+
210
+ # Configure the default scope given to Warden. By default it's the first
211
+ # devise role declared in your routes (usually :user).
212
+ # config.default_scope = :user
213
+
214
+ # Set this configuration to false if you want /users/sign_out to sign out
215
+ # only the current scope. By default, Devise signs out all scopes.
216
+ # config.sign_out_all_scopes = true
217
+
218
+ # ==> Navigation configuration
219
+ # Lists the formats that should be treated as navigational. Formats like
220
+ # :html, should redirect to the sign in page when the user does not have
221
+ # access, but formats like :xml or :json, should return 401.
222
+ #
223
+ # If you have any extra navigational formats, like :iphone or :mobile, you
224
+ # should add them to the navigational formats lists.
225
+ #
226
+ # The "*/*" below is required to match Internet Explorer requests.
227
+ # config.navigational_formats = ['*/*', :html]
228
+
229
+ # The default HTTP method used to sign out a resource. Default is :delete.
230
+ config.sign_out_via = :delete
231
+
232
+ # ==> OmniAuth
233
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
234
+ # up on your models and hooks.
235
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
236
+
237
+ # ==> Warden configuration
238
+ # If you want to use other strategies, that are not supported by Devise, or
239
+ # change the failure app, you can configure them inside the config.warden block.
240
+ #
241
+ # config.warden do |manager|
242
+ # manager.intercept_401 = false
243
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
244
+ # end
245
+
246
+ # ==> Mountable engine configurations
247
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
248
+ # is mountable, there are some extra configurations to be taken into account.
249
+ # The following options are available, assuming the engine is mounted as:
250
+ #
251
+ # mount MyEngine, at: '/my_engine'
252
+ #
253
+ # The router that invoked `devise_for`, in the example above, would be:
254
+ # config.router_name = :my_engine
255
+ #
256
+ # When using omniauth, Devise cannot automatically set Omniauth path,
257
+ # so you need to do it manually. For the users scope, it would be:
258
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
259
+ end
@@ -0,0 +1,60 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your email address has been successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid %{authentication_keys} or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account is locked."
15
+ not_found_in_database: "Invalid %{authentication_keys} or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your email address before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock instructions"
26
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+ updated: "Your password has been changed successfully. You are now signed in."
34
+ updated_not_active: "Your password has been changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
42
+ updated: "Your account has been updated successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ already_signed_out: "Signed out successfully."
47
+ unlocks:
48
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
49
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
50
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
51
+ errors:
52
+ messages:
53
+ already_confirmed: "was already confirmed, please try signing in"
54
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
55
+ expired: "has expired, please request a new one"
56
+ not_found: "not found"
57
+ not_locked: "was not locked"
58
+ not_saved:
59
+ one: "1 error prohibited this %{resource} from being saved:"
60
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -1,5 +1,6 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
+ devise_for :users
3
4
  mount Txtblx::Engine => "/txtblx"
4
5
 
5
6
  root to: 'dummies#index'
Binary file
@@ -0,0 +1,42 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table(:users) do |t|
4
+ ## Database authenticatable
5
+ t.string :email, null: false, default: ""
6
+ t.string :encrypted_password, null: false, default: ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, default: 0, null: false
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ # t.datetime :locked_at
32
+
33
+
34
+ t.timestamps
35
+ end
36
+
37
+ add_index :users, :email, unique: true
38
+ add_index :users, :reset_password_token, unique: true
39
+ # add_index :users, :confirmation_token, unique: true
40
+ # add_index :users, :unlock_token, unique: true
41
+ end
42
+ end
@@ -0,0 +1,5 @@
1
+ class AddRoleToUser < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :role, :string
4
+ end
5
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20150405222157) do
14
+ ActiveRecord::Schema.define(version: 20150419222125) do
15
15
 
16
16
  create_table "snaps_tags", force: :cascade do |t|
17
17
  t.integer "record_id"
@@ -33,4 +33,23 @@ ActiveRecord::Schema.define(version: 20150405222157) do
33
33
  t.datetime "updated_at", null: false
34
34
  end
35
35
 
36
+ create_table "users", force: :cascade do |t|
37
+ t.string "email", default: "", null: false
38
+ t.string "encrypted_password", default: "", null: false
39
+ t.string "reset_password_token"
40
+ t.datetime "reset_password_sent_at"
41
+ t.datetime "remember_created_at"
42
+ t.integer "sign_in_count", default: 0, null: false
43
+ t.datetime "current_sign_in_at"
44
+ t.datetime "last_sign_in_at"
45
+ t.string "current_sign_in_ip"
46
+ t.string "last_sign_in_ip"
47
+ t.datetime "created_at"
48
+ t.datetime "updated_at"
49
+ t.string "role"
50
+ end
51
+
52
+ add_index "users", ["email"], name: "index_users_on_email", unique: true
53
+ add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
54
+
36
55
  end
Binary file
@@ -1,15 +1,25 @@
1
-  (24.5ms) CREATE TABLE "snaps_tags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "record_id" integer, "record_type" varchar, "tag" varchar, "superseded_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
2
-  (25.9ms) CREATE TABLE "txtblx_textblocks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "perma_id" integer, "key" varchar, "description" varchar, "text" text, "text_html" text, "path" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
3
-  (36.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
4
-  (0.1ms) select sqlite_version(*)
5
-  (22.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
6
-  (0.1ms) SELECT version FROM "schema_migrations"
7
-  (18.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20150405222157')
8
-  (23.6ms) CREATE TABLE "snaps_tags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "record_id" integer, "record_type" varchar, "tag" varchar, "superseded_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9
-  (16.9ms) CREATE TABLE "txtblx_textblocks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "perma_id" integer, "key" varchar, "description" varchar, "text" text, "text_html" text, "path" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
10
-  (32.9ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
11
-  (0.1ms) select sqlite_version(*)
12
-  (28.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
13
-  (0.1ms) SELECT version FROM "schema_migrations"
14
-  (29.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150405222157')
1
+  (25.8ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2
+  (0.2ms) select sqlite_version(*)
3
+  (32.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
+ Migrating to CreateSnapsTags (20150321131740)
6
+  (0.1ms) begin transaction
7
+  (0.4ms) CREATE TABLE "snaps_tags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "record_id" integer, "record_type" varchar, "tag" varchar, "superseded_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
8
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150321131740"]]
9
+  (38.4ms) commit transaction
15
10
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
11
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
12
+ Migrating to CreateTxtblxTextblocks (20150405222157)
13
+  (0.1ms) begin transaction
14
+  (0.3ms) CREATE TABLE "txtblx_textblocks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "perma_id" integer, "key" varchar, "description" varchar, "text" text, "text_html" text, "path" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
15
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150405222157"]]
16
+  (31.2ms) commit transaction
17
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
18
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
19
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
20
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
21
+ Migrating to CreateSnapsTags (20150406173449)
22
+  (0.1ms) begin transaction
23
+  (0.1ms) CREATE TABLE "snaps_tags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "record_id" integer, "record_type" varchar, "tag" varchar, "superseded_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
24
+ SQLite3::SQLException: table "snaps_tags" already exists: CREATE TABLE "snaps_tags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "record_id" integer, "record_type" varchar, "tag" varchar, "superseded_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
25
+  (0.0ms) rollback transaction