ubiquitous_user 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = ubiquitous_user
1
+ = Ubiquitous User
2
2
 
3
3
  Many web applications required you to log in before being able to interact with
4
4
  them; which poses a real barer of entry for new users. You need users to have
@@ -18,8 +18,7 @@ actions that really require a logged in user.
18
18
  An important consideration is that users should be mergeable now. If you have
19
19
  a user with an account, and that user comes back a month latter, he may start
20
20
  to operate your site with the new ghost account and only log in latter on. At
21
- that moment the ghost account and the real account will be merged, basically by
22
- calling real_account.merge(ghost_account_id)
21
+ that moment you should merge the accounts.
23
22
 
24
23
  == Installation
25
24
 
@@ -127,8 +126,8 @@ configurable yet. What is configurable is the two methods it calls on user. You
127
126
  can do this kind of configuration in config/initializers/ubiquitous_user.rb for
128
127
  example:
129
128
 
130
- Usable::UserModelSave = :save_bypassing_non_essential_validation
131
- Usable::UserModelName = :name_or_else
129
+ UsableConfig::user_model_save = :save_bypassing_non_essential_validation
130
+ UsableConfig::user_model_name = :name_or_else
132
131
 
133
132
  == API Documentation
134
133
 
data/Rakefile CHANGED
@@ -11,6 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/pupeno/ubiquitous_user"
12
12
  gem.authors = ["J. Pablo Fernández"]
13
13
  gem.add_dependency "actionpack", ">= 2.0.0"
14
+ gem.files = %w(LICENSE README.rdoc Rakefile VERSION) + Dir.glob("{lib,generators}/**/*")
14
15
  #gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
15
16
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
17
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -0,0 +1 @@
1
+ blah blah
@@ -0,0 +1,7 @@
1
+ class VersionGenerator < Rails::Generator::Base
2
+ def manifest
3
+ record do |m|
4
+ # Do something
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,15 @@
1
+ module UsableConfig
2
+ @user_model_save = :save
3
+ @user_model_name = :name
4
+
5
+ # Method used to save the user.
6
+ attr_accessor :user_model_save
7
+ # Method used to get the name of the user.
8
+ attr_accessor :user_model_name
9
+
10
+ module_function :user_model_save, :user_model_save=, :user_model_name, :user_model_name=
11
+ end
12
+
1
13
  module UsableHelpers
2
14
  # Helper method to get the current user. It will always return a user but the
3
15
  # user may not be in the database. If options[:create] is true, then the user
@@ -14,8 +26,7 @@ module UsableHelpers
14
26
  @ubiquitous_user = User.new()
15
27
  if options[:create]
16
28
  # Save the user in the database and set the session user_id for latter.
17
- # TODO use UsableConfig::UserModelSave
18
- @ubiquitous_user.send(Usable::UserModelSave)
29
+ @ubiquitous_user.send(UsableConfig::user_model_save)
19
30
  session[:user_id] = @ubiquitous_user.id
20
31
  end
21
32
  return @ubiquitous_user
@@ -34,12 +45,9 @@ end
34
45
  module Usable
35
46
  include UsableHelpers
36
47
 
37
- UserModelSave = :save
38
- UserModelName = :name
39
-
40
48
  def user=(u)
41
49
  session[:user_id] = u != nil ? u.id : nil
42
- session[:user_name] = u != nil ? u.send(UserModelName) : nil
50
+ session[:user_name] = u != nil ? u.send(UsableConfig::user_model_name) : nil
43
51
  user
44
52
  end
45
53
 
data/test/helper.rb CHANGED
@@ -2,9 +2,6 @@ require 'rubygems'
2
2
  require 'test/unit'
3
3
  require 'shoulda'
4
4
 
5
- require 'active_support'
6
- require 'action_pack'
7
-
8
5
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
6
  $LOAD_PATH.unshift(File.dirname(__FILE__))
10
7
  require 'ubiquitous_user'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ubiquitous_user
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "J. Pablo Fern\xC3\xA1ndez"
@@ -32,15 +32,13 @@ extra_rdoc_files:
32
32
  - LICENSE
33
33
  - README.rdoc
34
34
  files:
35
- - .document
36
- - .gitignore
37
35
  - LICENSE
38
36
  - README.rdoc
39
37
  - Rakefile
40
38
  - VERSION
39
+ - generators/ubiquitous_user/USAGE
40
+ - generators/ubiquitous_user/ubiquitous_user.rb
41
41
  - lib/ubiquitous_user.rb
42
- - test/helper.rb
43
- - test/test_ubiquitous-user.rb
44
42
  has_rdoc: true
45
43
  homepage: http://github.com/pupeno/ubiquitous_user
46
44
  licenses: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
- *.gemspec
21
-
22
- ## PROJECT::SPECIFIC