vkpd 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vkpd/cli.rb +2 -11
- data/lib/vkpd/version.rb +1 -1
- data/lib/vkpd.rb +11 -9
- metadata +2 -2
data/lib/vkpd/cli.rb
CHANGED
@@ -1,14 +1,5 @@
|
|
1
1
|
module Vkpd
|
2
2
|
class CLI
|
3
|
-
# Reads config file, parses it as yaml and caches the result
|
4
|
-
def config
|
5
|
-
unless File.exist? Vkpd::config_path
|
6
|
-
puts 'Please authenticate. Start vkpd-auth.rb and point your browser to http://localhost.localdomain:4567/'
|
7
|
-
exit 1
|
8
|
-
end
|
9
|
-
@config ||= YAML.load File.read(Vkpd::config_path)
|
10
|
-
end
|
11
|
-
|
12
3
|
# main CLI method
|
13
4
|
def main
|
14
5
|
mpd = MPD.new 'localhost'
|
@@ -46,7 +37,7 @@ module Vkpd
|
|
46
37
|
if !ARGV.empty? and ARGV.first.match(/^\d+$/)
|
47
38
|
params['uid'] = ARGV.shift
|
48
39
|
else
|
49
|
-
params['uid'] = config["user_id"]
|
40
|
+
params['uid'] = Vkpd::config["user_id"]
|
50
41
|
end
|
51
42
|
when 'group'
|
52
43
|
method = 'audio.get'
|
@@ -67,7 +58,7 @@ module Vkpd
|
|
67
58
|
end
|
68
59
|
|
69
60
|
|
70
|
-
params["access_token"]=config["access_token"]
|
61
|
+
params["access_token"]=Vkpd::config["access_token"]
|
71
62
|
|
72
63
|
connection=Net::HTTP.new("api.vk.com",443)
|
73
64
|
connection.use_ssl=true
|
data/lib/vkpd/version.rb
CHANGED
data/lib/vkpd.rb
CHANGED
@@ -14,17 +14,19 @@ require 'vkpd/auth'
|
|
14
14
|
module Vkpd
|
15
15
|
APP_ID='2803517'
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
class <<self
|
18
|
+
def config_path
|
19
|
+
@config_path ||= "#{ENV['HOME']}/.config/vkpd.yaml"
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
# Reads config file, parses it as yaml and caches the result
|
23
|
+
def config
|
24
|
+
unless File.exist? config_path
|
25
|
+
puts 'Please authenticate. Type `vkpd auth` and point your browser to http://localhost.localdomain:4567/'
|
26
|
+
exit 1
|
27
|
+
end
|
28
|
+
@config ||= YAML.load File.read(config_path)
|
26
29
|
end
|
27
|
-
@config ||= YAML.load File.read(config_path)
|
28
30
|
end
|
29
31
|
|
30
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vkpd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|