adva-user 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. data/lib/bundler/repository.rb +118 -0
  2. metadata +5 -35
  3. data/app/controllers/admin/base_controller_slice.rb +0 -5
  4. data/app/controllers/installations_controller_slice.rb +0 -9
  5. data/app/controllers/user/confirmations_controller.rb +0 -3
  6. data/app/controllers/user/passwords_controller.rb +0 -3
  7. data/app/controllers/user/registrations_controller.rb +0 -3
  8. data/app/controllers/user/sessions_controller.rb +0 -7
  9. data/app/controllers/user/unlocks_controller.rb +0 -3
  10. data/app/models/account_slice.rb +0 -4
  11. data/app/models/user.rb +0 -12
  12. data/app/views/layouts/admin/_header_slice.rb +0 -16
  13. data/app/views/layouts/user.rb +0 -2
  14. data/app/views/mailer/confirmation_instructions.html.erb +0 -5
  15. data/app/views/mailer/reset_password_instructions.html.erb +0 -8
  16. data/app/views/mailer/unlock_instructions.html.erb +0 -7
  17. data/app/views/user/confirmations/new.html.rb +0 -16
  18. data/app/views/user/form.rb +0 -67
  19. data/app/views/user/passwords/edit.html.rb +0 -18
  20. data/app/views/user/passwords/new.html.rb +0 -16
  21. data/app/views/user/registrations/edit.html.rb +0 -18
  22. data/app/views/user/registrations/new.html.rb +0 -18
  23. data/app/views/user/sessions/new.html.rb +0 -26
  24. data/app/views/user/unlocks/new.html.rb +0 -16
  25. data/config/locales/en.yml +0 -54
  26. data/config/routes.rb +0 -3
  27. data/lib/adva/user.rb +0 -42
  28. data/lib/adva-user.rb +0 -1
  29. data/lib/adva_user/version.rb +0 -3
  30. data/lib/testing/factories.rb +0 -11
  31. data/lib/testing/paths.rb +0 -14
  32. data/lib/testing/step_definitions.rb +0 -16
  33. data/public/stylesheets/adva-user/user.css +0 -30
@@ -0,0 +1,118 @@
1
+ require 'pathname'
2
+
3
+ # Bundler gemfile support for local/remote workspaces/repositories for work in
4
+ # development teams.
5
+ #
6
+ # Usage:
7
+ #
8
+ # # define paths to be searched for repositories:
9
+ # workspace '~/.projects ~/Development/{projects,work}'
10
+ #
11
+ # # define developer preferences for using local or remote repositories (uses ENV['user']):
12
+ # developer :sven, :prefer => :local
13
+ #
14
+ # # define repositories to be used for particular gems:
15
+ # adva_cms = repository('adva-cms2', :git => 'git@github.com:svenfuchs/adva-cms2.git', :ref => 'c2af0de')
16
+ # adva_shop = repository('adva-shop', :source => :local)
17
+ #
18
+ # # now use repositories to define gems:
19
+ # adva_cms.gem 'adva-core'
20
+ # adva_shop.gem 'adva-catalog'
21
+ #
22
+ # # The gem definition will now be proxied to Bundler with arguments according
23
+ # # to the setup defined earlier. E.g. as:
24
+ #
25
+ # gem 'adva-core', :path => 'Development/projects/adva-cms2/adva-core' # for developer 'sven'
26
+ # gem 'adva-core', :git => 'git@github.com:svenfuchs/adva-cms2.git', :ref => 'c2af0de' # for other developers
27
+ # gem 'adva-catalog', :path => 'Development/projects/adva-shop/adva-catalog' # for all developers
28
+ #
29
+ # One can also set an environment variable FORCE_REMOTE which will force remote
30
+ # repositories to be used *except* when a repository was defined with :source => :local
31
+ # which always forces the local repository to be used.
32
+ #
33
+ class Repository
34
+ class << self
35
+ def paths
36
+ @paths ||= []
37
+ end
38
+
39
+ def path(*paths)
40
+ paths.join(' ').split(' ').each do |path|
41
+ self.paths.concat(Pathname.glob(File.expand_path(path)))
42
+ end
43
+ end
44
+
45
+ def developer(name, preferences)
46
+ developers[name] = preferences
47
+ workspaces(preferences[:workspace])
48
+ end
49
+
50
+ def current_developer
51
+ developers[ENV['USER'].to_sym] || {}
52
+ end
53
+
54
+ def developers(developers = nil)
55
+ @developers ||= {}
56
+ end
57
+ end
58
+
59
+ class Gem < Array
60
+ def initialize(name, repository)
61
+ if repository.local?
62
+ sub_path = repository.path.join(name)
63
+ super([name, { :path => sub_path.exist? ? sub_path.to_s : repository.path.to_s }])
64
+ else
65
+ super([name, repository.options.dup])
66
+ end
67
+ end
68
+ end
69
+
70
+ attr_reader :bundler, :name, :options, :source
71
+
72
+ def initialize(bundler, name, options)
73
+ @bundler = bundler
74
+ @name = name
75
+ @source = options.delete(:source)
76
+ @options = options
77
+ end
78
+
79
+ def gem(name)
80
+ bundler.gem(*Gem.new(name, self))
81
+ end
82
+
83
+ def local?
84
+ source == :local # && path
85
+ end
86
+
87
+ def source
88
+ @source ||= forced_source || preferred_source || :remote
89
+ end
90
+
91
+ def forced_source
92
+ :remote if ENV['FORCE_REMOTE']
93
+ end
94
+
95
+ def preferred_source
96
+ self.class.current_developer[:prefer] || self.class.current_developer[name.to_sym]
97
+ end
98
+
99
+ def path
100
+ @path ||= begin
101
+ path = self.class.paths.detect { |path| path.join(name).exist? }
102
+ path ? path.join(name) : Pathname.new('.')
103
+ end
104
+ end
105
+ end
106
+
107
+ def workspace(*paths)
108
+ Repository.path(*paths)
109
+ end
110
+ alias :workspaces :workspace
111
+
112
+ def developer(name, preferences)
113
+ Repository.developer(name, preferences)
114
+ end
115
+
116
+ def repository(*args)
117
+ Repository.new(self, *args)
118
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adva-user
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ingo Weiss
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-08 00:00:00 +01:00
19
+ date: 2010-11-19 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -58,37 +58,7 @@ extensions: []
58
58
  extra_rdoc_files: []
