anyplayer 1.1.5 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7ce9982f42d4ae01c721cf82f4fc09a4fc61740c
4
- data.tar.gz: ea519d8ba4bde8f84b3e2ad253ce6e276c98673e
2
+ SHA256:
3
+ metadata.gz: 1a9384589559bf8cb5d5296227003b72bbb33ca5970577a35d947cc6edbf7f9c
4
+ data.tar.gz: 2efd1d446b28792bace849ff9860a64150d20884b2e4624f7cc66aa74da8bfc7
5
5
  SHA512:
6
- metadata.gz: e488e5dca3e611699ffea03d075cd25a6c5376325974e2be1eabdc714cdc4e18b77f612dcbb2e0465e1508498d83f9b9b3e06c35a8f38de40c7c5926e526f619
7
- data.tar.gz: 73788384a220e2b6434c7f966f3475ac281408c054af4de10e13e98f96b98e547dbb4aebfbfbf1d4c03bcdc4e8d3b3b9e0ddc2e005829d7fabc71a71c9d7a227
6
+ metadata.gz: 42d4c7c05065c140bc28d77c45e30efb07868f7292d78e676b651314ddefe00204c0f0d9e2c7cc828d06408a3c0d7a1da57fbb3ba89b90c961420d7a7ea8064a
7
+ data.tar.gz: 4eafc888d550338ce4bad1792a1b0b83368463640c4cc28de49e5491a99a374d080c757420128d7647c8aa351b9ec84538323e48f96f91a3d9dd93b27f2bb5b4
data/.gitignore CHANGED
@@ -1,4 +1,4 @@
1
1
  pkg/*
2
2
  *.gem
3
3
  *.bundle
4
-
4
+ Gemfile.lock
@@ -0,0 +1 @@
1
+ 2.7.1
@@ -1,4 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
3
+ - 2.7.0
@@ -3,12 +3,24 @@ Changelog
3
3
 
4
4
  Anyplayer tries its best to follow Semantic Versioning.
5
5
 
6
+ ## Unreleased
7
+
8
+ ## v1.2.0 (2020-10-08)
9
+
10
+ Features:
11
+
12
+ - When using mpd, fallback to the file name if there is no track name.
13
+
14
+ Dependencies:
15
+
16
+ - Drop Ruby 1.9.3 and 2.0.0 support.
17
+
6
18
  ## v1.1.5 (2014-07-07)
7
19
 
8
20
  Bugfixes:
9
21
 
10
22
  - Better platform detection by letting players list the platforms
11
- they are intended to work on.
23
+ they are intended to work on (thanks @inspire22)
12
24
 
13
25
  ## v1.1.4 (2014-07-07)
14
26
 
@@ -46,3 +58,19 @@ Features:
46
58
  ## v1.0.0 (2013-07-26)
47
59
 
48
60
  First major release.
61
+
62
+ ## v0.0.4
63
+
64
+ Unstable version.
65
+
66
+ ## v0.0.3
67
+
68
+ Unstable version.
69
+
70
+ ## v0.0.2
71
+
72
+ Unstable version.
73
+
74
+ ## v0.0.1
75
+
76
+ Unstable version.
data/README.md CHANGED
@@ -43,8 +43,17 @@ a player is running
43
43
  Or in Ruby
44
44
  ----------
45
45
 
46
+ In your Gemfile:
47
+
48
+ ```rb
49
+ # Interact with the current music player
50
+ gem "anyplayer"
51
+ ```
52
+
53
+ In your code:
54
+
46
55
  ```ruby
47
- require 'anyplayer'
56
+ require "anyplayer"
48
57
  player = Anyplayer::Selector.new.player
49
58
 
50
59
  player.launched? # => true
@@ -71,9 +80,9 @@ Here a few useful commands while developping:
71
80
 
72
81
  ```sh
73
82
  $ ruby -Ilib bin/anyplayer # Use the anyplayer command-line from source
74
- $ bundle exec rake test # Launch tests
75
- $ bundle exec rake install # Install from source
76
- $ bundle exec rake console # Launch console
83
+ $ bin/rake test # Launch tests
84
+ $ bin/rake install # Install from source
85
+ $ bin/rake console # Launch console
77
86
  ```
78
87
 
79
88
 
data/Rakefile CHANGED
@@ -7,6 +7,7 @@ task :default => :test
7
7
 
8
8
  Rake::TestTask.new do |t|
9
9
  t.libs << "test"
10
+ t.libs << "lib"
10
11
  t.pattern = "test/**/*_test.rb"
