decidim-core 0.0.1.alpha1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d042f94614d6513c6aa3cd01b3480f0abe17c6a1
4
+ data.tar.gz: a5e5e69c7ec264e2ba5bdf195944ed41fb9b08e3
5
+ SHA512:
6
+ metadata.gz: f65db8fd7c971a7d0856febf1597960c49e8adfcff716c92fac5597b22e7d9001e5204e3b687d6f34e7977d719a0222398a0d7375ecab691f6a0cf93b5cb05b0
7
+ data.tar.gz: 8e6acf28c2bac26eba3b9a3a4ba803402c27e7ec1b817b569bd743dfc2de4da463c7bcaf0c8b26959b59a5acf48adb37700fe421de265c124d9deb43f32afa81
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Josep Jaume Rey Peroy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # Decidim
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'decidim'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install decidim
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ begin
3
+ require "bundler/setup"
4
+ rescue LoadError
5
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
6
+ end
7
+
8
+ require "decidim/testing_support/common_rake"
9
+ require "rdoc/task"
10
+
11
+ RDoc::Task.new(:rdoc) do |rdoc|
12
+ rdoc.rdoc_dir = "rdoc"
13
+ rdoc.title = "Decidim"
14
+ rdoc.options << "--line-numbers"
15
+ rdoc.rdoc_files.include("README.md")
16
+ rdoc.rdoc_files.include("lib/**/*.rb")
17
+ end
18
+
19
+ load "rails/tasks/statistics.rake"
20
+
21
+ require "bundler/gem_tasks"
22
+
23
+ desc "Generates a dummy app for testing"
24
+ task :test_app do
25
+ ENV["LIB_NAME"] = "decidim/core"
26
+ Rake::Task["common:test_app"].invoke
27
+ end
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # The main application controller that inherits from Rails.
4
+ class ApplicationController < ActionController::Base
5
+ protect_from_forgery with: :exception, prepend: true
6
+
7
+ layout "application"
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ require_dependency "decidim/application_controller"
3
+
4
+ module Decidim
5
+ class HomeController < ApplicationController
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # Main module to add application-wide helpers.
4
+ module ApplicationHelper
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # View helpers related to the layout.
4
+ module LayoutHelper
5
+ def decidim_page_title
6
+ Decidim.config.application_name
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ class ApplicationJob < ActiveJob::Base
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # Main application mailer configuration. Inherit from this to create new
4
+ # mailers.
5
+ class ApplicationMailer < ActionMailer::Base
6
+ default from: "from@example.com"
7
+ layout "mailer"
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # Main ActiveRecord application configuration.
4
+ class ApplicationRecord < ActiveRecord::Base
5
+ self.abstract_class = true
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ # A User is a citizen that wants to join the platform to participate.
4
+ class User < ApplicationRecord
5
+ # Include default devise modules. Others available are:
6
+ # :confirmable, :lockable, :timeoutable and :omniauthable
7
+ devise :database_authenticatable, :registerable,
8
+ :recoverable, :rememberable, :trackable, :validatable
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ <h2>Welcome to Decidim!</h2>
2
+ <ul>
3
+ <li><%= link_to "Create user", new_user_registration_path %></li>
4
+ </ul>
@@ -0,0 +1,2 @@
1
+ <hr />
2
+ <em>Footer</em>
@@ -0,0 +1,2 @@
1
+ <h1>Decidim</h1>
2
+ <hr />
File without changes
@@ -0,0 +1,277 @@
1
+ # frozen_string_literal: true
2
+ # Use this hook to configure devise mailer, warden hooks and so forth.
3
+ # Many of these configuration options can be set straight in your model.
4
+ Devise.setup do |config|
5
+ # The secret key used by Devise. Devise uses this key to generate
6
+ # random tokens. Changing this key will render invalid all existing
7
+ # confirmation, reset password and unlock tokens in the database.
8
+ # Devise will use the `secret_key_base` as its `secret_key`
9
+ # by default. You can change it below and use your own secret key.
10
+ # config.secret_key = 'e1f4e9899fb5e8b3123950b19cd0f6d22ecaa8c7fb792b6db5a939edc2b3bab722d06a6a46345ee9bf12caa0178408d6134ea92ed778977b8a7ed1007a0c6dbe'
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 = "please-change-me-at-config-initializers-devise@example.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 = "Decidim::ApplicationMailer"
23
+
24
+ config.parent_controller = "Decidim::ApplicationController"
25
+
26
+ # ==> ORM configuration
27
+ # Load and configure the ORM. Supports :active_record (default) and
28
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
29
+ # available as additional gems.
30
+ require "devise/orm/active_record"
31
+
32
+ # ==> Configuration for any authentication mechanism
33
+ # Configure which keys are used when authenticating a user. The default is
34
+ # just :email. You can configure it to use [:username, :subdomain], so for
35
+ # authenticating a user, both parameters are required. Remember that those
36
+ # parameters are used only when authenticating and not when retrieving from
37
+ # session. If you need permissions, you should implement that in a before filter.
38
+ # You can also supply a hash where the value is a boolean determining whether
39
+ # or not authentication should be aborted when the value is not present.
40
+ # config.authentication_keys = [:email]
41
+
42
+ # Configure parameters from the request object used for authentication. Each entry
43
+ # given should be a request method and it will automatically be passed to the
44
+ # find_for_authentication method and considered in your model lookup. For instance,
45
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
46
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
47
+ # config.request_keys = []
48
+
49
+ # Configure which authentication keys should be case-insensitive.
50
+ # These keys will be downcased upon creating or modifying a user and when used
51
+ # to authenticate or find a user. Default is :email.
52
+ config.case_insensitive_keys = [:email]
53
+
54
+ # Configure which authentication keys should have whitespace stripped.
55
+ # These keys will have whitespace before and after removed upon creating or
56
+ # modifying a user and when used to authenticate or find a user. Default is :email.
57
+ config.strip_whitespace_keys = [:email]
58
+
59
+ # Tell if authentication through request.params is enabled. True by default.
60
+ # It can be set to an array that will enable params authentication only for the
61
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
62
+ # enable it only for database (email + password) authentication.
63
+ # config.params_authenticatable = true
64
+
65
+ # Tell if authentication through HTTP Auth is enabled. False by default.
66
+ # It can be set to an array that will enable http authentication only for the
67
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
68
+ # enable it only for database authentication. The supported strategies are:
69
+ # :database = Support basic authentication with authentication key + password
70
+ # config.http_authenticatable = false
71
+
72
+ # If 401 status code should be returned for AJAX requests. True by default.
73
+ # config.http_authenticatable_on_xhr = true
74
+
75
+ # The realm used in Http Basic Authentication. 'Application' by default.
76
+ # config.http_authentication_realm = 'Application'
77
+
78
+ # It will change confirmation, password recovery and other workflows
79
+ # to behave the same regardless if the e-mail provided was right or wrong.
80
+ # Does not affect registerable.
81
+ # config.paranoid = true
82
+
83
+ # By default Devise will store the user in session. You can skip storage for
84
+ # particular strategies by setting this option.
85
+ # Notice that if you are skipping storage for all authentication paths, you
86
+ # may want to disable generating routes to Devise's sessions controller by
87
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
88
+ config.skip_session_storage = [:http_auth]
89
+
90
+ # By default, Devise cleans up the CSRF token on authentication to
91
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
92
+ # requests for sign in and sign up, you need to get a new CSRF token
93
+ # from the server. You can disable this option at your own risk.
94
+ # config.clean_up_csrf_token_on_authentication = true
95
+
96
+ # When false, Devise will not attempt to reload routes on eager load.
97
+ # This can reduce the time taken to boot the app but if your application
98
+ # requires the Devise mappings to be loaded during boot time the application
99
+ # won't boot properly.
100
+ # config.reload_routes = true
101
+
102
+ # ==> Configuration for :database_authenticatable
103
+ # For bcrypt, this is the cost for hashing the password and defaults to 11. If
104
+ # using other algorithms, it sets how many times you want the password to be hashed.
105
+ #
106
+ # Limiting the stretches to just one in testing will increase the performance of
107
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
108
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
109
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
110
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
111
+ config.stretches = Rails.env.test? ? 1 : 11
112
+
113
+ # Set up a pepper to generate the hashed password.
114
+ # config.pepper = 'da466a45a1744ca79cc920a565749cf42b1cbcda0478b299a0db973e1a157fc43d1f578ec8dd393b4ef104274272a3621d203f49f473432a46b8a28ecc9bb4ae'
115
+
116
+ # Send a notification email when the user's password is changed
117
+ # config.send_password_change_notification = false
118
+
119
+ # ==> Configuration for :confirmable
120
+ # A period that the user is allowed to access the website even without
121
+ # confirming their account. For instance, if set to 2.days, the user will be
122
+ # able to access the website for two days without confirming their account,
123
+ # access will be blocked just in the third day. Default is 0.days, meaning
124
+ # the user cannot access the website without confirming their account.
125
+ # config.allow_unconfirmed_access_for = 2.days
126
+
127
+ # A period that the user is allowed to confirm their account before their
128
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
129
+ # their account within 3 days after the mail was sent, but on the fourth day
130
+ # their account can't be confirmed with the token any more.
131
+ # Default is nil, meaning there is no restriction on how long a user can take
132
+ # before confirming their account.
133
+ # config.confirm_within = 3.days
134
+
135
+ # 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.
139
+ config.reconfirmable = true
140
+
141
+ # Defines which key will be used when confirming an account
142
+ # config.confirmation_keys = [:email]
143
+
144
+ # ==> Configuration for :rememberable
145
+ # The time the user will be remembered without asking for credentials again.
146
+ # config.remember_for = 2.weeks
147
+
148
+ # Invalidates all the remember me tokens when the user signs out.
149
+ config.expire_all_remember_me_on_sign_out = true
150
+
151
+ # If true, extends the user's remember period when remembered via cookie.
152
+ # config.extend_remember_period = false
153
+
154
+ # Options to be passed to the created cookie. For instance, you can set
155
+ # secure: true in order to force SSL only cookies.
156
+ # config.rememberable_options = {}
157
+
158
+ # ==> Configuration for :validatable
159
+ # Range for password length.
160
+ config.password_length = 6..128
161
+
162
+ # Email regex used to validate email formats. It simply asserts that
163
+ # one (and only one) @ exists in the given string. This is mainly
164
+ # to give user feedback and not to assert the e-mail validity.
165
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
166
+
167
+ # ==> Configuration for :timeoutable
168
+ # The time you want to timeout the user session without activity. After this
169
+ # time the user will be asked for credentials again. Default is 30 minutes.
170
+ # config.timeout_in = 30.minutes
171
+
172
+ # ==> Configuration for :lockable
173
+ # 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.
175
+ # :none = No lock strategy. You should handle locking by yourself.
176
+ # config.lock_strategy = :failed_attempts
177
+
178
+ # Defines which key will be used when locking and unlocking an account
179
+ # config.unlock_keys = [:email]
180
+
181
+ # Defines which strategy will be used to unlock an account.
182
+ # :email = Sends an unlock link to the user email
183
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
184
+ # :both = Enables both strategies
185
+ # :none = No unlock strategy. You should handle unlocking by yourself.
186
+ # config.unlock_strategy = :both
187
+
188
+ # Number of authentication tries before locking an account if lock_strategy
189
+ # is failed attempts.
190
+ # config.maximum_attempts = 20
191
+
192
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
193
+ # config.unlock_in = 1.hour
194
+
195
+ # Warn on the last attempt before the account is locked.
196
+ # config.last_attempt_warning = true
197
+
198
+ # ==> Configuration for :recoverable
199
+ #
200
+ # Defines which key will be used when recovering the password for an account
201
+ # config.reset_password_keys = [:email]
202
+
203
+ # Time interval you can reset your password with a reset password key.
204
+ # Don't put a too small interval or your users won't have the time to
205
+ # change their passwords.
206
+ config.reset_password_within = 6.hours
207
+
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.
210
+ # config.sign_in_after_reset_password = true
211
+
212
+ # ==> Configuration for :encryptable
213
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
214
+ # 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).
218
+ #
219
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
220
+ # config.encryptor = :sha512
221
+
222
+ # ==> 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.
226
+ # config.scoped_views = false
227
+
228
+ # Configure the default scope given to Warden. By default it's the first
229
+ # devise role declared in your routes (usually :user).
230
+ # config.default_scope = :user
231
+
232
+ # Set this configuration to false if you want /users/sign_out to sign out
233
+ # only the current scope. By default, Devise signs out all scopes.
234
+ # config.sign_out_all_scopes = true
235
+
236
+ # ==> Navigation configuration
237
+ # Lists the formats that should be treated as navigational. Formats like
238
+ # :html, should redirect to the sign in page when the user does not have
239
+ # access, but formats like :xml or :json, should return 401.
240
+ #
241
+ # If you have any extra navigational formats, like :iphone or :mobile, you
242
+ # should add them to the navigational formats lists.
243
+ #
244
+ # The "*/*" below is required to match Internet Explorer requests.
245
+ # config.navigational_formats = ['*/*', :html]
246
+
247
+ # The default HTTP method used to sign out a resource. Default is :delete.
248
+ config.sign_out_via = :delete
249
+
250
+ # ==> OmniAuth
251
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
252
+ # up on your models and hooks.
253
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
254
+
255
+ # ==> Warden configuration
256
+ # 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.
258
+ #
259
+ # config.warden do |manager|
260
+ # manager.intercept_401 = false
261
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
262
+ # end
263
+
264
+ # ==> 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:
268
+ #
269
+ # mount MyEngine, at: '/my_engine'
270
+ #
271
+ # The router that invoked `devise_for`, in the example above, would be:
272
+ config.router_name = :decidim
273
+ #
274
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
275
+ # so you need to do it manually. For the users scope, it would be:
276
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
277
+ end
@@ -0,0 +1,62 @@
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
+ password_change:
27
+ subject: "Password Changed"
28
+ omniauth_callbacks:
29
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
30
+ success: "Successfully authenticated from %{kind} account."
31
+ passwords:
32
+ 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."
33
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
34
+ 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."
35
+ updated: "Your password has been changed successfully. You are now signed in."
36
+ updated_not_active: "Your password has been changed successfully."
37
+ registrations:
38
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
39
+ signed_up: "Welcome! You have signed up successfully."
40
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
41
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
42
+ 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."
43
+ 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."
44
+ updated: "Your account has been updated successfully."
45
+ sessions:
46
+ signed_in: "Signed in successfully."
47
+ signed_out: "Signed out successfully."
48
+ already_signed_out: "Signed out successfully."
49
+ unlocks:
50
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
51
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
52
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
53
+ errors:
54
+ messages:
55
+ already_confirmed: "was already confirmed, please try signing in"
56
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
57
+ expired: "has expired, please request a new one"
58
+ not_found: "not found"
59
+ not_locked: "was not locked"
60
+ not_saved:
61
+ one: "1 error prohibited this %{resource} from being saved:"
62
+ other: "%{count} errors prohibited this %{resource} from being saved:"
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ Decidim::Core::Engine.routes.draw do
3
+ devise_for :users, class_name: "Decidim::User", module: :devise
4
+ root to: "home#show"
5
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+ class DeviseCreateDecidimUsers < ActiveRecord::Migration[5.0]
3
+ def change
4
+ create_table :decidim_users do |t|
5
+ ## Database authenticatable
6
+ t.string :email, null: false, default: ""
7
+ t.string :encrypted_password, null: false, default: ""
8
+
9
+ ## Recoverable
10
+ t.string :reset_password_token
11
+ t.datetime :reset_password_sent_at
12
+
13
+ ## Rememberable
14
+ t.datetime :remember_created_at
15
+
16
+ ## Trackable
17
+ t.integer :sign_in_count, default: 0, null: false
18
+ t.datetime :current_sign_in_at
19
+ t.datetime :last_sign_in_at
20
+ t.string :current_sign_in_ip
21
+ t.string :last_sign_in_ip
22
+
23
+ ## Confirmable
24
+ # t.string :confirmation_token
25
+ # t.datetime :confirmed_at
26
+ # t.datetime :confirmation_sent_at
27
+ # t.string :unconfirmed_email # Only if using reconfirmable
28
+
29
+ ## Lockable
30
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
31
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
32
+ # t.datetime :locked_at
33
+
34
+ t.timestamps null: false
35
+ end
36
+
37
+ add_index :decidim_users, :email, unique: true
38
+ add_index :decidim_users, :reset_password_token, unique: true
39
+ # add_index :decidim_users, :confirmation_token, unique: true
40
+ # add_index :decidim_users, :unlock_token, unique: true
41
+ end
42
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ require "rails"
3
+ require "active_support/all"
4
+
5
+ module Decidim
6
+ module Core
7
+ # Decidim's core Rails Engine.
8
+ class Engine < ::Rails::Engine
9
+ isolate_namespace Decidim
10
+ engine_name "decidim"
11
+
12
+ initializer "decidim.action_controller" do |_app|
13
+ ActiveSupport.on_load :action_controller do
14
+ helper Decidim::LayoutHelper
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+ # This holds Decidim's version and the Rails version on which it depends.
3
+ module Decidim
4
+ def self.version
5
+ "0.0.1.alpha1"
6
+ end
7
+
8
+ def self.rails_version
9
+ "~> 5.0.0"
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ require "decidim/core/engine"
3
+ require "decidim/core/version"
4
+ require "devise"
5
+
6
+ # Decidim configuration.
7
+ module Decidim
8
+ @config = OpenStruct.new
9
+
10
+ def self.setup
11
+ yield(@config)
12
+ end
13
+
14
+ def self.config
15
+ @config
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ require_relative "../../../../decidim-core/lib/generators/decidim/dummy_generator"
3
+
4
+ desc "Generates a dummy app for testing"
5
+ namespace :common do
6
+ task :test_app do |_t, _args|
7
+ Decidim::Generators::DummyGenerator.start [
8
+ "--lib_name=#{ENV["LIB_NAME"]}",
9
+ "--migrate=true",
10
+ "--quiet"
11
+ ]
12
+ end
13
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ require "rails/generators"
3
+ require_relative "../../../../lib/generators/decidim/app_generator"
4
+
5
+ module Decidim
6
+ module Generators
7
+ # Generates a dummy test Rails app for the given library folder. It uses
8
+ # the `AppGenerator` class to actually generate the Rails app, so this
9
+ # generator only sets the path and some flags.
10
+ #
11
+ # The Rails app will be installed with some flags to disable git, tests,
12
+ # Gemfile and other options. Refer to the `create_dummy_app` method to see
13
+ # all the flags passed to the `AppGenerator` class, which is the one that
14
+ # actually generates the Rails app.
15
+ #
16
+ # Remember that, for how generators work, actions are executed based on the
17
+ # definition order of the public methods.
18
+ class DummyGenerator < Rails::Generators::Base
19
+ desc "Generate dummy app for testing purposes"
20
+
21
+ class_option :lib_name, type: :string,
22
+ desc: "The library where the dummy app will be installed"
23
+
24
+ class_option :migrate, type: :boolean, default: false,
25
+ desc: "Run migrations after installing decidim"
26
+
27
+ def cleanup
28
+ remove_directory_if_exists(dummy_path)
29
+ end
30
+
31
+ def create_dummy_app
32
+ Decidim::Generators::AppGenerator.start [
33
+ dummy_path,
34
+ "--skip_gemfile",
35
+ "--skip-bundle",
36
+ "--skip-git",
37
+ "--skip-keeps",
38
+ "--skip-test",
39
+ "--migrate=#{options[:migrate]}"
40
+ ]
41
+ end
42
+
43
+ private
44
+
45
+ def dummy_path
46
+ ENV["DUMMY_PATH"] || "spec/#{short_lib_name}_dummy"
47
+ end
48
+
49
+ def remove_directory_if_exists(path)
50
+ remove_dir(path) if File.directory?(path)
51
+ end
52
+
53
+ def short_lib_name
54
+ options[:lib_name].split("/").last
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+ require "rails/generators/base"
3
+ require "securerandom"
4
+
5
+ module Decidim
6
+ module Generators
7
+ # Installs `decidim` to a Rails app by adding the needed lines of code
8
+ # automatically to important files in the Rails app.
9
+ #
10
+ # Remember that, for how generators work, actions are executed based on the
11
+ # definition order of the public methods.
12
+ class InstallGenerator < Rails::Generators::Base
13
+ desc "Install decidim"
14
+ source_root File.expand_path("../templates", __FILE__)
15
+
16
+ class_option :migrate, type: :boolean, default: false,
17
+ desc: "Run migrations after installing decidim"
18
+
19
+ def install
20
+ route "mount Decidim::Core::Engine => '/'"
21
+ end
22
+
23
+ def copy_migrations
24
+ rake "railties:install:migrations"
25
+ prepare_database if options[:migrate]
26
+ end
27
+
28
+ def add_seeds
29
+ append_file "db/seeds.rb", "Decidim::Core::Engine.load_seed"
30
+ end
31
+
32
+ def copy_initializer
33
+ template "initializer.rb", "config/initializers/decidim.rb"
34
+ end
35
+
36
+ def insert_into_layout
37
+ inject_into_file "app/views/layouts/application.html.erb",
38
+ before: "</head>" do
39
+ " <%= render partial: 'layouts/decidim/meta' %>\n "
40
+ end
41
+
42
+ inject_into_file "app/views/layouts/application.html.erb",
43
+ after: "<body>" do
44
+ "\n <%= render partial: 'layouts/decidim/header' %>"
45
+ end
46
+
47
+ inject_into_file "app/views/layouts/application.html.erb",
48
+ before: "</body>" do
49
+ " <%= render partial: 'layouts/decidim/footer' %>\n "
50
+ end
51
+ end
52
+
53
+ def replace_title
54
+ gsub_file "app/views/layouts/application.html.erb",
55
+ %r{<title>(.*)</title>},
56
+ "<title><%= decidim_page_title %></title>"
57
+ end
58
+
59
+ def append_assets
60
+ append_file "app/assets/javascripts/application.js", "//= require decidim"
61
+ inject_into_file "app/assets/stylesheets/application.css",
62
+ before: "*= require_tree ." do
63
+ "*= require decidim\n "
64
+ end
65
+ end
66
+
67
+ private
68
+
69
+ def prepare_database
70
+ rake "db:drop"
71
+ rake "db:create"
72
+ rake "db:migrate"
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ Decidim.setup do |config|
3
+ config.application_name = "My Application Name"
4
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ # desc "Explaining what the task does"
3
+ # task :decidim do
4
+ # # Task goes here
5
+ # end
6
+
7
+ namespace :decidim do
8
+ task upgrade: ["railties:install:migrations"]
9
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: decidim-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha1
5
+ platform: ruby
6
+ authors:
7
+ - Josep Jaume Rey Peroy
8
+ - Marc Riera Casals
9
+ - Oriol Gual Oliva
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2016-09-16 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rails
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: 5.0.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: 5.0.0
29
+ - !ruby/object:Gem::Dependency
30
+ name: devise
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ description: Adds core features so other engines can hook into the framework.
44
+ email:
45
+ - josepjaume@gmail.com
46
+ - mrc2407@gmail.com
47
+ - oriolgual@gmail.com
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - MIT-LICENSE
53
+ - README.md
54
+ - Rakefile
55
+ - app/assets/javascripts/decidim.js
56
+ - app/assets/stylesheets/decidim.css
57
+ - app/controllers/decidim/application_controller.rb
58
+ - app/controllers/decidim/home_controller.rb
59
+ - app/helpers/decidim/application_helper.rb
60
+ - app/helpers/decidim/layout_helper.rb
61
+ - app/jobs/decidim/application_job.rb
62
+ - app/mailers/decidim/application_mailer.rb
63
+ - app/models/decidim/application_record.rb
64
+ - app/models/decidim/user.rb
65
+ - app/views/decidim/home/show.html.erb
66
+ - app/views/layouts/decidim/_footer.html.erb
67
+ - app/views/layouts/decidim/_header.html.erb
68
+ - app/views/layouts/decidim/_meta.html.erb
69
+ - config/initializers/devise.rb
70
+ - config/locales/devise.en.yml
71
+ - config/routes.rb
72
+ - db/migrate/20160817115213_devise_create_decidim_users.rb
73
+ - lib/decidim/core.rb
74
+ - lib/decidim/core/engine.rb
75
+ - lib/decidim/core/version.rb
76
+ - lib/decidim/testing_support/common_rake.rb
77
+ - lib/generators/decidim/dummy_generator.rb
78
+ - lib/generators/decidim/install_generator.rb
79
+ - lib/generators/decidim/templates/initializer.rb
80
+ - lib/tasks/decidim_tasks.rake
81
+ homepage: ''
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">"
97
+ - !ruby/object:Gem::Version
98
+ version: 1.3.1
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.5.1
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: The core of the Decidim framework.
105
+ test_files: []