59
59
 
60
60
  files:
61
- - app/controllers/user/passwords_controller.rb
62
- - app/controllers/user/sessions_controller.rb
63
- - app/controllers/user/unlocks_controller.rb
64
- - app/controllers/user/confirmations_controller.rb
65
- - app/controllers/user/registrations_controller.rb
66
- - app/controllers/installations_controller_slice.rb
67
- - app/controllers/admin/base_controller_slice.rb
68
- - app/views/layouts/user.rb
69
- - app/views/layouts/admin/_header_slice.rb
70
- - app/views/user/unlocks/new.html.rb
71
- - app/views/user/sessions/new.html.rb
72
- - app/views/user/passwords/edit.html.rb
73
- - app/views/user/passwords/new.html.rb
74
- - app/views/user/form.rb
75
- - app/views/user/confirmations/new.html.rb
76
- - app/views/user/registrations/edit.html.rb
77
- - app/views/user/registrations/new.html.rb
78
- - app/views/mailer/confirmation_instructions.html.erb
79
- - app/views/mailer/unlock_instructions.html.erb
80
- - app/views/mailer/reset_password_instructions.html.erb
81
- - app/models/user.rb
82
- - app/models/account_slice.rb
83
- - config/routes.rb
84
- - config/locales/en.yml
85
- - lib/adva-user.rb
86
- - lib/adva_user/version.rb
87
- - lib/adva/user.rb
88
- - lib/testing/factories.rb
89
- - lib/testing/paths.rb
90
- - lib/testing/step_definitions.rb
91
- - public/stylesheets/adva-user/user.css
61
+ - lib/bundler/repository.rb
92
62
  has_rdoc: true
93
63
  homepage: http://github.com/svenfuchs/adva-cms2
94
64
  licenses: []