11
12
  t.verbose = true
12
13
  end
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_runtime_dependency 'ruby-mpd', '~> 0.3.0'
22
+
22
23
  s.add_development_dependency 'minitest'
23
24
  s.add_development_dependency 'flexmock'
24
25
  s.add_development_dependency 'rake'
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
@@ -27,4 +27,3 @@ end
27
27
  require "anyplayer/player"
28
28
  require "anyplayer/selector"
29
29
  require "anyplayer/version"
30
-
@@ -45,7 +45,6 @@ module Anyplayer::CommandLine
45
45
  end
46
46
  end
47
47
 
48
-
49
48
  private
50
49
 
51
50
  # Call
@@ -31,7 +31,7 @@ class Anyplayer::Player
31
31
  # Example:
32
32
  # player.name # => iTunes
33
33
  def name
34
- self.class.to_s.gsub(/^.*::/, '')
34
+ self.class.to_s.gsub(/^.*::/, "")
35
35
  end
36
36
 
37
37
  # Default paused is not playing
@@ -75,12 +75,9 @@ class Anyplayer::Player
75
75
  [:mac, :windows, :linux, :unix]
76
76
  end
77
77
 
78
-
79
78
  private
80
79
 
81
80
  def reset_votes
82
81
  @votes = 0
83
82
  end
84
-
85
83
  end
86
-
@@ -1,48 +1,48 @@
1
1
  class Anyplayer::Amarok < Anyplayer::Player
2
2
  def playpause
3
- amarok 'PlayPause'
3
+ amarok "PlayPause"
4
4
  end
5
5
 
6
6
  def play
7
- amarok 'Play'
7
+ amarok "Play"
8
8
  end
9
9
 
10
10
  def pause
11
- amarok 'Pause'
11
+ amarok "Pause"
12
12
  end
13
13
 
14
14
  def prev
15
- amarok 'Prev'
15
+ amarok "Prev"
16
16
  super
17
17
  end
18
18
 
19
19
  def next
20
- amarok 'Next'
20
+ amarok "Next"
21
21
  super
22
22
  end
23
23
 
24
24
  def voldown
25
- amarok 'VolumeDown 5'
25
+ amarok "VolumeDown 5"
26
26
  end
27
27
 
28
28
  def volup
29
- amarok 'VolumeUp 5'
29
+ amarok "VolumeUp 5"
30
30
  end
31
31
 
32
32
  def volume
33
- amarok 'VolumeGet'
33
+ amarok "VolumeGet"
34
34
  end
35
35
 
36
36
  def track
37
- amarok_get_meta 'title'
37
+ amarok_get_meta "title"
38
38
  end
39
39
 
40
40
  def artist
41
- amarok_get_meta 'artist'
41
+ amarok_get_meta "artist"
42
42
  end
43
43
 
44
44
  def album
45
- amarok_get_meta 'album'
45
+ amarok_get_meta "album"
46
46
  end
47
47
 
48
48
  def launched?
@@ -55,7 +55,6 @@ class Anyplayer::Amarok < Anyplayer::Player
55
55
  [:unix, :linux]
56
56
  end
57
57
 
58
-
59
58
  private
60
59
 
61
60
  def amarok(command)
@@ -63,7 +62,6 @@ class Anyplayer::Amarok < Anyplayer::Player
63
62
  end
64
63
 
65
64
  def amarok_get_meta(name)
