date_book 0.0.6 → 0.1.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.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -1
  3. data/.rubocop_todo.yml +2 -1
  4. data/.travis.yml +3 -0
  5. data/Gemfile +16 -4
  6. data/Gemfile.lock +14 -2
  7. data/VERSION +1 -1
  8. data/app/assets/javascripts/date_book/calendar_events.js +3 -3
  9. data/app/assets/stylesheets/date_book.css.scss +31 -2
  10. data/app/controllers/date_book/calendars_controller.rb +30 -19
  11. data/app/controllers/date_book/date_book_controller.rb +1 -1
  12. data/app/controllers/date_book/events_controller.rb +60 -62
  13. data/app/controllers/date_book/graphql_controller.rb +10 -11
  14. data/app/graphql/date_book_schema.rb +4 -4
  15. data/app/graphql/types/calendar_type.rb +4 -2
  16. data/app/graphql/types/date_time_type.rb +9 -5
  17. data/app/graphql/types/event_occurrence_type.rb +4 -2
  18. data/app/graphql/types/event_type.rb +4 -2
  19. data/app/graphql/types/mutation_type.rb +3 -1
  20. data/app/graphql/types/query_type.rb +12 -26
  21. data/app/helpers/date_book/application_helper.rb +4 -7
  22. data/app/helpers/date_book/events_helper.rb +43 -23
  23. data/app/views/date_book/application/_date_range.html.haml +3 -3
  24. data/app/views/date_book/calendars/index.html.haml +19 -3
  25. data/app/views/date_book/calendars/show.html.haml +29 -4
  26. data/app/views/date_book/events/_event.json.jbuilder +3 -1
  27. data/app/views/date_book/events/_form.html.haml +4 -4
  28. data/app/views/date_book/events/_occurrence_dates.html.haml +3 -3
  29. data/app/views/date_book/events/fields/_date.html.haml +1 -1
  30. data/app/views/date_book/events/fields/_day.html.haml +1 -1
  31. data/app/views/date_book/events/fields/_day_of_week.html.haml +3 -3
  32. data/app/views/date_book/events/fields/_duration.html.haml +3 -3
  33. data/app/views/date_book/events/fields/_interval.html.haml +1 -1
  34. data/app/views/date_book/events/fields/_time.html.haml +1 -1
  35. data/app/views/date_book/events/index.html.haml +1 -1
  36. data/app/views/date_book/events/rules/_daily.html.haml +3 -3
  37. data/app/views/date_book/events/rules/_monthly.html.haml +4 -4
  38. data/app/views/date_book/events/rules/_singular.html.haml +3 -3
  39. data/app/views/date_book/events/rules/_weekly.html.haml +4 -4
  40. data/app/views/date_book/events/show.html.haml +1 -1
  41. data/app/views/layouts/_date_book_scripts.html.haml +2 -4
  42. data/config/locales/en.yml +2 -0
  43. data/config/routes.rb +1 -1
  44. data/date_book.gemspec +25 -22
  45. data/db/migrate/20170807133845_create_calendars.rb +3 -0
  46. data/db/migrate/20170807133846_create_events.rb +3 -0
  47. data/db/migrate/20170807133847_create_schedules.rb +9 -6
  48. data/db/migrate/20170807133848_add_fields_to_schedule.rb +3 -0
  49. data/db/migrate/20170807133849_create_event_occurrences.rb +4 -3
  50. data/db/migrate/20170807133850_add_fields_to_event_occurrences.rb +3 -0
  51. data/lib/date_book.rb +11 -2
  52. data/lib/date_book/concerns/ability.rb +9 -12
  53. data/lib/date_book/concerns/acts_as_calendar.rb +5 -6
  54. data/lib/date_book/concerns/acts_as_event.rb +30 -9
  55. data/lib/date_book/concerns/acts_as_event_occurrence.rb +21 -9
  56. data/lib/date_book/concerns/acts_as_ownable.rb +9 -3
  57. data/lib/date_book/concerns/acts_as_owner.rb +5 -6
  58. data/lib/date_book/concerns/acts_as_schedule.rb +14 -7
  59. data/lib/date_book/configuration.rb +14 -11
  60. data/lib/date_book/engine.rb +7 -5
  61. data/lib/date_book/version.rb +2 -0
  62. data/lib/generators/date_book/install/install_generator.rb +27 -29
  63. data/lib/generators/date_book/install/templates/app/models/calendar.rb +4 -1
  64. data/lib/generators/date_book/install/templates/app/models/event.rb +4 -1
  65. data/lib/generators/date_book/install/templates/app/models/event_occurrence.rb +4 -1
  66. data/lib/generators/date_book/install/templates/app/models/schedule.rb +4 -1
  67. data/spec/abilities/event_spec.rb +1 -1
  68. data/spec/controllers/date_book/calendars_controller_spec.rb +48 -20
  69. data/spec/controllers/date_book/events_controller_spec.rb +145 -39
  70. data/spec/dummy/app/models/calendar.rb +3 -1
  71. data/spec/dummy/app/models/event.rb +3 -1
  72. data/spec/dummy/app/models/event_occurrence.rb +3 -1
  73. data/spec/dummy/app/models/role.rb +7 -5
  74. data/spec/dummy/app/models/schedule.rb +3 -1
  75. data/spec/dummy/app/models/user.rb +3 -3
  76. data/spec/dummy/config/initializers/devise.rb +61 -40
  77. data/spec/dummy/config/initializers/high_voltage.rb +2 -0
  78. data/spec/dummy/config/initializers/rolify.rb +5 -2
  79. data/spec/dummy/config/routes.rb +6 -9
  80. data/spec/dummy/db/development.sqlite3 +0 -0
  81. data/spec/dummy/db/migrate/20170728171103_create_users_table.rb +2 -0
  82. data/spec/dummy/db/migrate/20170807134122_add_devise_to_users.rb +4 -3
  83. data/spec/dummy/db/migrate/20170807134128_rolify_create_roles.rb +6 -4
  84. data/spec/dummy/db/migrate/{20170808150915_create_calendars.date_book.rb → 20170808200808_create_calendars.date_book.rb} +3 -0
  85. data/spec/dummy/db/migrate/{20170808150916_create_events.date_book.rb → 20170808200809_create_events.date_book.rb} +3 -0
  86. data/spec/dummy/db/migrate/{20170808150917_create_schedules.date_book.rb → 20170808200810_create_schedules.date_book.rb} +9 -6
  87. data/spec/dummy/db/migrate/{20170808150918_add_fields_to_schedule.date_book.rb → 20170808200811_add_fields_to_schedule.date_book.rb} +3 -0
  88. data/spec/dummy/db/migrate/{20170808150919_create_event_occurrences.date_book.rb → 20170808200812_create_event_occurrences.date_book.rb} +4 -3
  89. data/spec/dummy/db/migrate/{20170808150920_add_fields_to_event_occurrences.date_book.rb → 20170808200813_add_fields_to_event_occurrences.date_book.rb} +3 -0
  90. data/spec/dummy/db/schema.rb +1 -1
  91. data/spec/dummy/db/seeds/calendars.seeds.rb +2 -1
  92. data/spec/dummy/db/seeds/events.seeds.rb +5 -5
  93. data/spec/dummy/db/seeds/users.seeds.rb +3 -1
  94. data/spec/dummy/db/test.sqlite3 +0 -0
  95. data/spec/dummy/lib/basic_benchmark.rb +2 -0
  96. data/spec/factories/calendars.rb +2 -0
  97. data/spec/factories/events.rb +2 -0
  98. data/spec/factories/roles.rb +2 -1
  99. data/spec/factories/users.rb +2 -0
  100. data/spec/features/calendars_spec.rb +47 -5
  101. data/spec/features/events_spec.rb +35 -9
  102. data/spec/helpers/date_book/application_helper_spec.rb +32 -0
  103. data/spec/helpers/date_book/events_helper_spec.rb +181 -13
  104. data/spec/models/calendar_spec.rb +3 -1
  105. data/spec/models/event_spec.rb +3 -1
  106. data/spec/models/role_spec.rb +1 -0
  107. data/spec/rails_helper.rb +6 -1
  108. data/spec/requests/date_book/api_spec.rb +76 -0
  109. data/spec/routing/date_book/calendars_routing_spec.rb +4 -2
  110. data/spec/routing/date_book/events_routing_spec.rb +48 -11
  111. data/spec/support/controller_behaviors.rb +2 -0
  112. data/spec/support/controller_macros.rb +3 -1
  113. data/spec/support/factory_girl.rb +2 -0
  114. data/spec/support/feature_behaviors.rb +9 -9
  115. data/spec/support/loaded_site.rb +2 -0
  116. data/spec/support/loaded_site/calendars.rb +2 -0
  117. data/spec/support/loaded_site/events.rb +3 -1
  118. data/spec/support/loaded_site/users.rb +2 -0
  119. data/spec/support/request_behaviors.rb +12 -63
  120. data/spec/support/shared_connection.rb +2 -0
  121. data/spec/support/utilities.rb +6 -5
  122. metadata +79 -42
  123. data/app/graphql/types/profile_type.rb +0 -7
  124. data/app/helpers/date_book/calendar_helper.rb +0 -4
  125. data/app/views/date_book/application/_all_day_checkbox.html.haml +0 -1
  126. data/bin/rails +0 -15
  127. data/spec/helpers/date_book/calendar_helper_spec.rb +0 -17
  128. data/spec/requests/date_book/events_spec.rb +0 -56
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Calendar < ApplicationRecord
2
4
  acts_as_calendar
