purzelrakete-boomloop 0.0.4 → 0.0.5
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/lib/authentication/store/yaml_store.rb +19 -18
- metadata +2 -3
- data/config/credentials.yml +0 -6
@@ -1,38 +1,39 @@
|
|
1
|
+
=begin
|
2
|
+
stores oauth credentials.
|
3
|
+
=end
|
1
4
|
module Boomloop
|
2
5
|
module Authentication
|
3
6
|
module Store
|
4
7
|
class YAMLStore < Base
|
5
|
-
@@ymlfile = File.dirname(__FILE__) + '/../../../config/credentials.yml'
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
self.class.load_config
|
9
|
+
# pass in where the yml should be stored.
|
10
|
+
def initialize(filename = "#{ ENV["HOME"] }/.boomloop_credentials.yml")
|
11
|
+
@config_filename = filename
|
12
|
+
self.load_config
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
File.
|
17
|
-
|
18
|
-
|
15
|
+
def load_config
|
16
|
+
file = File.new(@config_filename, "a+")
|
17
|
+
file.rewind
|
18
|
+
@config = YAML.load(file) || {}
|
19
|
+
file.close
|
19
20
|
end
|
20
21
|
|
21
|
-
def
|
22
|
-
if
|
23
|
-
File.open(
|
24
|
-
f.write
|
22
|
+
def save_config
|
23
|
+
if @config
|
24
|
+
File.open(@config_filename, "w") do |f|
|
25
|
+
f.write @config.to_yaml
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
29
30
|
def update(credentials)
|
30
|
-
|
31
|
-
self.
|
31
|
+
@config[credentials.username] = credentials.options
|
32
|
+
self.save_config
|
32
33
|
end
|
33
34
|
|
34
35
|
def find(user)
|
35
|
-
::Boomloop::Authentication::Credentials.new(user, self,
|
36
|
+
::Boomloop::Authentication::Credentials.new(user, self, @config[user])
|
36
37
|
end
|
37
38
|
end
|
38
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purzelrakete-boomloop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rany Keddo
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-27 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -49,7 +49,6 @@ files:
|
|
49
49
|
- test/mocks
|
50
50
|
- test/mocks/monster.rb
|
51
51
|
- test/test_helper.rb
|
52
|
-
- config/credentials.yml
|
53
52
|
has_rdoc: true
|
54
53
|
homepage: http://github.com/purzelrakete/boomloop
|
55
54
|
post_install_message:
|