vkpd 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,8 +2,10 @@
2
2
 
3
3
  VKPD searches for music on social network vk.com and adds/plays it with MPD.
4
4
  [![Gem Version](https://badge.fury.io/rb/vkpd.png)](http://badge.fury.io/rb/vkpd)
5
+ [![Code Climate](https://codeclimate.com/github/alesguzik/vkpd.png)](https://codeclimate.com/github/alesguzik/vkpd)
5
6
 
6
7
  ##Run
8
+ vkpd auth
7
9
  vkpd [options] [search request]
8
10
 
9
11
  ##Options
@@ -24,6 +26,7 @@ VKPD searches for music on social network vk.com and adds/plays it with MPD.
24
26
  Add songs to current playlist instead of replacing it
25
27
 
26
28
  ##Some examples
29
+ vkpd auth # authenticate vkpd in vk.com
27
30
  vkpd Beatles # replaces current mpd playlist with The Beatles' songs and starts playing
28
31
  vkpd play Beatles # the same
29
32
  vkpd add Beatles # adds found songs to playlist and starts playing
data/lib/vkpd/auth.rb CHANGED
@@ -23,10 +23,9 @@ module Vkpd
23
23
  end
24
24
  Thread.new do
25
25
  sleep 0.5
26
- puts "Authorized. Terminating now."
27
- Kernel.exec("true")
26
+ Process.kill 'INT', Process.pid
28
27
  end
29
- "authorized. now close me and go back to your term"
28
+ "<html><head><script>window.close()</script></head><body>Authorized. Now close me and go back to your term</body></html>"
30
29
  end
31
30
  end
32
31
  end
data/lib/vkpd/cli.rb CHANGED
@@ -48,6 +48,10 @@ module Vkpd
48
48
  when '-nf','--no-fix', '--exact'
49
49
  params["auto_complete"] = '0'
50
50
  when 'auth'
51
+ Thread.new do
52
+ sleep 1
53
+ Launchy.open('http://localhost.localdomain:4567')
54
+ end
51
55
  Vkpd::Auth.run!
52
56
  when 'play'
53
57
  # do nothing
data/lib/vkpd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vkpd
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/vkpd.rb CHANGED
@@ -6,6 +6,7 @@ require 'yaml'
6
6
  require 'json'
7
7
  require 'pathname'
8
8
  require 'sinatra/base'
9
+ require 'launchy'
9
10
  require 'ruby-mpd'
10
11
  require 'vkpd/version'
11
12
  require 'vkpd/cli'
@@ -22,8 +23,7 @@ module Vkpd
22
23
  # Reads config file, parses it as yaml and caches the result
23
24
  def config
24
25
  unless File.exist? config_path
25
- puts 'Please authenticate. Type `vkpd auth` and point your browser to http://localhost.localdomain:4567/'
26
- exit 1
26
+ system("vkpd auth 2>&1 >/dev/null")
27
27
  end
28
28
  @config ||= YAML.load File.read(config_path)
29
29
  end
data/vkpd.gemspec CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency "sinatra"
22
22
  spec.add_dependency "ruby-mpd", ">= 0.2.4"
23
+ spec.add_dependency "launchy"
23
24
  spec.add_development_dependency "bundler", "~> 1.3"
24
25
  spec.add_development_dependency "rake"
25
26
  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.1
4
+ version: 1.2.0
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-23 00:00:00.000000000 Z
12
+ date: 2013-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: 0.2.4
46
+ - !ruby/object:Gem::Dependency
47
+ name: launchy
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: bundler
48
64
  requirement: !ruby/object:Gem::Requirement