3
- end
5
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Event < ApplicationRecord
2
4
  acts_as_event
3
- end
5
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class EventOccurrence < ApplicationRecord
2
4
  acts_as_event_occurrence
3
- end
5
+ end
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Role < ApplicationRecord
2
- has_and_belongs_to_many :users, :join_table => :users_roles
4
+ has_and_belongs_to_many :users, join_table: :users_roles
3
5
 
4
6
  belongs_to :resource,
5
- :polymorphic => true,
6
- :optional => true
7
+ polymorphic: true,
8
+ optional: true
7
9
 
8
10
  validates :resource_type,
9
- :inclusion => { :in => Rolify.resource_types },
10
- :allow_nil => true
11
+ inclusion: { in: Rolify.resource_types },
12
+ allow_nil: true
11
13
 
12
14
  scopify
13
15
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Schedule < Schedulable::Model::Schedule
2
4
  acts_as_schedule
3
- end
5
+ end
@@ -1,9 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class User < ApplicationRecord
2
4
  rolify
3
5
  acts_as_owner
4
-
5
-
6
-
6
+
7
7
  # Include default devise modules. Others available are:
8
8
  # :confirmable, :lockable, :timeoutable and :omniauthable
9
9
  devise :database_authenticatable, :registerable,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Use this hook to configure devise mailer, warden hooks and so forth.
