arcadex 1.1.3 → 1.2.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.
- checksums.yaml +4 -4
- data/db/migrate/20141020173616_add_max_uses_to_arcadex_tokens.rb +5 -0
- data/lib/arcadex/authentication.rb +45 -51
- data/lib/arcadex/create.rb +2 -1
- data/lib/arcadex/header.rb +8 -21
- data/lib/arcadex/version.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +2 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +15 -0
- data/test/dummy/log/test.log +35 -0
- data/test/test_app/Gemfile +77 -0
- data/test/test_app/Gemfile.lock +281 -0
- data/test/test_app/README.md +1 -0
- data/test/test_app/Rakefile +6 -0
- data/test/test_app/app/admin/arcadex_token.rb +94 -0
- data/test/test_app/app/admin/dashboard.rb +69 -0
- data/test/test_app/app/admin/defcon_admin_user.rb +99 -0
- data/test/test_app/app/admin/people_user.rb +83 -0
- data/test/test_app/app/assets/javascripts/active_admin.js.coffee +1 -0
- data/test/test_app/app/assets/javascripts/application.js +16 -0
- data/test/test_app/app/assets/stylesheets/active_admin.css.scss +17 -0
- data/test/test_app/app/assets/stylesheets/application.css +13 -0
- data/test/test_app/app/controllers/api/v1/api_controller.rb +71 -0
- data/test/test_app/app/controllers/app_index_controller.rb +4 -0
- data/test/test_app/app/controllers/application_controller.rb +21 -0
- data/test/test_app/app/helpers/application_helper.rb +2 -0
- data/test/test_app/app/views/app_index/app.html.erb +0 -0
- data/test/test_app/app/views/layouts/app_index.html.erb +9 -0
- data/test/test_app/app/views/layouts/application.html.erb +14 -0
- data/test/test_app/bin/bundle +3 -0
- data/test/test_app/bin/rails +4 -0
- data/test/test_app/bin/rake +4 -0
- data/test/test_app/config.ru +4 -0
- data/test/test_app/config/application.rb +27 -0
- data/test/test_app/config/boot.rb +4 -0
- data/test/test_app/config/database.yml +25 -0
- data/test/test_app/config/environment.rb +5 -0
- data/test/test_app/config/environments/development.rb +29 -0
- data/test/test_app/config/environments/production.rb +80 -0
- data/test/test_app/config/environments/test.rb +36 -0
- data/test/test_app/config/initializers/active_admin.rb +252 -0
- data/test/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/test_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/test_app/config/initializers/inflections.rb +16 -0
- data/test/test_app/config/initializers/mime_types.rb +5 -0
- data/test/test_app/config/initializers/secret_token.rb +12 -0
- data/test/test_app/config/initializers/session_store.rb +3 -0
- data/test/test_app/config/initializers/wrap_parameters.rb +14 -0
- data/test/test_app/config/locales/en.yml +23 -0
- data/test/test_app/config/routes.rb +66 -0
- data/test/test_app/config/schedule.rb +20 -0
- data/test/test_app/db/development.sqlite3 +0 -0
- data/test/test_app/db/migrate/20141016225515_create_active_admin_comments.rb +19 -0
- data/test/test_app/db/migrate/20141016225555_create_people_users.people.rb +14 -0
- data/test/test_app/db/migrate/20141016225556_create_arcadex_tokens.arcadex.rb +12 -0
- data/test/test_app/db/migrate/20141016225557_add_index_to_token.arcadex.rb +6 -0
- data/test/test_app/db/migrate/20141016225558_add_first_ip_address_to_arcadex_tokens.arcadex.rb +6 -0
- data/test/test_app/db/migrate/20141016225559_add_current_ip_address_to_arcadex_tokens.arcadex.rb +6 -0
- data/test/test_app/db/migrate/20141016225560_add_times_used_to_arcadex_tokens.arcadex.rb +6 -0
- data/test/test_app/db/migrate/20141016225561_add_expiration_minutes_to_arcadex_tokens.arcadex.rb +6 -0
- data/test/test_app/db/migrate/20141016225562_create_defcon_admin_users.defcon.rb +16 -0
- data/test/test_app/db/migrate/20141016225563_add_index_to_defcon_admin_users.defcon.rb +6 -0
- data/test/test_app/db/migrate/20141016225564_add_email_to_defcon_admin_users.defcon.rb +7 -0
- data/test/test_app/db/migrate/20141020173805_add_max_uses_to_arcadex_tokens.arcadex.rb +6 -0
- data/test/test_app/db/production.sqlite3 +0 -0
- data/test/test_app/db/schema.rb +73 -0
- data/test/test_app/db/seeds.rb +10 -0
- data/test/test_app/db/test.sqlite3 +0 -0
- data/test/test_app/engines/people/Gemfile +14 -0
- data/test/test_app/engines/people/Gemfile.lock +81 -0
- data/test/test_app/engines/people/MIT-LICENSE +20 -0
- data/test/test_app/engines/people/README.md +1 -0
- data/test/test_app/engines/people/Rakefile +34 -0
- data/test/test_app/engines/people/app/assets/javascripts/people/application.js +13 -0
- data/test/test_app/engines/people/app/assets/javascripts/people/users.js +2 -0
- data/test/test_app/engines/people/app/assets/stylesheets/people/application.css +13 -0
- data/test/test_app/engines/people/app/assets/stylesheets/people/users.css +4 -0
- data/test/test_app/engines/people/app/assets/stylesheets/scaffold.css +56 -0
- data/test/test_app/engines/people/app/controllers/people/api/v1/application_controller.rb +5 -0
- data/test/test_app/engines/people/app/controllers/people/api/v1/users_controller.rb +169 -0
- data/test/test_app/engines/people/app/controllers/people/application_controller.rb +4 -0
- data/test/test_app/engines/people/app/controllers/people/users_controller.rb +62 -0
- data/test/test_app/engines/people/app/helpers/people/application_helper.rb +4 -0
- data/test/test_app/engines/people/app/helpers/people/users_helper.rb +4 -0
- data/test/test_app/engines/people/app/models/people/user.rb +9 -0
- data/test/test_app/engines/people/app/models/people/v1/user.rb +32 -0
- data/test/test_app/engines/people/app/serializers/people/v1/user_serializer.rb +43 -0
- data/test/test_app/engines/people/app/views/layouts/people/default/application.html.erb +14 -0
- data/test/test_app/engines/people/app/views/people/users/_form.html.erb +29 -0
- data/test/test_app/engines/people/app/views/people/users/edit.html.erb +6 -0
- data/test/test_app/engines/people/app/views/people/users/index.html.erb +31 -0
- data/test/test_app/engines/people/app/views/people/users/new.html.erb +5 -0
- data/test/test_app/engines/people/app/views/people/users/show.html.erb +19 -0
- data/test/test_app/engines/people/bin/rails +12 -0
- data/test/test_app/engines/people/config/routes.rb +28 -0
- data/test/test_app/engines/people/db/migrate/20141016225548_create_people_users.rb +13 -0
- data/test/test_app/engines/people/lib/people.rb +4 -0
- data/test/test_app/engines/people/lib/people/engine.rb +5 -0
- data/test/test_app/engines/people/lib/people/version.rb +3 -0
- data/test/test_app/engines/people/lib/tasks/people_tasks.rake +4 -0
- data/test/test_app/engines/people/people.gemspec +33 -0
- data/test/test_app/engines/people/test/controllers/people/users_controller_test.rb +51 -0
- data/test/test_app/engines/people/test/dummy/README.rdoc +28 -0
- data/test/test_app/engines/people/test/dummy/Rakefile +6 -0
- data/test/test_app/engines/people/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/test_app/engines/people/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/test_app/engines/people/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/test_app/engines/people/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/test_app/engines/people/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/test_app/engines/people/test/dummy/bin/bundle +3 -0
- data/test/test_app/engines/people/test/dummy/bin/rails +4 -0
- data/test/test_app/engines/people/test/dummy/bin/rake +4 -0
- data/test/test_app/engines/people/test/dummy/config.ru +4 -0
- data/test/test_app/engines/people/test/dummy/config/application.rb +23 -0
- data/test/test_app/engines/people/test/dummy/config/boot.rb +5 -0
- data/test/test_app/engines/people/test/dummy/config/database.yml +25 -0
- data/test/test_app/engines/people/test/dummy/config/environment.rb +5 -0
- data/test/test_app/engines/people/test/dummy/config/environments/development.rb +29 -0
- data/test/test_app/engines/people/test/dummy/config/environments/production.rb +80 -0
- data/test/test_app/engines/people/test/dummy/config/environments/test.rb +36 -0
- data/test/test_app/engines/people/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/test_app/engines/people/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/test_app/engines/people/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/test_app/engines/people/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/test_app/engines/people/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/test_app/engines/people/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/test_app/engines/people/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/test_app/engines/people/test/dummy/config/locales/en.yml +23 -0
- data/test/test_app/engines/people/test/dummy/config/routes.rb +4 -0
- data/test/test_app/engines/people/test/dummy/public/404.html +58 -0
- data/test/test_app/engines/people/test/dummy/public/422.html +58 -0
- data/test/test_app/engines/people/test/dummy/public/500.html +57 -0
- data/test/test_app/engines/people/test/dummy/public/favicon.ico +0 -0
- data/test/test_app/engines/people/test/fixtures/people/users.yml +11 -0
- data/test/test_app/engines/people/test/helpers/people/users_helper_test.rb +6 -0
- data/test/test_app/engines/people/test/integration/navigation_test.rb +10 -0
- data/test/test_app/engines/people/test/models/people/user_test.rb +9 -0
- data/test/test_app/engines/people/test/people_test.rb +7 -0
- data/test/test_app/engines/people/test/test_helper.rb +15 -0
- data/test/test_app/gems/authorization/Gemfile +14 -0
- data/test/test_app/gems/authorization/Gemfile.lock +81 -0
- data/test/test_app/gems/authorization/MIT-LICENSE +20 -0
- data/test/test_app/gems/authorization/README.rdoc +3 -0
- data/test/test_app/gems/authorization/Rakefile +32 -0
- data/test/test_app/gems/authorization/authorization.gemspec +22 -0
- data/test/test_app/gems/authorization/lib/authorization.rb +4 -0
- data/test/test_app/gems/authorization/lib/authorization/people/v1/user.rb +90 -0
- data/test/test_app/gems/authorization/lib/authorization/version.rb +3 -0
- data/test/test_app/gems/authorization/lib/tasks/authorization_tasks.rake +4 -0
- data/test/test_app/gems/authorization/test/authorization_test.rb +7 -0
- data/test/test_app/gems/authorization/test/dummy/README.rdoc +28 -0
- data/test/test_app/gems/authorization/test/dummy/Rakefile +6 -0
- data/test/test_app/gems/authorization/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/test_app/gems/authorization/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/test_app/gems/authorization/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/test_app/gems/authorization/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/test_app/gems/authorization/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/test_app/gems/authorization/test/dummy/bin/bundle +3 -0
- data/test/test_app/gems/authorization/test/dummy/bin/rails +4 -0
- data/test/test_app/gems/authorization/test/dummy/bin/rake +4 -0
- data/test/test_app/gems/authorization/test/dummy/config.ru +4 -0
- data/test/test_app/gems/authorization/test/dummy/config/application.rb +23 -0
- data/test/test_app/gems/authorization/test/dummy/config/boot.rb +5 -0
- data/test/test_app/gems/authorization/test/dummy/config/database.yml +25 -0
- data/test/test_app/gems/authorization/test/dummy/config/environment.rb +5 -0
- data/test/test_app/gems/authorization/test/dummy/config/environments/development.rb +29 -0
- data/test/test_app/gems/authorization/test/dummy/config/environments/production.rb +80 -0
- data/test/test_app/gems/authorization/test/dummy/config/environments/test.rb +36 -0
- data/test/test_app/gems/authorization/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/test_app/gems/authorization/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/test_app/gems/authorization/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/test_app/gems/authorization/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/test_app/gems/authorization/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/test_app/gems/authorization/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/test_app/gems/authorization/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/test_app/gems/authorization/test/dummy/config/locales/en.yml +23 -0
- data/test/test_app/gems/authorization/test/dummy/config/routes.rb +56 -0
- data/test/test_app/gems/authorization/test/dummy/public/404.html +58 -0
- data/test/test_app/gems/authorization/test/dummy/public/422.html +58 -0
- data/test/test_app/gems/authorization/test/dummy/public/500.html +57 -0
- data/test/test_app/gems/authorization/test/dummy/public/favicon.ico +0 -0
- data/test/test_app/gems/authorization/test/test_helper.rb +15 -0
- data/test/test_app/log/development.log +79 -0
- data/test/test_app/log/production.log +12 -0
- data/test/test_app/log/test.log +13884 -0
- data/test/test_app/public/404.html +58 -0
- data/test/test_app/public/422.html +58 -0
- data/test/test_app/public/500.html +57 -0
- data/test/test_app/public/favicon.ico +0 -0
- data/test/test_app/public/robots.txt +5 -0
- data/test/test_app/spec/controllers/app_index_controller_spec.rb +12 -0
- data/test/test_app/spec/engines/people/api/v1/models/user_spec.rb +61 -0
- data/test/test_app/spec/engines/people/api/v1/requests/user_spec.rb +244 -0
- data/test/test_app/spec/engines/people/api/v1/routing/user_spec.rb +91 -0
- data/test/test_app/spec/factories/people_user_1_factory.rb +14 -0
- data/test/test_app/spec/rails_helper.rb +47 -0
- data/test/test_app/spec/spec_helper.rb +78 -0
- data/test/test_app/spec/support/factory_girl.rb +16 -0
- data/test/test_app/spec/support/request_helpers.rb +7 -0
- metadata +381 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require 'authorization'
|
|
2
|
+
|
|
3
|
+
module People
|
|
4
|
+
class V1::UserSerializer < ActiveModel::Serializer
|
|
5
|
+
embed :ids, include: true
|
|
6
|
+
|
|
7
|
+
attributes :id
|
|
8
|
+
attributes :username
|
|
9
|
+
attributes :email
|
|
10
|
+
attributes :created_at
|
|
11
|
+
attributes :updated_at
|
|
12
|
+
|
|
13
|
+
has_many :tokens
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def include_id?
|
|
17
|
+
return ::Authorization::People::V1::User.include_id?(current_user,object,@options)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def include_email?
|
|
21
|
+
return ::Authorization::People::V1::User.include_email?(current_user,object,@options)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def include_username?
|
|
25
|
+
return ::Authorization::People::V1::User.include_username?(current_user,object,@options)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def include_created_at?
|
|
29
|
+
return ::Authorization::People::V1::User.include_created_at?(current_user,object,@options)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def include_updated_at?
|
|
33
|
+
return ::Authorization::People::V1::User.include_updated_at?(current_user,object,@options)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def include_associations!
|
|
37
|
+
|
|
38
|
+
include! :tokens if ::Authorization::People::V1::User.include_tokens?(current_user,object,@options)
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>People</title>
|
|
5
|
+
<%= stylesheet_link_tag "people/application", media: "all" %>
|
|
6
|
+
<%= javascript_include_tag "people/application" %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<%= form_for(@user) do |f| %>
|
|
2
|
+
<% if @user.errors.any? %>
|
|
3
|
+
<div id="error_explanation">
|
|
4
|
+
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
|
5
|
+
|
|
6
|
+
<ul>
|
|
7
|
+
<% @user.errors.full_messages.each do |msg| %>
|
|
8
|
+
<li><%= msg %></li>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<div class="field">
|
|
15
|
+
<%= f.label :username %><br>
|
|
16
|
+
<%= f.text_field :username %>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="field">
|
|
19
|
+
<%= f.label :email %><br>
|
|
20
|
+
<%= f.text_field :email %>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="field">
|
|
23
|
+
<%= f.label :password_digest %><br>
|
|
24
|
+
<%= f.text_field :password_digest %>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="actions">
|
|
27
|
+
<%= f.submit %>
|
|
28
|
+
</div>
|
|
29
|
+
<% end %>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<h1>Listing users</h1>
|
|
2
|
+
|
|
3
|
+
<table>
|
|
4
|
+
<thead>
|
|
5
|
+
<tr>
|
|
6
|
+
<th>Username</th>
|
|
7
|
+
<th>Email</th>
|
|
8
|
+
<th>Password digest</th>
|
|
9
|
+
<th></th>
|
|
10
|
+
<th></th>
|
|
11
|
+
<th></th>
|
|
12
|
+
</tr>
|
|
13
|
+
</thead>
|
|
14
|
+
|
|
15
|
+
<tbody>
|
|
16
|
+
<% @users.each do |user| %>
|
|
17
|
+
<tr>
|
|
18
|
+
<td><%= user.username %></td>
|
|
19
|
+
<td><%= user.email %></td>
|
|
20
|
+
<td><%= user.password_digest %></td>
|
|
21
|
+
<td><%= link_to 'Show', user %></td>
|
|
22
|
+
<td><%= link_to 'Edit', edit_user_path(user) %></td>
|
|
23
|
+
<td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
24
|
+
</tr>
|
|
25
|
+
<% end %>
|
|
26
|
+
</tbody>
|
|
27
|
+
</table>
|
|
28
|
+
|
|
29
|
+
<br>
|
|
30
|
+
|
|
31
|
+
<%= link_to 'New User', new_user_path %>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<p>
|
|
4
|
+
<strong>Username:</strong>
|
|
5
|
+
<%= @user.username %>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p>
|
|
9
|
+
<strong>Email:</strong>
|
|
10
|
+
<%= @user.email %>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p>
|
|
14
|
+
<strong>Password digest:</strong>
|
|
15
|
+
<%= @user.password_digest %>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<%= link_to 'Edit', edit_user_path(@user) %> |
|
|
19
|
+
<%= link_to 'Back', users_path %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
|
3
|
+
|
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/people/engine', __FILE__)
|
|
6
|
+
|
|
7
|
+
# Set up gems listed in the Gemfile.
|
|
8
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
|
9
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
|
10
|
+
|
|
11
|
+
require 'rails/all'
|
|
12
|
+
require 'rails/engine/commands'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
People::Engine.routes.draw do
|
|
2
|
+
|
|
3
|
+
root to: "users#index"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
scope 'api' do
|
|
8
|
+
scope '1' do
|
|
9
|
+
resources :users, controller: 'api/v1/users' do
|
|
10
|
+
|
|
11
|
+
collection do
|
|
12
|
+
# /api/1/users/register
|
|
13
|
+
post 'register', to: "api/v1/users#register"
|
|
14
|
+
# /api/1/users/login
|
|
15
|
+
post 'login', to: "api/v1/users#login"
|
|
16
|
+
# /api/1/users/logout
|
|
17
|
+
post 'logout', to: "api/v1/users#logout"
|
|
18
|
+
# /api/1/users/logout
|
|
19
|
+
post 'authenticate/:id', to: "api/v1/users#authenticate"
|
|
20
|
+
# /api/1/users/login_status
|
|
21
|
+
get 'login_status', to: "api/v1/users#login_status"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class CreatePeopleUsers < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :people_users do |t|
|
|
4
|
+
t.string :username
|
|
5
|
+
t.string :email
|
|
6
|
+
t.string :password_digest
|
|
7
|
+
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
add_index :people_users, :username, unique: true
|
|
11
|
+
add_index :people_users, :email, unique: true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
2
|
+
|
|
3
|
+
# Maintain your gem's version:
|
|
4
|
+
require "people/version"
|
|
5
|
+
|
|
6
|
+
# Describe your gem and declare its dependencies:
|
|
7
|
+
Gem::Specification.new do |s|
|
|
8
|
+
s.name = "people"
|
|
9
|
+
s.version = People::VERSION
|
|
10
|
+
s.authors = ["TODO: Your name"]
|
|
11
|
+
s.email = ["TODO: Your email"]
|
|
12
|
+
s.homepage = "TODO"
|
|
13
|
+
s.summary = "TODO: Summary of People."
|
|
14
|
+
s.description = "TODO: Description of People."
|
|
15
|
+
|
|
16
|
+
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
|
17
|
+
s.test_files = Dir["test/**/*"]
|
|
18
|
+
|
|
19
|
+
s.add_development_dependency "json_voorhees"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
s.add_dependency "rails-api"
|
|
23
|
+
s.add_dependency "type_cartographer"
|
|
24
|
+
s.add_dependency "arcadex"
|
|
25
|
+
s.add_dependency "active_model_serializers", "~> 0.8.0"
|
|
26
|
+
s.add_dependency "bcrypt", "~> 3.1.7"
|
|
27
|
+
s.add_development_dependency "annotate", ">=2.6.0"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
s.add_dependency "rails", "~> 4.0.4"
|
|
31
|
+
|
|
32
|
+
s.add_development_dependency "sqlite3"
|
|
33
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
module People
|
|
4
|
+
class UsersControllerTest < ActionController::TestCase
|
|
5
|
+
setup do
|
|
6
|
+
@user = users(:one)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
test "should get index" do
|
|
10
|
+
get :index
|
|
11
|
+
assert_response :success
|
|
12
|
+
assert_not_nil assigns(:users)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
test "should get new" do
|
|
16
|
+
get :new
|
|
17
|
+
assert_response :success
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
test "should create user" do
|
|
21
|
+
assert_difference('User.count') do
|
|
22
|
+
post :create, user: { email: @user.email, password_digest: @user.password_digest, username: @user.username }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
assert_redirected_to user_path(assigns(:user))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
test "should show user" do
|
|
29
|
+
get :show, id: @user
|
|
30
|
+
assert_response :success
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
test "should get edit" do
|
|
34
|
+
get :edit, id: @user
|
|
35
|
+
assert_response :success
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
test "should update user" do
|
|
39
|
+
patch :update, id: @user, user: { email: @user.email, password_digest: @user.password_digest, username: @user.username }
|
|
40
|
+
assert_redirected_to user_path(assigns(:user))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
test "should destroy user" do
|
|
44
|
+
assert_difference('User.count', -1) do
|
|
45
|
+
delete :destroy, id: @user
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
assert_redirected_to users_path
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
== README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
|
28
|
+
<tt>rake doc:app</tt>.
|
|
@@ -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 vendor/assets/javascripts of plugins, if any, 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.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require_tree .
|
|
@@ -0,0 +1,13 @@
|
|
|
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 vendor/assets/stylesheets of plugins, if any, 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 top of the
|
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
+
*
|
|
11
|
+
*= require_self
|
|
12
|
+
*= require_tree .
|
|
13
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
require 'rails/all'
|
|
4
|
+
|
|
5
|
+
Bundler.require(*Rails.groups)
|
|
6
|
+
require "people"
|
|
7
|
+
|
|
8
|
+
module Dummy
|
|
9
|
+
class Application < Rails::Application
|
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
11
|
+
# Application configuration should go into files in config/initializers
|
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
13
|
+
|
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
17
|
+
|
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
20
|
+
# config.i18n.default_locale = :de
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|