66
- amarok('GetMetadata').match(/#{name}: (\S.*)/)[1] rescue nil
65
+ amarok("GetMetadata").match(/#{name}: (\S.*)/)[1] rescue nil
67
66
  end
68
67
  end
69
-
@@ -1,52 +1,52 @@
1
1
  class Anyplayer::ItunesMac < Anyplayer::Player
2
2
  def play
3
- itunes 'play'
3
+ itunes "play"
4
4
  end
5
5
 
6
6
  def pause
7
- itunes 'pause'
7
+ itunes "pause"
8
8
  end
9
9
 
10
10
  def playpause
11
- itunes 'playpause'
11
+ itunes "playpause"
12
12
  end
13
13
 
14
14
  def prev
15
- itunes 'previous track'
15
+ itunes "previous track"
16
16
  super
17
17
  end
18
18
 
19
19
  def next
20
- itunes 'next track'
20
+ itunes "next track"
21
21
  super
22
22
  end
23
23
 
24
24
  def voldown
25
- itunes 'set sound volume to sound volume - 10'
25
+ itunes "set sound volume to sound volume - 10"
26
26
  end
27
27
 
28
28
  def volup
29
- itunes 'set sound volume to sound volume + 10'
29
+ itunes "set sound volume to sound volume + 10"
30
30
  end
31
31
 
32
32
  def volume
33
- itunes 'return sound volume'
33
+ itunes "return sound volume"
34
34
  end
35
35
 
36
36
  def track
37
- itunes 'return name of current track'
37
+ itunes "return name of current track"
38
38
  end
39
39
 
40
40
  def artist
41
- itunes 'return artist of current track'
41
+ itunes "return artist of current track"
42
42
  end
43
43
 
44
44
  def album
45
- itunes 'return album of current track'
45
+ itunes "return album of current track"
46
46
  end
47
47
 
48
48
  def playing?
49
- playing = itunes 'return player state is playing'
49
+ playing = itunes "return player state is playing"
50
50
  playing == "true"
51
51
  end
52
52
 
@@ -1,5 +1,5 @@
1
1
  begin
2
- require 'win32ole'
2
+ require "win32ole"
3
3
  rescue LoadError => e
4
4
  raise LoadError.new("#{e.message} - You probably aren't on Windows")
5
5
  end
@@ -63,11 +63,9 @@ class Anyplayer::ItunesWindows < Anyplayer::Player
63
63
  [:windows]
64
64
  end
65
65
 
66
-
67
66
  private
68
67
 
69
68
  def itunes
70
69
  itunes ||= WIN32OLE.new("iTunes.Application")
71
70
  end
72
71
  end
73
-
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  begin
3
- require 'ruby-mpd'
3
+ require "ruby-mpd"
4
4
  rescue LoadError => e
5
5
  raise LoadError.new "#{e.message} — Please install the ruby-mpd gem"
6
6
  end
@@ -50,15 +50,18 @@ class Anyplayer::Mpd < Anyplayer::Player
50
50
  end
51
51
 
52
52
  def track
53
- mpc.current_song && mpc.current_song.title
53
+ song = current_song
54
+ return unless song
55
+
56
+ song.title || File.basename(song.file)
54
57
  end
55
58
 
56
59
  def artist
57
- mpc.current_song && mpc.current_song.artist
60
+ current_song&.artist
58
61
  end
59
62
 
60
63
  def album
61
- mpc.current_song && mpc.current_song.album
64
+ current_song&.album
62
65
  end
63
66
 
64
67
  def launched?
@@ -66,12 +69,15 @@ class Anyplayer::Mpd < Anyplayer::Player
66
69
  end
67
70
 
68
71
  def host
69
- ENV['MPD_HOST'] || super
72
+ ENV["MPD_HOST"] || super
70
73
  end
71
74
 
72
-
73
75
  private
74
76
 
77
+ def current_song
78
+ mpc.current_song
79
+ end
80
+
75
81
  def connect
76
82
  @mpc ||= MPD.new
77
83
  @mpc.connect
@@ -84,4 +90,3 @@ class Anyplayer::Mpd < Anyplayer::Player
84
90
  @mpc
85
91
  end
86
92
  end
87
-
@@ -43,4 +43,3 @@ class Anyplayer::Noplayer < Anyplayer::Player
43
43
  true
44
44
  end
45
45
  end
46
-
@@ -1,52 +1,52 @@
1
1
  class Anyplayer::RdioMac < Anyplayer::Player
2
2
  def play
3
- rdio 'play'
3
+ rdio "play"
4
4
  end
5
5
 
6
6
  def pause
7
- rdio 'pause'
7
+ rdio "pause"
8
8
  end
9
9
 
10
10
  def playpause
11
- rdio 'playpause'
11
+ rdio "playpause"
12
12
  end
13
13
 
14
14
  def prev
15
- rdio 'previous track'
15
+ rdio "previous track"
16
16
  super
17
17
  end
18
18
 
19
19
  def next
20
- rdio 'next track'
20
+ rdio "next track"
21
21
  super
22
22
  end
23
23
 
24
24
  def voldown
25
- rdio 'set sound volume to sound volume - 10'
25
+ rdio "set sound volume to sound volume - 10"
26
26
  end
27
27
 
28
28
  def volup
29
- rdio 'set sound volume to sound volume + 10'
29
+ rdio "set sound volume to sound volume + 10"
30
30
  end
31
31
 
32
32
  def volume
33
- rdio 'return sound volume'
33
+ rdio "return sound volume"
34
34
  end
35
35
 
36
36
  def track
37
- rdio 'return name of current track'
37
+ rdio "return name of current track"
38
38
  end
39
39
 
40
40
  def artist
41
- rdio 'return artist of current track'
41
+ rdio "return artist of current track"
42
42
  end
43
43
 
44
44
  def album
45
- rdio 'return album of current track'
45
+ rdio "return album of current track"
46
46
  end
47
47
 
48
48
  def playing?
49
- playing = rdio 'return player state is playing'
49
+ playing = rdio "return player state is playing"
50
50
  playing == "true"
51
51
  end
52
52
 
@@ -62,7 +62,6 @@ class Anyplayer::RdioMac < Anyplayer::Player
62
62
  [:mac]
63
63
  end
64
64
 
65
-
66
65
  private
67
66
 
68
67
  def rdio(command)
@@ -1,59 +1,57 @@
1
1
  class Anyplayer::Rhythmbox < Anyplayer::Player
2
2
  def playpause
3
- rhythmbox 'play-pause'
3
+ rhythmbox "play-pause"
4
4
  end
5
5
 
6
6
  def play
7
- rhythmbox 'play'
7
+ rhythmbox "play"
8
8
  end
9
9
 
10
10
  def pause
11
- rhythmbox 'pause'
11
+ rhythmbox "pause"
12
12
  end
13
13
 
14
14
  def prev
15
- rhythmbox 'previous'
15
+ rhythmbox "previous"
16
16
  super
17
17
  end
18
18
 
19
19
  def next
20
- rhythmbox 'next'
20
+ rhythmbox "next"
21
21
  super
22
22
  end
23
23
 
24
24
  def voldown
25
- rhythmbox 'volume-down'
25
+ rhythmbox "volume-down"
26
26
  end
27
27
 
28
28
  def volup
29
- rhythmbox 'volume-up'
29
+ rhythmbox "volume-up"
30
30
  end
31
31
 
32
32
  def volume
33
- rhythmbox 'print-volume'
33
+ rhythmbox "print-volume"
34
34
  end
35
35
 
36
36
  def track
37
- rhythmbox 'print-playing-format=%tt'
37
+ rhythmbox "print-playing-format=%tt"
38
38
  end
39
39
 
40
40
  def artist
41
- rhythmbox 'print-playing-format=%ta'
41
+ rhythmbox "print-playing-format=%ta"
42
42
  end
43
43
 
44
44
  def album
45
- rhythmbox 'print-playing-format=%at'
45
+ rhythmbox "print-playing-format=%at"
46
46
  end
47
47
 
48
48
  def launched?
49
49
  %x(rhythmbox-client --no-start --print-playing 2>/dev/null).rstrip != ""
50
50
  end
51
51
 
52
-
53
52
  private
54
53
 
55
54
  def rhythmbox(command)
56
55
  %x(rhythmbox-client --no-start --#{command}).rstrip
57
56
  end
58
57
  end
59
-
@@ -1,52 +1,52 @@
1
1
  class Anyplayer::SpotifyMac < Anyplayer::Player
2
2
  def play
3
- spotify 'play'
3
+ spotify "play"
4
4
  end
5
5
 
6
6
  def pause
7
- spotify 'pause'
7
+ spotify "pause"
8
8
  end
9
9
 
10
10
  def playpause
11
- spotify 'playpause'
11
+ spotify "playpause"
12
12
  end
13
13
 
14
14
  def prev
15
- spotify 'previous track'
15
+ spotify "previous track"
16
16
  super
17
17
  end
18
18
 
19
19
  def next
20
- spotify 'next track'
20
+ spotify "next track"
21
21
  super
22
22
  end
23
23
 
24
24
  def voldown
25
- spotify 'set sound volume to sound volume - 10'
25
+ spotify "set sound volume to sound volume - 10"
26
26
  end
27
27
 
28
28
  def volup
29
- spotify 'set sound volume to sound volume + 10'
29
+ spotify "set sound volume to sound volume + 10"
30
30
  end
31
31
 
32
32
  def volume
33
- spotify 'return sound volume'
33
+ spotify "return sound volume"
34
34
  end
35
35
 
36
36
  def track
37
- spotify 'return name of current track'
37
+ spotify "return name of current track"
38
38
  end
39
39
 
40
40
  def artist
41
- spotify 'return artist of current track'
41
+ spotify "return artist of current track"
42
42
  end
43
43
 
44
44
  def album
45
- spotify 'return album of current track'
45
+ spotify "return album of current track"
46
46
  end
47
47
 
48
48
  def playing?
49
- playing = spotify 'return player state is playing'
49
+ playing = spotify "return player state is playing"
50
50
  playing == "true"
51
51
  end
52
52
 
@@ -62,7 +62,6 @@ class Anyplayer::SpotifyMac < Anyplayer::Player
62
62
  [:mac]
63
63
  end
64
64
 
65
-
66
65
  private
67
66
 
68
67
  def spotify(command)
@@ -1,23 +1,23 @@
1
1
  class Anyplayer::Xmms2 < Anyplayer::Player
2
2
  def playpause
3
- xmms2 'toggle'
3
+ xmms2 "toggle"
4
4
  end
5
5
 
6
6
  def play
7
- xmms2 'play'
7
+ xmms2 "play"
8
8
  end
9
9
 
10
10
  def pause
11
- xmms2 'pause'
11
+ xmms2 "pause"
12
12
  end
13
13
 
14
14
  def prev
15
- xmms2 'prev'
15
+ xmms2 "prev"
16
16
  super
17
17
  end
18
18
 
19
19
  def next
20
- xmms2 'next'
20
+ xmms2 "next"
21
21
  super
22
22
  end
23
23
 
@@ -31,7 +31,7 @@ class Anyplayer::Xmms2 < Anyplayer::Player
31
31
 
32
32
  def volume
33
33
  # currently just the first (left?) channel
34
- xmms2('server volume').split("\n").first.sub(/([^0-9]*)/, '').to_i
34
+ xmms2("server volume").split("\n").first.sub(/([^0-9]*)/, "").to_i
35
35
  end
36
36
 
37
37
  def track
@@ -61,14 +61,13 @@ class Anyplayer::Xmms2 < Anyplayer::Player
61
61
  end
62
62
 
63
63
  def host
64
- ENV['XMMS_PATH'] || super
64
+ ENV["XMMS_PATH"] || super
65
65
  end
66
66
 
67
67
  def platforms
68
68
  [:unix, :linux]
69
69
  end
70
70
 
71
-
72
71
  private
73
72
 
74
73
  def xmms2(command)
@@ -78,12 +77,11 @@ class Anyplayer::Xmms2 < Anyplayer::Player
78
77
 
79
78
  def set_volume(num)
80
79
  num = if num < 0
81
- 0
82
- elsif num > 100
83
- 100
84
- end
80
+ 0
81
+ elsif num > 100
82
+ 100
83
+ end
85
84
 
86
85
  xmms2 "server volume #{num}"
87
86
  end
88
87
  end
89
-
@@ -1,6 +1,7 @@
1
1
  require "rbconfig"
2
2
 
3
- # The Selector is the tool that will find you the currently running player on your platform
3
+ # The Selector is the tool that will find you the currently running player
4
+ # on your platform.
4
5
  #
5
6
  # Example:
6
7
  #
@@ -22,19 +23,16 @@ module Anyplayer
22
23
  # Returns an instance of the first music player that's launched
23
24
  def player
24
25
  PLAYERS.each do |player|
25
- player_load(player) or next
26
+ player_load(player) || next
26
27
 
27
28
  instance = player_class(player).new
28
- player_on_platform?(instance) or next
29
+ player_on_platform?(instance) || next
29
30
 
30
- if player_launched?(instance)
31
- return instance
32
- end
31
+ return instance if player_launched?(instance)
33
32
  end
34
33
  nil
35
34
  end
36
35
 
37
-
38
36
  private
39
37
 
40
38
  def platform
@@ -71,19 +69,19 @@ module Anyplayer
71
69
 
72
70
  def player_on_platform?(player)
73
71
  result = player.platforms.include?(platform)
74
- log " not on platform" if !result
72
+ log " not on platform" unless result
75
73
  result
76
74
  end
77
75
 
78
76
  def player_class(player)
79
- camelized = player.to_s.split(/_/).map{ |word| word.capitalize }.join
80
- Anyplayer::const_get(camelized)
77
+ camelized = player.to_s.split(/_/).map(&:capitalize).join
78
+ Anyplayer.const_get(camelized)
81
79
  end
82
80
 
83
81
  def player_launched?(player)
84
82
  seconds = 5
85
83
  begin
86
- Timeout::timeout(seconds) do
84
+ Timeout.timeout(seconds) do
87
85
  launched = player.launched?
88
86
  log launched ? " launched" : " not launched"
89
87
  launched
@@ -1,3 +1,3 @@
1
1
  module Anyplayer
2
- VERSION = "1.1.5"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -2,8 +2,6 @@ require "test_helper"
2
2
  require "anyplayer/command_line"
3
3
 
4
4
  class CommandLineTest < Minitest::Test
5
- include FlexMock::TestCase
6
-
7
5
  USAGE = "Usage: anyplayer [-v] [command]
8
6
 
9
7
  Where command is one of: playpause, play, pause, next, prev, voldown, volup, volume, track, artist, album, vote, name, launched, paused, playing.
@@ -40,7 +38,6 @@ Player connected: Fake Player.
40
38
  Anyplayer::CommandLine.parse(%w(-v play))
41
39
  end
42
40
 
43
-
44
41
  # Actions
45
42
 
46
43
  def test_playpause
@@ -113,38 +110,40 @@ Player connected: Fake Player.
113
110
  Anyplayer::CommandLine.parse(%w(name))
114
111
  end
115
112
 
116
-
117
113
  # Booleans
118
114
 
119
115
  def test_launched_true
120
- flexmock(Anyplayer::CommandLine).should_receive(:exit)#.with(1)
116
+ flexmock(Anyplayer::CommandLine).should_receive(:exit) # .with(1)
121
117
  flexmock(@player).should_receive(:launched?).once.and_return(true)
122
118
  Anyplayer::CommandLine.parse(%w(launched))
123
119
  end
120
+
124
121
  def test_launched_false
125
- flexmock(Anyplayer::CommandLine).should_receive(:exit)#.with(0)
122
+ flexmock(Anyplayer::CommandLine).should_receive(:exit) # .with(0)
126
123
  flexmock(@player).should_receive(:launched?).once.and_return(false)
127
124
  Anyplayer::CommandLine.parse(%w(launched))
128
125
  end
129
126
 
130
127
  def test_playing_true
131
- flexmock(Anyplayer::CommandLine).should_receive(:exit).once#.with(1)
128
+ flexmock(Anyplayer::CommandLine).should_receive(:exit).once # .with(1)
132
129
  flexmock(@player).should_receive(:playing?).once.and_return(true)
133
130
  Anyplayer::CommandLine.parse(%w(playing))
134
131
  end
132
+
135
133
  def test_playing_false
136
- flexmock(Anyplayer::CommandLine).should_receive(:exit).once#.with(0)
134
+ flexmock(Anyplayer::CommandLine).should_receive(:exit).once # .with(0)
137
135
  flexmock(@player).should_receive(:playing?).once.and_return(false)
138
136
  Anyplayer::CommandLine.parse(%w(playing))
139
137
  end
140
138
 
141
139
  def test_paused_true
142
- flexmock(Anyplayer::CommandLine).should_receive(:exit).once#.with(1)
140
+ flexmock(Anyplayer::CommandLine).should_receive(:exit).once # .with(1)
143
141
  flexmock(@player).should_receive(:paused?).once.and_return(true)
144
142
  Anyplayer::CommandLine.parse(%w(paused))
145
143
  end
144
+
146
145
  def test_paused_false
147
- flexmock(Anyplayer::CommandLine).should_receive(:exit).once#.with(0)
146
+ flexmock(Anyplayer::CommandLine).should_receive(:exit).once # .with(0)
148
147
  flexmock(@player).should_receive(:paused?).once.and_return(false)
149
148
  Anyplayer::CommandLine.parse(%w(paused))
150
149
  end
@@ -1,13 +1,10 @@
1
1
  require "test_helper"
2
2
 
3
3
  class PlayerTest < Minitest::Test
4
- include FlexMock::TestCase
5
-
6
4
  def setup
7
5
  @player = Noplayer.new
8
6
  end
9
7
 
10
-
11
8
  # Default name
12
9
 
13
10
  def test_default_name
@@ -19,7 +16,6 @@ class PlayerTest < Minitest::Test
19
16
  assert_equal "Bar", @player.name
20
17
  end
21
18
 
22
-
23
19
  # Default paused?
24
20
 
25
21
  def test_paused_is_false_if_not_playing
@@ -32,7 +28,6 @@ class PlayerTest < Minitest::Test
32
28
  assert !@player.paused?
33
29
  end
34
30
 
35
-
36
31
  # Default playpause
37
32
 
38
33
  def test_playpause_toggles_play
@@ -49,7 +44,6 @@ class PlayerTest < Minitest::Test
49
44
  @player.playpause
50
45
  end
51
46
 
52
-
53
47
  # Votes
54
48
 
55
49
  def test_votes
@@ -61,7 +55,7 @@ class PlayerTest < Minitest::Test
61
55
  assert_equal @player.votes, 0
62
56
  else
63
57
  assert_equal @player.votes, i + 1
64
- end
58
+ end
65
59
  end
66
60
  end
67
61
 
@@ -90,8 +84,7 @@ class PlayerTest < Minitest::Test
90
84
  assert_equal @player.votes, 0
91
85
  else
92
86
  assert_equal @player.votes, i + 1
93
- end
87
+ end
94
88
  end
95
89
  end
96
-
97
90
  end
@@ -3,11 +3,9 @@ require "ruby-mpd"
3
3
  require "anyplayer/players/mpd"
4
4
 
5
5
  class MpdTest < Minitest::Test
6
- include FlexMock::TestCase
7
-
8
6
  def setup
9
7
  @mpd_instance_mock = flexmock("mpd")
10
- flexmock(MPD, "MPD", :new => @mpd_instance_mock)
8
+ flexmock(MPD, "MPD", new: @mpd_instance_mock)
11
9
  end
12
10
 
13
11
  def test_uses_ruby_mpd_gem
@@ -1,5 +1,5 @@
1
1
  require "minitest/autorun"
2
- require "flexmock/test_unit"
2
+ require "flexmock/minitest"
3
3
  require "anyplayer"
4
4
 
5
5
  require "anyplayer/players/noplayer"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anyplayer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunny Ripert
@@ -9,62 +9,62 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-28 00:00:00.000000000 Z
12
+ date: 2020-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-mpd
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: 0.3.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: 0.3.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: minitest
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: flexmock
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  description: Play/pause/skip songs in iTunes Mac, iTunes Windows, Spotify Mac, Rdio
@@ -74,21 +74,22 @@ email:
74
74
  - gordon@gordondiggs.com
75
75
  executables:
76
76
  - anyplayer
77
+ - rake
77
78
  extensions: []
78
79
  extra_rdoc_files: []
79
80
  files:
80
- - .envrc
81
- - .gitignore
82
- - .travis.yml
81
+ - ".gitignore"
82
+ - ".ruby-version"
83
+ - ".travis.yml"
83
84
  - CHANGELOG.md
84
85
  - CONTRIBUTING.md
85
86
  - Gemfile
86
- - Gemfile.lock
87
87
  - MIT-LICENSE
88
88
  - README.md
89
89
  - Rakefile
90
90
  - anyplayer.gemspec
91
91
  - bin/anyplayer
92
+ - bin/rake
92
93
  - lib/anyplayer.rb
93
94
  - lib/anyplayer/command_line.rb
94
95
  - lib/anyplayer/player.rb
@@ -119,17 +120,16 @@ require_paths:
119
120
  - lib
120
121
  required_ruby_version: !ruby/object:Gem::Requirement
121
122
  requirements:
122
- - - '>='
123
+ - - ">="
123
124
  - !ruby/object:Gem::Version
124
125
  version: '0'
125
126
  required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  requirements:
127
- - - '>='
128
+ - - ">="
128
129
  - !ruby/object:Gem::Version
129
130
  version: '0'
130
131
  requirements: []
131
- rubyforge_project:
132
- rubygems_version: 2.4.5
132
+ rubygems_version: 3.1.2
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Interact with the running music player
data/.envrc DELETED
@@ -1 +0,0 @@
1
- export PATH=bin:$PATH
@@ -1,22 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- anyplayer (1.1.5)
5
- ruby-mpd (~> 0.3.0)
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- flexmock (1.3.3)
11
- minitest (5.4.1)
12
- rake (10.3.2)
13
- ruby-mpd (0.3.2)
14
-
15
- PLATFORMS
16
- ruby
17
-
18
- DEPENDENCIES
19
- anyplayer!
20
- flexmock
21
- minitest
22
- rake