flickr-store 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.
- data/bin/flickr-authenticate +1 -1
- data/bin/flickr-store +1 -1
- data/lib/flickr-store.rb +7 -5
- data/lib/flickr-store/version.rb +1 -1
- metadata +1 -1
data/bin/flickr-authenticate
CHANGED
@@ -4,7 +4,7 @@ require 'pp'
|
|
4
4
|
BIN_ROOT = File.dirname(File.absolute_path(__FILE__))
|
5
5
|
require BIN_ROOT + '/../lib/flickr-store'
|
6
6
|
|
7
|
-
CREDS_FILE = '
|
7
|
+
CREDS_FILE = Dir.home + '/.flickr-credentials'
|
8
8
|
if File.exists?(CREDS_FILE)
|
9
9
|
creds = Marshal.load(File.read(CREDS_FILE))
|
10
10
|
print "Credentials: "
|
data/bin/flickr-store
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
BIN_ROOT = File.dirname(File.absolute_path(__FILE__))
|
4
4
|
require BIN_ROOT + '/../lib/flickr-store'
|
5
5
|
|
6
|
-
CREDS_FILE = '
|
6
|
+
CREDS_FILE = Dir.home + '/.flickr-credentials'
|
7
7
|
if !File.exists?(CREDS_FILE)
|
8
8
|
puts "Please login using flickr-authenticate first!"
|
9
9
|
exit
|
data/lib/flickr-store.rb
CHANGED
@@ -13,6 +13,8 @@ FlickRaw.secure = true
|
|
13
13
|
|
14
14
|
module Flickr
|
15
15
|
class Store
|
16
|
+
DICT_FILE = Dir.home + '/.flickr-store'
|
17
|
+
|
16
18
|
def self.authenticate(key, secret)
|
17
19
|
FlickRaw.api_key = key
|
18
20
|
FlickRaw.shared_secret = secret
|
@@ -43,15 +45,15 @@ module Flickr
|
|
43
45
|
flickr.access_token = access_token
|
44
46
|
flickr.access_secret = access_secret
|
45
47
|
|
46
|
-
if File.exists?(
|
48
|
+
if File.exists?(DICT_FILE)
|
47
49
|
begin
|
48
|
-
@dict = Marshal.load File.read(
|
50
|
+
@dict = Marshal.load File.read(DICT_FILE)
|
49
51
|
rescue
|
50
|
-
FileUtils.touch(
|
52
|
+
FileUtils.touch(DICT_FILE)
|
51
53
|
@dict = {}
|
52
54
|
end
|
53
55
|
else
|
54
|
-
FileUtils.touch(
|
56
|
+
FileUtils.touch(DICT_FILE)
|
55
57
|
@dict = {}
|
56
58
|
end
|
57
59
|
end
|
@@ -96,7 +98,7 @@ module Flickr
|
|
96
98
|
private
|
97
99
|
|
98
100
|
def update_dict!
|
99
|
-
File.write
|
101
|
+
File.write DICT_FILE, Marshal.dump(@dict)
|
100
102
|
end
|
101
103
|
end
|
102
104
|
end
|
data/lib/flickr-store/version.rb
CHANGED