permians 0.0.0a0

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.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ Permians
2
+ ========
3
+
4
+ Usage
5
+ -----
6
+
7
+ Insert to your Rails Gemfile:
8
+
9
+ gem 'permians'
10
+
11
+ To create initializer, run:
12
+
13
+ rails g permians
14
+
15
+ To check Routing use:
16
+
17
+ rake routes
18
+
19
+ Name
20
+ ----
21
+
22
+ Bacillus permians is the oldest known Bacteria.
23
+
24
+ More Info
25
+ ---------
26
+
27
+ Yet, there is not much Information. Take a look at the Sourcecode at [github](http://github.com/rjung/permians "Permians").
@@ -0,0 +1,7 @@
1
+ class Session
2
+
3
+ include Mongoid::Document
4
+
5
+ field :user_id, type: String
6
+
7
+ end
@@ -0,0 +1,35 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ include Mongoid::Document
4
+
5
+ field :email, type: String
6
+ field :encrypted_password, type: String
7
+
8
+ # Authenticates the User by email and password.
9
+ # Will return User-Object, if a user is authenticated.
10
+ def self.authenticate(email, password)
11
+ where(:email => email).first.authenticate(password)
12
+ end
13
+
14
+ # Returns the User, if the given password matches.
15
+ # If not, nil is returned.
16
+ #
17
+ # Example:
18
+ # User.where(:email => 'test@example.com').first.authenticate('test')
19
+ def authenticate(password)
20
+ self.encrypted_password == password.crypt(self.encrypted_password) ?
21
+ self : nil
22
+ end
23
+
24
+ protected
25
+
26
+ def new_salt
27
+ "$1$#{random_string(8)}"
28
+ end
29
+
30
+ def random_string(length = 8)
31
+ chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a + ['.', '/']
32
+ length.times.inject('') { |pw,n| pw + chars[rand(chars.length)] }
33
+ end
34
+
35
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,9 @@
1
+ Rails.application.routes.draw do
2
+
3
+ mount_at = Permians::Engine.config.mount_at
4
+
5
+ scope mount_at do
6
+ resource :session, :controller => 'permians/sessions'
7
+ end
8
+
9
+ end
data/lib/engine.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'rails'
2
+
3
+ module Permians
4
+ class Engine < Rails::Engine
5
+ engine_name :permians
6
+ end
7
+ end
data/lib/permians.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Permians
2
+ require 'engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
3
+ end
@@ -0,0 +1,13 @@
1
+ require 'rails/generators'
2
+
3
+ class PermiansGenerator < Rails::Generators::Base
4
+
5
+ def self.source_root
6
+ File.join(File.dirname(__FILE__), 'templates')
7
+ end
8
+
9
+ def copy_initializer_file
10
+ copy_file 'initializer.rb', 'config/initializers/permians.rb'
11
+ end
12
+
13
+ end
@@ -0,0 +1,5 @@
1
+ module Cheese
2
+ class Engine < Rails::Engine
3
+ config.mount_at = 'api'
4
+ end
5
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,9 @@
1
+ module Permians
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ LEVEL = '0a0'
6
+
7
+ STRING = [MAJOR, MINOR, LEVEL].compact.join('.')
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: permians
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: true
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 0a0
9
+ version: 0.0.0a0
10
+ platform: ruby
11
+ authors:
12
+ - Rainer Jung
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-07-02 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rails
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ prerelease: false
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: mongoid
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 0
42
+ version: "0"
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: *id002
46
+ description: Service-API for personnel services
47
+ email: Rainer.Jung@gmail.com
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ extra_rdoc_files:
53
+ - README.md
54
+ files:
55
+ - app/models/session.rb
56
+ - app/models/user.rb
57
+ - config/routes.rb
58
+ - lib/engine.rb
59
+ - lib/permians.rb
60
+ - lib/rails/generators/service/permians_generator.rb
61
+ - lib/rails/generators/service/templates/initializer.rb
62
+ - lib/version.rb
63
+ - README.md
64
+ has_rdoc: true
65
+ homepage: http://github.com/rjung/permians
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options: []
70
+
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">"
85
+ - !ruby/object:Gem::Version
86
+ segments:
87
+ - 1
88
+ - 3
89
+ - 1
90
+ version: 1.3.1
91
+ requirements: []
92
+
93
+ rubyforge_project:
94
+ rubygems_version: 1.3.7
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: Personnel Identity Backend-Engine
98
+ test_files: []
99
+