@@ -1,5 +0,0 @@
1
- require 'admin/base_controller'
2
-
3
- Admin::BaseController.class_eval do
4
- before_filter :authenticate_user!
5
- end
@@ -1,9 +0,0 @@
1
- require 'installations_controller'
2
-
3
- InstallationsController.class_eval do
4
- before_filter :set_admin_params, :only => :create
5
-
6
- def set_admin_params
7
- params[:site][:account_attributes][:users_attributes] ||= [{ :email => 'admin@admin.org', :password => 'admin!' }]
8
- end
9
- end
@@ -1,3 +0,0 @@
1
- class User::ConfirmationsController < Devise::ConfirmationsController
2
- layout 'user'
3
- end
@@ -1,3 +0,0 @@
1
- class User::PasswordsController < Devise::PasswordsController
2
- layout 'user'
3
- end
@@ -1,3 +0,0 @@
1
- class User::RegistrationsController < Devise::RegistrationsController
2
- layout 'user'
3
- end
@@ -1,7 +0,0 @@
1
- class User::SessionsController < Devise::SessionsController
2
- layout 'user'
3
-
4
- def after_sign_in_path_for(resource)
5
- params[:return_to] || '/'
6
- end
7
- end
@@ -1,3 +0,0 @@
1
- class User::UnlocksController < Devise::UnlocksController
2
- layout 'user'
3
- end
@@ -1,4 +0,0 @@
1
- Account.class_eval do
2
- has_many :users, :dependent => :destroy
3
- accepts_nested_attributes_for :users
4
- end
data/app/models/user.rb DELETED
@@ -1,12 +0,0 @@
1
- require 'devise'
2
-
3
- class User < ActiveRecord::Base
4
- devise :database_authenticatable, :registerable, :rememberable, :confirmable,
5
- :recoverable, :validatable, :trackable
6
-
7
- serialize :roles, Array
8
-
9
- def roles
10
- read_attribute(:roles) || []
11
- end
12
- end
@@ -1,16 +0,0 @@
1
- require_dependency 'layouts/admin'
2
- require_dependency 'layouts/admin/_header'
3
-
4
- module Layouts::Admin::Header::User
5
- def right
6
- login_status
7
- super
8
- end
9
-
10
- def login_status
11
- link_to t('.sign_out', :user => current_user.email), destroy_user_session_path
12
- self << '&middot;'.html_safe
13
- end
14
-
15
- Layouts::Admin::Header.send(:include, self)
16
- end
@@ -1,2 +0,0 @@
1
- class Layouts::User < Layouts::Simple
2
- end
@@ -1,5 +0,0 @@
1
- <p>Welcome <%= @resource.email %>!</p>
2
-
3
- <p>You can confirm your account through the link below:</p>
4
-
5
- <p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
@@ -1,8 +0,0 @@
1
- <p>Hello <%= @resource.email %>!</p>
2
-
3
- <p>Someone has requested a link to change your password, and you can do this through the link below.</p>
4
-
5
- <p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
6
-
7
- <p>If you didn't request this, please ignore this email.</p>
8
- <p>Your password won't change until you access the link above and create a new one.</p>
@@ -1,7 +0,0 @@
1
- <p>Hello <%= @resource.email %>!</p>
2
-
3
- <p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
4
-
5
- <p>Click the link below to unlock your account:</p>
6
-
7
- <p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
@@ -1,16 +0,0 @@
1
- class User::Confirmations::New < User::Form
2
- include do
3
- def to_html
4
- h2 :'.title'
5
- super
6
- end
7
-
8
- def fields
9
- form.input :email
10
- end
11
-
12
- def form_arguments
13
- [resource, { :as => resource_name, :url => confirmation_path(resource_name) }]
14
- end
15
- end
16
- end
@@ -1,67 +0,0 @@
1
- class User::Form < Adva::View::Form
2
- include do
3
- def fields
4
- devise_error_messages!
5
- super
6
- end
7
-
8
- def button_group
9
- super
10
- links
11
- end
12
-
13
- def buttons
14
- form.submit t(:'.submit')
15
- end
16
-
17
- def links
18
- ul :class => 'links user' do
19
- li { sign_in_link } if sign_in?
20
- li { sign_up_link } if sign_up?
21
- li { forgot_password_link } if forgot_password?
22
- li { resend_confirmation_link } if resend_confirmation?
23
- li { resend_unlock_link } if resend_unlock?
24
- end
25
- end
26
-
27
- def sign_in?
28
- controller_name != 'sessions'
29
- end
30
-
31
- def sign_up?
32
- devise_mapping.registerable? && controller_name != 'registrations'
33
- end
34
-
35
- def forgot_password?
36
- devise_mapping.recoverable? && controller_name != 'passwords'
37
- end
38
-
39
- def resend_confirmation?
40
- devise_mapping.confirmable? && controller_name != 'confirmations'
41
- end
42
-
43
- def resend_unlock?
44
- devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
45
- end
46
-
47
- def sign_in_link
48
- capture { link_to(:'user.links.sign_in', new_session_path(resource_name), :class => :sign_in) }
49
- end
50
-
51
- def sign_up_link
52
- capture { link_to(:'user.links.sign_up', new_registration_path(resource_name), :class => :sign_up) }
53
- end
54
-
55
- def forgot_password_link
56
- capture { link_to(:'user.links.forgot_password', new_password_path(resource_name), :class => :forgot_password) }
57
- end
58
-
59
- def resend_confirmation_link
60
- capture { link_to(:'user.links.resend_confirmation', new_confirmation_path(resource_name), :class => :resend_confirmation) }
61
- end
62
-
63
- def resend_unlock_link
64
- capture { link_to(:'user.links.resend_unlock', new_unlock_path(resource_name), :class => :resend_unlock) }
65
- end
66
- end
67
- end
@@ -1,18 +0,0 @@
1
- class User::Passwords::Edit < User::Form
2
- include do
3
- def to_html
4
- h2 :'.title'
5
- super
6
- end
7
-
8
- def fields
9
- form.hidden_field :reset_password_token
10
- form.input :password
11
- form.input :password_confirmation
12
- end
13
-
14
- def form_arguments
15
- [resource, { :as => resource_name, :url => password_path(resource_name), :html => { :method => :put } }]
16
- end
17
- end
18
- end
@@ -1,16 +0,0 @@
1
- class User::Passwords::New < User::Form
2
- include do
3
- def to_html
4
- h2 :'.title'
5
- super
6
- end
7
-
8
- def fields
9
- form.input :email
10
- end
11
-
12
- def form_arguments
13
- [resource, { :as => resource_name, :url => password_path(resource_name) }]
14
- end
15
- end
16
- end
@@ -1,18 +0,0 @@
1
- class User::Registrations::Edit < User::Form
2
- include do
3
- def to_html
4
- h2 :'.title'
5
- super
6
- end
7
-
8
- def fields
9
- form.input :email
10
- form.input :password
11
- form.input :password_confirmation
12
- end
13
-
14
- def form_arguments
15
- [resource, { :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put } }]
16
- end
17
- end
18
- end
@@ -1,18 +0,0 @@
1
- class User::Registrations::New < User::Form
2
- include do
3
- def to_html
4
- h2 :'.title'
5
- super
6
- end
7
-
8
- def fields
9
- form.input :email
10
- form.input :password
11
- form.input :password_confirmation
12
- end
13
-
14
- def form_arguments
15
- [resource, { :as => resource_name, :url => registration_path(resource_name) }]
16
- end
17
- end
18
- end
@@ -1,26 +0,0 @@
1
- class User::Sessions::New < User::Form
2
- include do
3
- def to_html
4
- h2 :'.title'
5
- super
6
- end
7
-
8
- def fields
9
- pass_return_to
10
- form.input :email
11
- form.input :password
12
- remember_me if devise_mapping.rememberable?
13
- end
14
-
15
- def form_arguments
16
- [resource, { :as => resource_name, :url => session_path(resource_name) }]
17
- end
18
-
19
- def remember_me
20
- div :class => :checkbox_group do
21
- form.check_box :remember_me
22
- form.label :remember_me, :class => :inline
23
- end
24
- end
25
- end
26
- end
@@ -1,16 +0,0 @@
1
- class User::Unlocks::New < User::Form
2
- include do
3
- def to_html
4
- h2 :'.title'
5
- super
6
- end
7
-
8
- def fields
9
- form.input :email
10
- end
11
-
12
- def form_arguments
13
- [resource, { :as => resource_name, :url => unlock_path(resource_name) }]
14
- end
15
- end
16
- end
@@ -1,54 +0,0 @@
1
- en:
2
- user:
3
- links:
4
- sign_in: Sign in
5
- sign_up: Sign up
6
- forgot_password: Forgot password?
7
- resend_confirmation: Resend confirmation
8
- resend_unlock: Resend unlock
9
- sessions:
10
- new:
11
- title: Sign in
12
- submit: Sign in
13
- registrations:
14
- new:
15
- title: Sign up
16
- submit: Sign up
17
- edit:
18
- title: Edit account
19
- submit: Update account
20
- current_password_required: "We need your current password to confirm your changes."
21
- confirmations:
22
- new:
23
- title: Resend confirmation instructions
24
- submit: Resend instructions
25
- passwords:
26
- new:
27
- title: Forgot your password?
28
- submit: Send instructions
29
- edit:
30
- title: Change your password
31
- submit: Change password
32
- unlocks:
33
- new:
34
- title: Resend unlock instructions
35
- submit: Send instructions
36
-
37
- devise:
38
- session:
39
- user:
40
- signed_in: 'Signed in successfully.'
41
- signed_out: 'Signed out successfully.'
42
-
43
- layouts:
44
- default:
45
- signed_in_as: "Signed in as %{user}"
46
- sign_in: Sign in
47
- sign_up: Sign up
48
- sign_out: Sign out
49
-
50
- admin:
51
- header:
52
- sign_in: Sign in
53
- sign_up: Sign up
54
- sign_out: Sign out %{user}
data/config/routes.rb DELETED
@@ -1,3 +0,0 @@
1
- Rails.application.routes.draw do
2
- devise_for :user, :module => 'user'
3
- end
data/lib/adva/user.rb DELETED
@@ -1,42 +0,0 @@
1
- require 'adva/engine'
2
- require 'devise'
3
-
4
- module Adva
5
- class User < ::Rails::Engine
6
- include Adva::Engine
7
-
8
- # TODO should probably happen in the client app
9
- # for more devise options see http://bit.ly/bwxrGg
10
- initializer 'adva-user.devise_setup' do |app|
11
-
12
- # FIXME
13
- app.config.action_mailer.default_url_options = { :host => 'www.example.com' }
14
-
15
- Devise.setup do |config|
16
- require 'devise/orm/active_record'
17
- config.mailer_sender = 'please-change-me@config-initializers-devise.com'
18
- config.encryptor = :bcrypt
19
- config.password_length = 5..20
20
- end
21
-
22
- Devise::FailureApp.class_eval do
23
- def redirect
24
- flash[:alert] = i18n_message unless flash[:notice]
25
- redirect_to send(:"new_#{scope}_session_path", :return_to => attempted_path)
26
- end
27
- end
28
- end
29
-
30
- initializer 'adva-user.register_asset_expansions' do
31
- ActionView::Helpers::AssetTagHelper.register_javascript_expansion(
32
- :user => %w()
33
- )
34
-
35
- ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion(
36
- :user => %w( adva-core/default/forms
37
- adva-core/admin/common
38
- adva-user/user )
39
- )
40
- end
41
- end
42
- end
data/lib/adva-user.rb DELETED
@@ -1 +0,0 @@
1
- require 'adva/user'
@@ -1,3 +0,0 @@
1
- module AdvaUser
2
- VERSION = "0.0.2"
3
- end
@@ -1,11 +0,0 @@
1
- Factory.define :user, :class => User do |f|
2
- f.sequence(:email) { |n| "user-#{n}@example.com" }
3
- f.password 'password'
4
- f.after_build { |user| User.deactivate_callbacks }
5
- f.after_create { |user| user.confirm!; User.activate_callbacks }
6
- end
7
-
8
- Factory.define :admin, :parent => :user do |f|
9
- f.email 'admin@admin.org'
10
- f.password 'admin!'
11
- end
data/lib/testing/paths.rb DELETED
@@ -1,14 +0,0 @@
1
- module Adva::User::Paths
2
- def path_to(page)
3
- case page
4
- when /^the sign in page$/
5
- new_user_session_path
6
- when /^the new registration page$/
7
- new_user_registration_path
8
- else
9
- super
10
- end
11
- end
12
- end
13
-
14
- World(Adva::User::Paths)
@@ -1,16 +0,0 @@
1
- Given /^I am signed in with "([^"]*)" and "([^"]*)"$/ do |email, password|
2
- get new_user_session_path
3
- fill_in 'Email', :with => email
4
- fill_in 'Password', :with => password
5
- click_button 'Sign in'
6
- end
7
-
8
- Given /a confirmed user with email "([^"]+)" and password "([^"]+)"/ do |email, password|
9
- user = User.without_callbacks.create!(:email => email, :password => password)
10
- user.confirm!
11
- end
12
-
13
- Then 'I should be signed in' do
14
- When 'I go to the sign in page'
15
- Then 'I should be on the homepage'
16
- end
@@ -1,30 +0,0 @@
1
- body {
2
- font-size: 11pt;
3
- }
4
- #page {
5
- border-top: 5px solid #c22222;
6
- }
7
- .main {
8
- width: 400px;
9
- margin: 0 auto;
10
- padding-top: 0px;
11
- }
12
- #content {
13
- padding: 20px 30px 30px 30px;
14
- }
15
-
16
- .links {
17
- display: block !important;
18
- margin-top: 30px;
19
- }
20
- .links li:first-child:before {
21
- content: '';
22
- }
23
- .links .sign_in,
24
- .links .sign_up,
25
- .links .forgot_password,
26
- .links .resend_confirmation,
27
- .links .resend_unlock {
28
- font-size: 9pt;
29
- color: #999;
30
- }