2
4
  # Many of these configuration options can be set straight in your model.
3
5
  Devise.setup do |config|
@@ -6,13 +8,15 @@ Devise.setup do |config|
6
8
  # confirmation, reset password and unlock tokens in the database.
7
9
  # Devise will use the `secret_key_base` as its `secret_key`
8
10
  # by default. You can change it below and use your own secret key.
9
- # config.secret_key = '608d36971dd95efcf4efd1431d143d3f54882227287e1378e75d4c08691e8e1cccdc483cb189782eddabb548d3c1accf1d0a5444b59ab5a7be91c18026c14ae3'
11
+ # config.secret_key = '73c6ea90df6ed7a951ee087c5ba6a194eb9fb783bc54b40f2700b'\
12
+ # 'bc94b489dbcb3e47a92de64e192ab166c81bc5e31f754049f99d0'\
13
+ # 'd592c7b1f103ca4b213866'
10
14
 
11
15
  # ==> Mailer Configuration
12
16
  # Configure the e-mail address which will be shown in Devise::Mailer,
13
17
  # note that it will be overwritten if you use your own mailer class
14
18
  # with default "from" parameter.
15
- config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
19
+ config.mailer_sender = 'do-not-reply@gemvein.com'
16
20
 
17
21
  # Configure the class responsible to send e-mails.
