thecore 1.3.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +37 -0
  4. data/app/controllers/application_controller.rb +2 -0
  5. data/app/controllers/pages_controller.rb +37 -0
  6. data/app/jobs/application_job.rb +2 -0
  7. data/app/models/ability.rb +48 -0
  8. data/app/models/user.rb +158 -0
  9. data/app/uploaders/attachment_uploader.rb +27 -0
  10. data/app/uploaders/image_uploader.rb +27 -0
  11. data/config/initializers/rails_admin.rb +42 -0
  12. data/config/initializers/rails_application_config.rb +28 -0
  13. data/config/initializers/thecore_concern.rb +113 -0
  14. data/config/locales/en.activerecord.yml +6 -0
  15. data/config/locales/en.contact_mailer.custom.yml +5 -0
  16. data/config/locales/en.devise.custom.yml +15 -0
  17. data/config/locales/en.rails_admin.yml +34 -0
  18. data/config/locales/en.rollincode.yml +5 -0
  19. data/config/locales/en.simple_form.yml +31 -0
  20. data/config/locales/en.yml +31 -0
  21. data/config/locales/it.activerecord.yml +20 -0
  22. data/config/locales/it.contact_mailer.custom.yml +5 -0
  23. data/config/locales/it.devise.custom.yml +15 -0
  24. data/config/locales/it.rails_admin.yml +34 -0
  25. data/config/locales/it.rollincode.yml +5 -0
  26. data/config/locales/it.simple_form.yml +31 -0
  27. data/config/locales/it.yml +38 -0
  28. data/config/routes.rb +14 -0
  29. data/db/migrate/20131103142222_create_friendly_id_slugs.rb +15 -0
  30. data/db/migrate/20141010133701_devise_create_users.rb +54 -0
  31. data/db/migrate/20150806091039_add_authentication_token_to_users.rb +6 -0
  32. data/db/migrate/20150825101810_add_roles_mask_to_users.rb +5 -0
  33. data/db/migrate/20151201145832_add_external_to_user.rb +5 -0
  34. data/db/migrate/20160331101901_add_code_to_user.rb +6 -0
  35. data/db/migrate/20160331101902_add_admin_user.rb +162 -0
  36. data/db/migrate/20161029154134_remove_friendly_id_slugs.rb +5 -0
  37. data/db/seeds.rb +1 -0
  38. data/lib/abilities.rb +20 -0
  39. data/lib/active_record_extension.rb +145 -0
  40. data/lib/activerecord_paperclip_extension.rb +21 -0
  41. data/lib/application_configs.rb +26 -0
  42. data/lib/application_record_loader.rb +3 -0
  43. data/lib/backtrace_silencers.rb +7 -0
  44. data/lib/constants.rb +0 -0
  45. data/lib/date_format.rb +27 -0
  46. data/lib/devise_initializer.rb +275 -0
  47. data/lib/generators/thecore/add_git/USAGE +8 -0
  48. data/lib/generators/thecore/add_git/add_git_generator.rb +269 -0
  49. data/lib/generators/thecore/thecorize_app/USAGE +8 -0
  50. data/lib/generators/thecore/thecorize_app/thecorize_app_generator.rb +37 -0
  51. data/lib/generators/thecore/thecorize_models/USAGE +9 -0
  52. data/lib/generators/thecore/thecorize_models/thecorize_models_generator.rb +255 -0
  53. data/lib/generators/thecore/thecorize_plugin/USAGE +9 -0
  54. data/lib/generators/thecore/thecorize_plugin/thecorize_plugin_generator.rb +166 -0
  55. data/lib/inflections.rb +16 -0
  56. data/lib/integer_extensions.rb +26 -0
  57. data/lib/kaminari_config.rb +12 -0
  58. data/lib/mime_types.rb +5 -0
  59. data/lib/postgresql_drop_replacement.rb +11 -0
  60. data/lib/string_extensions.rb +14 -0
  61. data/lib/tasks/thecore_tasks.rake +4 -0
  62. data/lib/thecore/engine.rb +35 -0
  63. data/lib/thecore/version.rb +3 -0
  64. data/lib/thecore.rb +63 -0
  65. data/lib/thecore_actions.rb +2 -0
  66. data/lib/thecore_base_roles.rb +2 -0
  67. data/lib/thecore_rails_admin_bulk_delete_concern.rb +19 -0
  68. data/lib/thecore_rails_admin_export_concern.rb +19 -0
  69. data/lib/thecore_rails_admin_main_controller_concern.rb +11 -0
  70. data/test/dummy/README.rdoc +28 -0
  71. data/test/dummy/Rakefile +6 -0
  72. data/test/dummy/app/assets/javascripts/application.js +13 -0
  73. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  74. data/test/dummy/app/controllers/application_controller.rb +5 -0
  75. data/test/dummy/app/helpers/application_helper.rb +2 -0
  76. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  77. data/test/dummy/bin/bundle +3 -0
  78. data/test/dummy/bin/rails +4 -0
  79. data/test/dummy/bin/rake +4 -0
  80. data/test/dummy/bin/setup +29 -0
  81. data/test/dummy/config/application.rb +25 -0
  82. data/test/dummy/config/boot.rb +5 -0
  83. data/test/dummy/config/database.yml +25 -0
  84. data/test/dummy/config/environment.rb +5 -0
  85. data/test/dummy/config/environments/development.rb +41 -0
  86. data/test/dummy/config/environments/production.rb +79 -0
  87. data/test/dummy/config/environments/test.rb +42 -0
  88. data/test/dummy/config/initializers/assets.rb +11 -0
  89. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  90. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  91. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  92. data/test/dummy/config/initializers/inflections.rb +16 -0
  93. data/test/dummy/config/initializers/mime_types.rb +4 -0
  94. data/test/dummy/config/initializers/session_store.rb +3 -0
  95. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  96. data/test/dummy/config/locales/en.yml +23 -0
  97. data/test/dummy/config/routes.rb +56 -0
  98. data/test/dummy/config/secrets.yml +22 -0
  99. data/test/dummy/config.ru +4 -0
  100. data/test/dummy/db/development.sqlite3 +0 -0
  101. data/test/dummy/log/development.log +6 -0
  102. data/test/dummy/public/404.html +67 -0
  103. data/test/dummy/public/422.html +67 -0
  104. data/test/dummy/public/500.html +66 -0
  105. data/test/dummy/public/favicon.ico +0 -0
  106. data/test/fixtures/users.yml +11 -0
  107. data/test/integration/navigation_test.rb +8 -0
  108. data/test/lib/generators/make_associations_complete_generator_test.rb +14 -0
  109. data/test/lib/generators/thecoreize_rails_plugin_generator_test.rb +14 -0
  110. data/test/lib/generators/thecorize_app_generator_test.rb +14 -0
  111. data/test/models/user_test.rb +7 -0
  112. data/test/test_helper.rb +20 -0
  113. data/test/thecore_test.rb +7 -0
  114. metadata +494 -0