18
22
  # config.mailer = 'Devise::Mailer'
@@ -31,16 +35,18 @@ Devise.setup do |config|
31
35
  # just :email. You can configure it to use [:username, :subdomain], so for
32
36
  # authenticating a user, both parameters are required. Remember that those
33
37
  # parameters are used only when authenticating and not when retrieving from
34
- # session. If you need permissions, you should implement that in a before filter.
38
+ # session. If you need permissions, you should implement that in a before
39
+ # filter.
35
40
  # You can also supply a hash where the value is a boolean determining whether
36
41
  # or not authentication should be aborted when the value is not present.
37
42
  # config.authentication_keys = [:email]
38
43
 
39
- # Configure parameters from the request object used for authentication. Each entry
40
- # given should be a request method and it will automatically be passed to the
41
- # find_for_authentication method and considered in your model lookup. For instance,
42
- # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
43
- # The same considerations mentioned for authentication_keys also apply to request_keys.
44
+ # Configure parameters from the request object used for authentication. Each
45
+ # entry given should be a request method and it will automatically be passed
46
+ # to the find_for_authentication method and considered in your model lookup.
47
+ # For instance, if you set :request_keys to [:subdomain], :subdomain will be
48
+ # used on authentication. The same considerations mentioned for
49
+ # authentication_keys also apply to request_keys.
44
50
  # config.request_keys = []
45
51
 
46
52
  # Configure which authentication keys should be case-insensitive.
@@ -50,20 +56,24 @@ Devise.setup do |config|
50
56
 
51
57
  # Configure which authentication keys should have whitespace stripped.
52
58
  # These keys will have whitespace before and after removed upon creating or
53
- # modifying a user and when used to authenticate or find a user. Default is :email.
59
+ # modifying a user and when used to authenticate or find a user. Default is
60
+ # :email.
54
61
  config.strip_whitespace_keys = [:email]
55
62
 
56
63
  # Tell if authentication through request.params is enabled. True by default.
57
- # It can be set to an array that will enable params authentication only for the
58
- # given strategies, for example, `config.params_authenticatable = [:database]` will
59
- # enable it only for database (email + password) authentication.
64
+ # It can be set to an array that will enable params authentication only for
65
+ # the given strategies, for example,
66
+ # `config.params_authenticatable = [:database]` will enable it only for
67
+ # database (email + password) authentication.
60
68
  # config.params_authenticatable = true
61
69
 
62
70
  # Tell if authentication through HTTP Auth is enabled. False by default.
63
71
  # It can be set to an array that will enable http authentication only for the
64
- # given strategies, for example, `config.http_authenticatable = [:database]` will
65
- # enable it only for database authentication. The supported strategies are:
66
- # :database = Support basic authentication with authentication key + password
72
+ # given strategies, for example, `config.http_authenticatable = [:database]`
73
+ # will enable it only for database authentication. The supported strategies
74
+ # are:
75
+ # :database = Support basic authentication with authentication key +
76
+ # password
67
77
  # config.http_authenticatable = false
68
78
 
69
79
  # If 401 status code should be returned for AJAX requests. True by default.
@@ -98,17 +108,21 @@ Devise.setup do |config|
98
108
 
99
109
  # ==> Configuration for :database_authenticatable
100
110
  # For bcrypt, this is the cost for hashing the password and defaults to 11. If
101
- # using other algorithms, it sets how many times you want the password to be hashed.
111
+ # using other algorithms, it sets how many times you want the password to be
112
+ # hashed.
102
113
  #
103
- # Limiting the stretches to just one in testing will increase the performance of
104
- # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
105
- # a value less than 10 in other environments. Note that, for bcrypt (the default
106
- # algorithm), the cost increases exponentially with the number of stretches (e.g.
107
- # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
114
+ # Limiting the stretches to just one in testing will increase the performance
115
+ # of your test suite dramatically. However, it is STRONGLY RECOMMENDED to not
116
+ # use a value less than 10 in other environments. Note that, for bcrypt (the
117
+ # default algorithm), the cost increases exponentially with the number of
118
+ # stretches (e.g. a value of 20 is already extremely slow: approx. 60 seconds
119
+ # for 1 calculation).
108
120
  config.stretches = Rails.env.test? ? 1 : 11
109
121
 
110
122
  # Set up a pepper to generate the hashed password.
111
- # config.pepper = '750d1cf5035bcb29512b9d4eb6e27b092e8d092188934dcb2397633bd41979b8face9b7c67a9d30f99ed876bc74340887dc1de0a9a44054074c8a128e7fe5888'
123
+ # config.pepper = 'e5d2d762bb03e0c932343fc3afcd844388592b27c8802a056e8162083'\
124
+ # '8e4f3a7bc3f246da13999c3f5993761132732443d87b302c8acc3b38a'\
125
+ # 'e784c1921f660e'
112
126
 
113
127
  # Send a notification to the original email when the user's email is changed.
114
128
  # config.send_email_changed_notification = false
@@ -133,9 +147,10 @@ Devise.setup do |config|
133
147
  # config.confirm_within = 3.days
134
148
 
135
149
  # If true, requires any email changes to be confirmed (exactly the same way as
136
- # initial account confirmation) to be applied. Requires additional unconfirmed_email
137
- # db field (see migrations). Until confirmed, new email is stored in
138
- # unconfirmed_email column, and copied to email column on successful confirmation.
150
+ # initial account confirmation) to be applied. Requires additional
151
+ # unconfirmed_email db field (see migrations). Until confirmed, new email is
152
+ # stored in unconfirmed_email column, and copied to email column on successful
153
+ # confirmation.
139
154
  config.reconfirmable = true
140
155
 
141
156
  # Defines which key will be used when confirming an account
@@ -171,7 +186,8 @@ Devise.setup do |config|
171
186
 
172
187
  # ==> Configuration for :lockable
173
188
  # Defines which strategy will be used to lock an account.
174
- # :failed_attempts = Locks an account after a number of failed attempts to sign in.
189
+ # :failed_attempts = Locks an account after a number of failed attempts to
190
+ # sign in.
175
191
  # :none = No lock strategy. You should handle locking by yourself.
176
192
  # config.lock_strategy = :failed_attempts
177
193
 
@@ -180,7 +196,8 @@ Devise.setup do |config|
180
196
 
181
197
  # Defines which strategy will be used to unlock an account.
182
198
  # :email = Sends an unlock link to the user email
183
- # :time = Re-enables login after a certain amount of time (see :unlock_in below)
199
+ # :time = Re-enables login after a certain amount of time (see :unlock_in
200
+ # below)
184
201
  # :both = Enables both strategies
185
202
  # :none = No unlock strategy. You should handle unlocking by yourself.
186
203
  # config.unlock_strategy = :both
@@ -205,24 +222,26 @@ Devise.setup do |config|
205
222
  # change their passwords.
206
223
  config.reset_password_within = 6.hours
207
224
 
208
- # When set to false, does not sign a user in automatically after their password is
209
- # reset. Defaults to true, so a user is signed in automatically after a reset.
225
+ # When set to false, does not sign a user in automatically after their
226
+ # password is reset. Defaults to true, so a user is signed in automatically
227
+ # after a reset.
210
228
  # config.sign_in_after_reset_password = true
211
229
 
212
230
  # ==> Configuration for :encryptable