@@ -0,0 +1,26 @@
1
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
2
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
3
+ # Rails.application.config.time_zone = 'Rome'
4
+
5
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
6
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
7
+ # Rails.application.config.i18n.default_locale = :en
8
+ #I18n.enforce_available_locales = false
9
+
10
+ # Test framework
11
+ #Rails.application.config.generators.test_framework false
12
+
13
+ # autoload lib path
14
+ #Rails.application.config.autoload_paths += %W(#{Rails.application.config.root}/lib)
15
+
16
+ # Added to avoid flash error message: undefined method `flash' for #<ActionDispatch::Request
17
+ # That was caused by my api adding to a previosuly existing application
18
+ #Rails.application.config.api_only = false
19
+
20
+ # Include the authenticity token in remote forms.
21
+
22
+ # Rails.application.middleware.use ::ActionDispatch::Static, "#{root}/vendor"
23
+
24
+ # Rails Admin Theme
25
+ ENV['RAILS_ADMIN_THEME'] ||= 'rollincode'
26
+
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
data/lib/constants.rb ADDED
File without changes
@@ -0,0 +1,27 @@
1
+ # Date
2
+ # ----------------------------
3
+ #Date::DATE_FORMATS[:default] = "%Y-%m-%d" # 2013-11-03
4
+ Date::DATE_FORMATS[:default] = "%B %e, %Y" # November 3, 2013
5
+ #Date::DATE_FORMATS[:default] = "%e %b %Y" # 3 Nov 2013
6
+ #Date::DATE_FORMATS[:default] = "%Y%m%d" # 20131103
7
+ #Date::DATE_FORMATS[:default] = "%e %b" # 3 Nov
8
+ #Date::DATE_FORMATS[:default] = "" # custom
9
+
10
+ # DateTime
11
+ # ----------------------------
12
+ #DateTime::DATE_FORMATS[:default] = "%Y-%m-%d" # 2013-11-03 14:22:18
13
+ DateTime::DATE_FORMATS[:default] = "%B %e, %Y" # November 3, 2013 14:22
14
+ #DateTime::DATE_FORMATS[:default] = "%e %b %Y" # Sun, 3 Nov 2013 14:22:18 -0700
15
+ #DateTime::DATE_FORMATS[:default] = "%Y%m%d" # 20131103142218
16
+ #DateTime::DATE_FORMATS[:default] = "%e %b" # 3 Nov 14:22
17
+ #DateTime::DATE_FORMATS[:default] = "" # custom
18
+
19
+ # Time
20
+ # ----------------------------
21
+ #Time::DATE_FORMATS[:default] = "%Y-%m-%d %H:%M:%S" # 2013-11-03 14:22:18
22
+ #Time::DATE_FORMATS[:default] = "%B %d, %Y %H:%M" # November 3, 2013 14:22
23
+ #Time::DATE_FORMATS[:default] = "%a, %d %b %Y %H:%M:%S %z" # Sun, 3 Nov 2013 14:22:18 -0700
24
+ #Time::DATE_FORMATS[:default] = "%d %b %H:%M" # 3 Nov 14:22
25
+ #Time::DATE_FORMATS[:default] = "%Y%m%d%H%M%S" # 20131103142218
26
+ Time::DATE_FORMATS[:default] = "%H:%M" # 14:22
27
+ #Time::DATE_FORMATS[:default] = "" # custom
@@ -0,0 +1,275 @@
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
+ # Devise will use the `secret_key_base` as its `secret_key`
8
+ # by default. You can change it below and use your own secret key.
9
+ # config.secret_key = '9eb94f709f61e40056ac0acb37075678e895e180316920157d37a18a2861c4e5cc1fd0d914213e4715d5477dfbe2b3235b298b29f8be10af6a39d2af4649d09d'
10
+ config.secret_key = '5bfe13dfa59b776381d83c1f3ffc689e8019b2cf94fb70edf79602783801ecdceb7374dd48359d6ede24a8bbd52c574115d04b297fbd2d9b1521b992b51a7acf'
11
+
12
+ # ==> Mailer Configuration
13
+ # Configure the e-mail address which will be shown in Devise::Mailer,
14
+ # note that it will be overwritten if you use your own mailer class
15
+ # with default "from" parameter.
16
+ config.mailer_sender = 'gabriele.tassoni@gmail.com'
17
+
18
+ # Configure the class responsible to send e-mails.
19
+ # config.mailer = 'Devise::Mailer'
20
+
21
+ # Configure the parent class responsible to send e-mails.
22
+ # config.parent_mailer = 'ActionMailer::Base'
23
+
24
+ # ==> ORM configuration
25
+ # Load and configure the ORM. Supports :active_record (default) and
26
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
27
+ # available as additional gems.
28
+ require 'devise/orm/active_record'
29
+
30
+ # ==> Configuration for any authentication mechanism
31
+ # Configure which keys are used when authenticating a user. The default is
32
+ # just :email. You can configure it to use [:username, :subdomain], so for
33
+ # authenticating a user, both parameters are required. Remember that those
34
+ # parameters are used only when authenticating and not when retrieving from
35
+ # session. If you need permissions, you should implement that in a before filter.
36
+ # You can also supply a hash where the value is a boolean determining whether
37
+ # or not authentication should be aborted when the value is not present.
38
+ config.authentication_keys = [:username]
39
+
40
+ # Configure parameters from the request object used for authentication. Each entry
41
+ # given should be a request method and it will automatically be passed to the
42
+ # find_for_authentication method and considered in your model lookup. For instance,
43
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
44
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
45
+ # config.request_keys = []
46
+
47
+ # Configure which authentication keys should be case-insensitive.
48
+ # These keys will be downcased upon creating or modifying a user and when used
49
+ # to authenticate or find a user. Default is :email.
50
+ config.case_insensitive_keys = [:username]
51
+
52
+ # Configure which authentication keys should have whitespace stripped.
53
+ # These keys will have whitespace before and after removed upon creating or
54
+ # modifying a user and when used to authenticate or find a user. Default is :email.
55
+ config.strip_whitespace_keys = [:username]
56
+
57
+ # Tell if authentication through request.params is enabled. True by default.
58
+ # It can be set to an array that will enable params authentication only for the
59
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
60
+ # enable it only for database (email + password) authentication.
61
+ # config.params_authenticatable = true
62
+
63
+ # Tell if authentication through HTTP Auth is enabled. False by default.
64
+ # It can be set to an array that will enable http authentication only for the
65
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
66
+ # enable it only for database authentication. The supported strategies are:
67
+ # :database = Support basic authentication with authentication key + password
68
+ # config.http_authenticatable = false
69
+
70
+ # If 401 status code should be returned for AJAX requests. True by default.
71
+ # config.http_authenticatable_on_xhr = true
72
+
73
+ # The realm used in Http Basic Authentication. 'Application' by default.
74
+ # config.http_authentication_realm = 'Application'
75
+
76
+ # It will change confirmation, password recovery and other workflows
77
+ # to behave the same regardless if the e-mail provided was right or wrong.
78
+ # Does not affect registerable.
79
+ # config.paranoid = true
80
+
81
+ # By default Devise will store the user in session. You can skip storage for
82
+ # particular strategies by setting this option.
83
+ # Notice that if you are skipping storage for all authentication paths, you
84
+ # may want to disable generating routes to Devise's sessions controller by
85
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
86
+ config.skip_session_storage = [:http_auth]
87
+
88
+ # By default, Devise cleans up the CSRF token on authentication to
89
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
90
+ # requests for sign in and sign up, you need to get a new CSRF token
91
+ # from the server. You can disable this option at your own risk.
92
+ # config.clean_up_csrf_token_on_authentication = true
93
+
94
+ # When false, Devise will not attempt to reload routes on eager load.
95
+ # This can reduce the time taken to boot the app but if your application
96
+ # requires the Devise mappings to be loaded during boot time the application
97
+ # won't boot properly.
98
+ # config.reload_routes = true
99
+
100
+ # ==> Configuration for :database_authenticatable
101
+ # For bcrypt, this is the cost for hashing the password and defaults to 11. If
102
+ # using other algorithms, it sets how many times you want the password to be hashed.
103
+ #
104
+ # Limiting the stretches to just one in testing will increase the performance of
105
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
106
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
107
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
108
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
109
+ config.stretches = Rails.env.test? ? 1 : 11
110
+
111
+ # Set up a pepper to generate the hashed password.
112
+ # config.pepper = '32e1aa93197fe582d35bd6320d2b103f48036aeead97ede1d0ba090848dc15e54743837f8ed208d474a91311cdf60931cad887dc29ed6dfc870b4a35083b589c'
113
+
114
+ # Send a notification email when the user's password is changed
115
+ # config.send_password_change_notification = false
116
+
117
+ # ==> Configuration for :confirmable
118
+ # A period that the user is allowed to access the website even without
119
+ # confirming their account. For instance, if set to 2.days, the user will be
120
+ # able to access the website for two days without confirming their account,
121
+ # access will be blocked just in the third day. Default is 0.days, meaning
122
+ # the user cannot access the website without confirming their account.
123
+ # config.allow_unconfirmed_access_for = 2.days
124
+
125
+ # A period that the user is allowed to confirm their account before their
126
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
127
+ # their account within 3 days after the mail was sent, but on the fourth day
128
+ # their account can't be confirmed with the token any more.
129
+ # Default is nil, meaning there is no restriction on how long a user can take
130
+ # before confirming their account.
131
+ # config.confirm_within = 3.days
132
+
133
+ # If true, requires any email changes to be confirmed (exactly the same way as
134
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
135
+ # db field (see migrations). Until confirmed, new email is stored in
136
+ # unconfirmed_email column, and copied to email column on successful confirmation.
137
+ config.reconfirmable = true
138
+
139
+ # Defines which key will be used when confirming an account
140
+ # config.confirmation_keys = [:email]
141
+
142
+ # ==> Configuration for :rememberable
143
+ # The time the user will be remembered without asking for credentials again.
144
+ # config.remember_for = 2.weeks
145
+
146
+ # Invalidates all the remember me tokens when the user signs out.
147
+ config.expire_all_remember_me_on_sign_out = true
148
+
149
+ # If true, extends the user's remember period when remembered via cookie.
150
+ # config.extend_remember_period = false
151
+
152
+ # Options to be passed to the created cookie. For instance, you can set
153
+ # secure: true in order to force SSL only cookies.
154
+ # config.rememberable_options = {}
155
+
156
+ # ==> Configuration for :validatable
157
+ # Range for password length.
158
+ config.password_length = 6..128
159
+
160
+ # Email regex used to validate email formats. It simply asserts that
161
+ # one (and only one) @ exists in the given string. This is mainly
162
+ # to give user feedback and not to assert the e-mail validity.
163
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
164
+
165
+ # ==> Configuration for :timeoutable
166
+ # The time you want to timeout the user session without activity. After this
167
+ # time the user will be asked for credentials again. Default is 30 minutes.
168
+ # config.timeout_in = 30.minutes
169
+
170
+ # ==> Configuration for :lockable
171
+ # Defines which strategy will be used to lock an account.
172
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
173
+ # :none = No lock strategy. You should handle locking by yourself.
174
+ # config.lock_strategy = :failed_attempts
175
+
176
+ # Defines which key will be used when locking and unlocking an account
177
+ # config.unlock_keys = [:email]
178
+
179
+ # Defines which strategy will be used to unlock an account.
180
+ # :email = Sends an unlock link to the user email
181
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
182
+ # :both = Enables both strategies
183
+ # :none = No unlock strategy. You should handle unlocking by yourself.
184
+ # config.unlock_strategy = :both
185
+
186
+ # Number of authentication tries before locking an account if lock_strategy
187
+ # is failed attempts.
188
+ # config.maximum_attempts = 20
189
+
190
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
191
+ # config.unlock_in = 1.hour
192
+
193
+ # Warn on the last attempt before the account is locked.
194
+ # config.last_attempt_warning = true
195
+
196
+ # ==> Configuration for :recoverable
197
+ #
198
+ # Defines which key will be used when recovering the password for an account
199
+ # config.reset_password_keys = [:email]
200
+
201
+ # Time interval you can reset your password with a reset password key.
202
+ # Don't put a too small interval or your users won't have the time to
203
+ # change their passwords.
204
+ config.reset_password_within = 6.hours
205
+
206
+ # When set to false, does not sign a user in automatically after their password is
207
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
208
+ # config.sign_in_after_reset_password = true
209
+
210
+ # ==> Configuration for :encryptable
211
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
212
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
213
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
214
+ # for default behavior) and :restful_authentication_sha1 (then you should set
215
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
216
+ #
217
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
218
+ # config.encryptor = :sha512
219
+
220
+ # ==> Scopes configuration
221
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
222
+ # "users/sessions/new". It's turned off by default because it's slower if you
223
+ # are using only default views.
224
+ # config.scoped_views = false
225
+
226
+ # Configure the default scope given to Warden. By default it's the first
227
+ # devise role declared in your routes (usually :user).
228
+ # config.default_scope = :user
229
+
230
+ # Set this configuration to false if you want /users/sign_out to sign out
231
+ # only the current scope. By default, Devise signs out all scopes.
232
+ # config.sign_out_all_scopes = true
233
+
234
+ # ==> Navigation configuration
235
+ # Lists the formats that should be treated as navigational. Formats like
236
+ # :html, should redirect to the sign in page when the user does not have
237
+ # access, but formats like :xml or :json, should return 401.
238
+ #
239
+ # If you have any extra navigational formats, like :iphone or :mobile, you
240
+ # should add them to the navigational formats lists.
241
+ #
242
+ # The "*/*" below is required to match Internet Explorer requests.
243
+ # config.navigational_formats = ['*/*', :html]
244
+
245
+ # The default HTTP method used to sign out a resource. Default is :delete.
246
+ config.sign_out_via = :delete
247
+
248
+ # ==> OmniAuth
249
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
250
+ # up on your models and hooks.
251
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
252
+
253
+ # ==> Warden configuration
254
+ # If you want to use other strategies, that are not supported by Devise, or
255
+ # change the failure app, you can configure them inside the config.warden block.
256
+ #
257
+ # config.warden do |manager|
258
+ # manager.intercept_401 = false
259
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
260
+ # end
261
+
262
+ # ==> Mountable engine configurations
263
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
264
+ # is mountable, there are some extra configurations to be taken into account.
265
+ # The following options are available, assuming the engine is mounted as:
266
+ #
267
+ # mount MyEngine, at: '/my_engine'
268
+ #
269
+ # The router that invoked `devise_for`, in the example above, would be:
270
+ # config.router_name = :my_engine
271
+ #
272
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
273
+ # so you need to do it manually. For the users scope, it would be:
274
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
275
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate thecorize_app Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,269 @@
1
+ require 'rails/generators/named_base'
2
+ module Thecore
3
+ class AddGitGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ # TODO: add a .gitignore good for Rails and manage git
7
+ # "Traversing the DIR structures it adds git remote URL", "By checking wether or not the .git folder exists, it inits or changes the url."
8
+ def update_or_init_git_remote
9
+ create_file '.gitignore', "
10
+
11
+ # Created by https://www.gitignore.io/api/linux,osx,windows,rails,ruby,rubymine
12
+ ### Linux ###
13
+ *~
14
+ # temporary files which can be created if a process still has a handle open of a deleted file
15
+ .fuse_hidden*
16
+ # KDE directory preferences
17
+ .directory
18
+ # Linux trash folder which might appear on any partition or disk
19
+ .Trash-*
20
+ # .nfs files are created when an open file is removed but is still being accessed
21
+ .nfs*
22
+ ### OSX ###
23
+ *.DS_Store
24
+ .AppleDouble
25
+ .LSOverride
26
+ # Icon must end with two \r
27
+ Icon\r\r
28
+
29
+ # Thumbnails
30
+ ._*
31
+ # Files that might appear in the root of a volume
32
+ .DocumentRevisions-V100
33
+ .fseventsd
34
+ .Spotlight-V100
35
+ .TemporaryItems
36
+ .Trashes
37
+ .VolumeIcon.icns
38
+ .com.apple.timemachine.donotpresent
39
+ # Directories potentially created on remote AFP share
40
+ .AppleDB
41
+ .AppleDesktop
42
+ Network Trash Folder
43
+ Temporary Items
44
+ .apdisk
45
+ ### Windows ###
46
+ # Windows thumbnail cache files
47
+ Thumbs.db
48
+ ehthumbs.db
49
+ ehthumbs_vista.db
50
+ # Folder config file
51
+ Desktop.ini
52
+ # Recycle Bin used on file shares
53
+ $RECYCLE.BIN/
54
+ # Windows Installer files
55
+ *.cab
56
+ *.msi
57
+ *.msm
58
+ *.msp
59
+ # Windows shortcuts
60
+ *.lnk
61
+ ### Rails ###
62
+ /test/dummy/log
63
+ *.rbc
64
+ capybara-*.html
65
+ .rspec
66
+ /log
67
+ /tmp
68
+ /db/*.sqlite3
69
+ /db/*.sqlite3-journal
70
+ /public/system
71
+ /coverage/
72
+ /spec/tmp
73
+ **.orig
74
+ rerun.txt
75
+ pickle-email-*.html
76
+ # TODO Comment out this rule if you are OK with secrets being uploaded to the repo
77
+ config/initializers/secret_token.rb
78
+ # Only include if you have production secrets in this file, which is no longer a Rails default
79
+ # config/secrets.yml
80
+ # dotenv
81
+ # TODO Comment out this rule if environment variables can be committed
82
+ .env
83
+ ## Environment normalization:
84
+ /.bundle
85
+ /vendor/bundle
86
+ # these should all be checked in to normalize the environment:
87
+ # Gemfile.lock, .ruby-version, .ruby-gemset
88
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
89
+ .rvmrc
90
+ # if using bower-rails ignore default bower_components path bower.json files
91
+ /vendor/assets/bower_components
92
+ *.bowerrc
93
+ bower.json
94
+ # Ignore pow environment settings
95
+ .powenv
96
+ # Ignore Byebug command history file.
97
+ .byebug_history
98
+ # Ignore bundler config
99
+ /vendor/bundle/
100
+ /vendor/ruby/
101
+ # Ignore the default database.
102
+ /db/*.javadb/
103
+ # Ignore all logfiles and tempfiles.
104
+ /log/*
105
+ .powder
106
+ .virb*
107
+ *.*~
108
+ # various artifacts
109
+ **.war
110
+ *.gem
111
+ *.sassc
112
+ .redcar/
113
+ .config
114
+ .sass-cache
115
+ /public/cache
116
+ /public/stylesheets/compiled
117
+ /public/system/*
118
+ /public/assets/*
119
+ /public/sitemaps
120
+ /spec/tmp/*
121
+ /cache
122
+ /capybara*
123
+ /capybara-*.html
124
+ /gems
125
+ /specifications
126
+ .zeus.sock
127
+ /solr/
128
+ /.gemtags
129
+ /coverage
130
+ /coverage.data
131
+ /InstalledFiles
132
+ /pkg/
133
+ /spec/reports/
134
+ /test/tmp/
135
+ /test/version_tmp/
136
+ # scm revert files
137
+ # Configuration files
138
+ config/app_config.yml
139
+ config/database.yml
140
+ config/application.yml
141
+ config/mandrill.yml
142
+ config/paperclip.yml
143
+ # System Recordings from Tropo
144
+ public/tropo_recordings/**/*
145
+ public/system/**/*
146
+ # Dev Machines
147
+ .DS_Store
148
+ */.DS_Store
149
+ Procfile.dev
150
+ .env.development
151
+ .env.test
152
+ .env.staging
153
+ .env.production
154
+ /*.sublime-workspace
155
+ # Netbeans project directory
156
+ /nbproject/
157
+ # RubyMine project files
158
+ .idea
159
+ # Textmate project files
160
+ /*.tmproj
161
+ # vim artifacts
162
+ **.swp
163
+ .vim
164
+ /.tags
165
+ /.tags_sorted_by_file
166
+ # Application specific
167
+ *.txt
168
+ /doc
169
+ /public/uploads
170
+ # Specific to RubyMotion:
171
+ .dat*
172
+ .repl_history
173
+ build/
174
+ # Documentation cache and generated files:
175
+ /.yardoc/
176
+ /_yardoc/
177
+ /rdoc/
178
+ # Environment normalisation:
179
+ /.bundle/
180
+ /lib/bundler/man/
181
+ # for a library or gem, you might want to ignore these files since the code is
182
+ # intended to run in multiple environments; otherwise, check them in:
183
+ Gemfile.lock
184
+ # .ruby-version
185
+ # .ruby-gemset
186
+ .DS_store
187
+ # Windows image file caches
188
+ ### Ruby ###
189
+ /.config
190
+ /spec/examples.txt
191
+ /tmp/
192
+ # Used by dotenv library to load environment variables.
193
+ # .env
194
+ ## Specific to RubyMotion:
195
+ *.bridgesupport
196
+ build-iPhoneOS/
197
+ build-iPhoneSimulator/
198
+ ## Specific to RubyMotion (use of CocoaPods):
199
+ #
200
+ # We recommend against adding the Pods directory to your .gitignore. However
201
+ # you should judge for yourself, the pros and cons are mentioned at:
202
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
203
+ # vendor/Pods/
204
+ ## Documentation cache and generated files:
205
+ /doc/
206
+ ### RubyMine ###
207
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
208
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
209
+ # User-specific stuff:
210
+ .idea/workspace.xml
211
+ .idea/tasks.xml
212
+ # Sensitive or high-churn files:
213
+ .idea/dataSources/
214
+ .idea/dataSources.ids
215
+ .idea/dataSources.xml
216
+ .idea/dataSources.local.xml
217
+ .idea/sqlDataSources.xml
218
+ .idea/dynamic.xml
219
+ .idea/uiDesigner.xml
220
+ # Gradle:
221
+ .idea/gradle.xml
222
+ .idea/libraries
223
+ # Mongo Explorer plugin:
224
+ .idea/mongoSettings.xml
225
+ ## File-based project format:
226
+ *.iws
227
+ ## Plugin-specific files:
228
+ # IntelliJ
229
+ /out/
230
+ # mpeltonen/sbt-idea plugin
231
+ .idea_modules/
232
+ # JIRA plugin
233
+ atlassian-ide-plugin.xml
234
+ # Crashlytics plugin (for Android Studio and IntelliJ)
235
+ com_crashlytics_export_strings.xml
236
+ crashlytics.properties
237
+ crashlytics-build.properties
238
+ fabric.properties
239
+ ### RubyMine Patch ###
240
+ # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
241
+ # *.iml
242
+ # modules.xml
243
+ # .idea/misc.xml
244
+ # *.ipr
245
+ # End of https://www.gitignore.io/api/linux,osx,windows,rails,ruby,rubymine
246
+
247
+ "
248
+ git :init
249
+ git add: ".gitignore"
250
+ git commit: "-a -m 'Added gitignore'"
251
+ git add: ". -A"
252
+ git commit: "-a -m 'First commit'"
253
+ Dir.chdir(".git/hooks") do
254
+ File.rename("post-update.sample", "post-update") rescue nil
255
+ system "chmod +x post-update"
256
+ end
257
+ project_dir = File.basename File.expand_path("..", Dir.pwd)
258
+ engine_dir = File.basename File.expand_path(".", Dir.pwd)
259
+ remote_url = `git config --get remote.origin.url`
260
+ action = remote_url.empty? ? "add" : "set-url"
261
+ system "git remote #{action} origin https://www.taris.it/git/rails/#{project_dir}/#{engine_dir}.git"
262
+ system "git branch --set-upstream-to=origin/master master"
263
+ Dir.chdir("..") do
264
+ system "git clone --bare #{engine_dir} #{engine_dir}.git"
265
+ end
266
+ say "Remember to run (on the server)\n\tgit update-server-info\nafter uploading the #{engine_dir}.git directory", :red
267
+ end
268
+ end
269
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate thecorize_app Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,37 @@
1
+ require 'rails/generators/named_base'
2
+ module Thecore
3
+ class ThecorizeAppGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def remove_index
7
+ #remove the index.html
8
+ remove_file 'public/index.html'
9
+ end
10
+
11
+ # TODO: Must add
12
+ # *= require thecore to application.css before */
13
+ # //= require thecore to application.js before //= require_tree .
14
+ def manage_assets
15
+ inject_into_file 'app/assets/javascripts/application.js', before: "//= require_tree ." do <<-'RUBY'
16
+ puts "//= require thecore"
17
+ RUBY
18
+ end
19
+ inject_into_file 'app/assets/stylesheets/application.css', before: "*/ ." do <<-'RUBY'
20
+ puts "*= require thecore"
21
+ RUBY
22
+ end
23
+ end
24
+
25
+ # TODO: remove from application controller the protect_from_forgery with: :exception part
26
+ def adapt_application_controller_to_devise
27
+ gsub_file 'app/controllers/application_controller.rb', 'protect_from_forgery with: :exception', ''
28
+ end
29
+
30
+ # TODO: add a .gitignore good for Rails and manage git
31
+ # "Traversing the DIR structures it adds git remote URL", "By checking wether or not the .git folder exists, it inits or changes the url."
32
+ def update_or_init_git_remote
33
+ say "Manage Git", :green
34
+ rails_command "g thecore:add_git #{@name}"
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,9 @@
1
+ Description:
2
+ Generator used to change all the models and make them thecore compatible
3
+
4
+ Example:
5
+ rails generate thecorize_models pluginname
6
+
7
+ This will create:
8
+ It will change models and adds rails_admin declaration (a general one)
9
+ It will add all the necessary tidbits to associations (adds to belongs_to, tries to infer has_many's)