213
- # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
231
+ # Allow you to use another hashing or encryption algorithm besides bcrypt
232
+ # (default).
214
233
  # You can use :sha1, :sha512 or algorithms from others authentication tools as
215
- # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
216
- # for default behavior) and :restful_authentication_sha1 (then you should set
217
- # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
234
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to
235
+ # 20 for default behavior) and :restful_authentication_sha1 (then you should
236
+ # set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
218
237
  #
219
238
  # Require the `devise-encryptable` gem when using anything other than bcrypt
220
239
  # config.encryptor = :sha512
221
240
 
222
241
  # ==> Scopes configuration
223
- # Turn scoped views on. Before rendering "sessions/new", it will first check for
224
- # "users/sessions/new". It's turned off by default because it's slower if you
225
- # are using only default views.
242
+ # Turn scoped views on. Before rendering "sessions/new", it will first check
243
+ # for "users/sessions/new". It's turned off by default because it's slower if
244
+ # you are using only default views.
226
245
  # config.scoped_views = false
227
246
 
228
247
  # Configure the default scope given to Warden. By default it's the first
@@ -254,7 +273,8 @@ Devise.setup do |config|
254
273
 
255
274
  # ==> Warden configuration
256
275
  # If you want to use other strategies, that are not supported by Devise, or
257
- # change the failure app, you can configure them inside the config.warden block.
276
+ # change the failure app, you can configure them inside the config.warden
277
+ # block.
258
278
  #
259
279
  # config.warden do |manager|
260
280
  # manager.intercept_401 = false
@@ -262,9 +282,10 @@ Devise.setup do |config|
262
282
  # end
263
283
 
264
284
  # ==> Mountable engine configurations
265
- # When using Devise inside an engine, let's call it `MyEngine`, and this engine
266
- # is mountable, there are some extra configurations to be taken into account.
267
- # The following options are available, assuming the engine is mounted as:
285
+ # When using Devise inside an engine, let's call it `MyEngine`, and this
286
+ # engine is mountable, there are some extra configurations to be taken into
287
+ # account. The following options are available, assuming the engine is mounted
288
+ # as:
268
289
  #
269
290
  # mount MyEngine, at: '/my_engine'
270
291
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  HighVoltage.configure do |config|
2
4
  config.home_page = 'index'
3
5
  end
@@ -1,7 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rolify.configure do |config|
2
4
  # By default ORM adapter is ActiveRecord. uncomment to use mongoid
3
5
  # config.use_mongoid
4
6
 
5
- # Dynamic shortcuts for User class (user.is_admin? like methods). Default is: false
7
+ # Dynamic shortcuts for User class (user.is_admin? like methods).
8
+ # Default is: false
6
9
  # config.use_dynamic_shortcuts
7
- end
10
+ end
@@ -1,17 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Rails.application.routes.draw do
4
-
5
-
6
-
7
-
8
-
9
4
  mount DateBook::Engine => '/date_book', as: 'date_book'
10
5
  if Rails.env.development?
11
- mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: "/date_book/api"
6
+ mount(
7
+ GraphiQL::Rails::Engine,
8
+ at: '/graphiql',
9
+ graphql_path: '/date_book/api'
10
+ )
12
11
  end
13
-
14
-
12
+
15
13
  devise_for :users
16
-
17
14
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateUsersTable < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table :users do |t|
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddDeviseToUsers < ActiveRecord::Migration[5.1]
2
4
  def self.up
3
5
  change_table :users do |t|
4
6
  ## Database authenticatable
5
- t.string :email, null: false, default: ""
6
- t.string :encrypted_password, null: false, default: ""
7
+ t.string :email, null: false, default: ''
8
+ t.string :encrypted_password, null: false, default: ''
7
9
 
8
10
  ## Recoverable
9
11
  t.string :reset_password_token
@@ -30,7 +32,6 @@ class AddDeviseToUsers < ActiveRecord::Migration[5.1]
30
32
  # t.string :unlock_token # Only if unlock strategy is :email or :both
31
33
  # t.datetime :locked_at
32
34
 
33
-
34
35
  # Uncomment below if timestamps were not included in your original model.
35
36
  # t.timestamps null: false
36
37
  end
@@ -1,19 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RolifyCreateRoles < ActiveRecord::Migration[5.1]
2
4
  def change
3
5
  create_table(:roles) do |t|
4
6
  t.string :name
5
- t.references :resource, :polymorphic => true
7
+ t.references :resource, polymorphic: true
6
8
 
7
9
  t.timestamps
8
10
  end
9
11
 
10
- create_table(:users_roles, :id => false) do |t|
12
+ create_table(:users_roles, id: false) do |t|
11
13
  t.references :user
12
14
  t.references :role
13
15
  end
14
16
 
15
17
  add_index(:roles, :name)
16
- add_index(:roles, [ :name, :resource_type, :resource_id ])
17
- add_index(:users_roles, [ :user_id, :role_id ])
18
+ add_index(:roles, %i[name resource_type resource_id])
19
+ add_index(:users_roles, %i[user_id role_id])
18
20
  end
19
21
  end
@@ -1,4 +1,7 @@
1
1
  # This migration comes from date_book (originally 20170807133845)
2
+ # frozen_string_literal: true
3
+
4
+ # Migration to create the `calendars` table
2
5
  class CreateCalendars < ActiveRecord::Migration[5.1]
3
6
  def change
4
7
  create_table :calendars do |t|
@@ -1,4 +1,7 @@
1
1
  # This migration comes from date_book (originally 20170807133846)
2
+ # frozen_string_literal: true
3
+
4
+ # Migration to create the `events` table
2
5
  class CreateEvents < ActiveRecord::Migration[5.1]
3
6
  def change
4
7
  create_table :events do |t|
@@ -1,21 +1,24 @@
1
1
  # This migration comes from date_book (originally 20170807133847)
2
+ # frozen_string_literal: true
3
+
4
+ # Migration to create the `schedules` table used by Schedulable
2
5
  class CreateSchedules < ActiveRecord::Migration[5.1]
3
6
  def self.up
4
7
  create_table :schedules do |t|
5
8
  t.references :schedulable, polymorphic: true
6
-
9
+
7
10
  t.date :date
8
11
  t.time :time
9
-
12
+
10
13
  t.string :rule
11
14
  t.string :interval
12
-
15
+
13
16
  t.text :day
14
17
  t.text :day_of_week
15
-
18
+
16
19
  t.datetime :until
17
20
  t.integer :count
18
-
21
+
19
22
  t.timestamps
20
23
  end
21
24
  end
@@ -23,4 +26,4 @@ class CreateSchedules < ActiveRecord::Migration[5.1]
23
26
  def self.down
24
27
  drop_table :schedules
25
28
  end
26
- end
29
+ end
@@ -1,4 +1,7 @@
1
1
  # This migration comes from date_book (originally 20170807133848)
2
+ # frozen_string_literal: true
3
+
4
+ # Migration to add our fields to schedule
2
5
  class AddFieldsToSchedule < ActiveRecord::Migration[5.1]
3
6
  def change
4
7
  add_column :schedules, :duration, :integer, default: 3600
@@ -1,17 +1,18 @@
1
1
  # This migration comes from date_book (originally 20170807133849)
2
+ # frozen_string_literal: true
3
+
4
+ # Migration to add `event_occurrences` table, used by Schedulable
2
5
  class CreateEventOccurrences < ActiveRecord::Migration[5.1]
3
6
  def self.up
4
7
  create_table :event_occurrences do |t|
5
-
6
8
  t.references :schedulable, polymorphic: true
7
9
  t.datetime :date
8
10
 
9
11
  t.timestamps
10
-
11
12
  end
12
13
  end
13
14
 
14
15
  def self.down
15
16
  drop_table :event_occurrences
16
17
  end
17
- end
18
+ end