hearken 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +14 -0
  3. data/.tool-versions +1 -0
  4. data/Gemfile +7 -1
  5. data/Gemfile.lock +95 -0
  6. data/{README.rdoc → README.md} +12 -50
  7. data/bin/console +15 -0
  8. data/bin/setup +8 -0
  9. data/exe/hearken +9 -0
  10. data/exe/hearken_index +13 -0
  11. data/hearken.gemspec +35 -35
  12. data/lib/hearken/command/enqueue.rb +35 -10
  13. data/lib/hearken/command/reload.rb +18 -6
  14. data/lib/hearken/command/search.rb +31 -20
  15. data/lib/hearken/console.rb +11 -28
  16. data/lib/hearken/debug.rb +6 -6
  17. data/lib/hearken/indexing/indexer.rb +32 -24
  18. data/lib/hearken/library.rb +49 -41
  19. data/lib/hearken/monkey_violence.rb +9 -7
  20. data/lib/hearken/paths.rb +13 -19
  21. data/lib/hearken/range_expander.rb +18 -13
  22. data/lib/hearken/tagged.rb +15 -11
  23. data/lib/hearken/track.rb +53 -41
  24. data/lib/hearken.rb +2 -2
  25. metadata +26 -105
  26. data/.gitignore +0 -5
  27. data/HISTORY.rdoc +0 -38
  28. data/MIT-LICENSE +0 -20
  29. data/bin/hearken +0 -7
  30. data/bin/hearken_index +0 -12
  31. data/bin/hearken_scrobble +0 -35
  32. data/bin/hearken_tags +0 -11
  33. data/lib/hearken/command/list.rb +0 -32
  34. data/lib/hearken/command/love.rb +0 -7
  35. data/lib/hearken/command/profile.rb +0 -7
  36. data/lib/hearken/command/recent.rb +0 -38
  37. data/lib/hearken/command/remove.rb +0 -15
  38. data/lib/hearken/command/restart.rb +0 -7
  39. data/lib/hearken/command/scrobbling.rb +0 -14
  40. data/lib/hearken/command/setup_scrobbling.rb +0 -7
  41. data/lib/hearken/command/shuffle.rb +0 -13
  42. data/lib/hearken/command/start.rb +0 -7
  43. data/lib/hearken/command/status.rb +0 -7
  44. data/lib/hearken/command/stop.rb +0 -7
  45. data/lib/hearken/command.rb +0 -35
  46. data/lib/hearken/notification/growl_notifier.rb +0 -15
  47. data/lib/hearken/player.rb +0 -130
  48. data/lib/hearken/preferences.rb +0 -33
  49. data/lib/hearken/queue.rb +0 -33
  50. data/lib/hearken/scrobbler.rb +0 -82
  51. data/lib/hearken/simple_scrobbler.rb +0 -94
  52. data/media/ice_cream.png +0 -0
  53. data/spec/hearken/command/enqueue_spec.rb +0 -24
  54. data/spec/hearken/command/list_spec.rb +0 -31
  55. data/spec/hearken/command/reload_spec.rb +0 -21
  56. data/spec/hearken/command/shuffle_spec.rb +0 -33
  57. data/spec/hearken/player_spec.rb +0 -38
  58. data/spec/hearken/range_expander_spec.rb +0 -28
  59. data/spec/spec_helper.rb +0 -16
@@ -1,31 +0,0 @@
1
- require_relative '../../spec_helper'
2
- require 'hearken/command/list'
3
-
4
- describe Hearken::Command::List do
5
- extend ShellShock::CommandSpec
6
-
7
- with_help <<EOF
8
- lists the contents of the track queue
9
- these results can optionally be filtered by specified words
10
- when playing, approximate times for each track will be displayed
11
- EOF
12
-
13
- before do
14
- @player = double 'player'
15
- @command = Hearken::Command::List.new @player
16
- end
17
-
18
- it 'should display nothing when there is no current track and nothing enqueued' do
19
- allow(@player).to receive(:current) { nil }
20
- allow(@player).to receive(:each)
21
- @command.execute ''
22
- end
23
-
24
- it 'should display queue contents with no times when there is no current track' do
25
- track = double 'track'
26
- allow(@player).to receive(:current) { nil }
27
- allow(@player).to receive(:each).and_yield track
28
- expect(@command).to receive(:puts).with(track)
29
- @command.execute ''
30
- end
31
- end
@@ -1,21 +0,0 @@
1
- require_relative '../../spec_helper'
2
- require 'hearken/command/reload'
3
-
4
- describe Hearken::Command::Reload do
5
- extend ShellShock::CommandSpec
6
-
7
- with_usage ''
8
- with_help 'reloads the contents of the music library for fast searching'
9
-
10
- before do
11
- @library = double 'library'
12
- @player = double 'player'
13
- allow(@player).to receive(:library) { @library }
14
- @command = Hearken::Command::Reload.new @player
15
- end
16
-
17
- it 'should reload the library' do
18
- expect(@library).to receive(:reload)
19
- @command.execute '123'
20
- end
21
- end
@@ -1,33 +0,0 @@
1
- require_relative '../../spec_helper'
2
- require 'hearken/command/shuffle'
3
-
4
- describe Hearken::Command::Shuffle do
5
- extend ShellShock::CommandSpec
6
-
7
- with_usage ''
8
- with_help 'shuffles the current queue'
9
-
10
- before do
11
- @player = double 'player'
12
- @command = Hearken::Command::Shuffle.new @player
13
- end
14
-
15
- it 'should dequeue all tracks, shuffle then enqueue them' do
16
- track = double 'track'
17
-
18
- expect(track).to receive(:id) { 1 }
19
- expect(track).to receive(:id) { 2 }
20
- expect(track).to receive(:id) { 3 }
21
-
22
- expect(@player).to receive(:dequeue) { track }
23
- expect(@player).to receive(:dequeue) { track }
24
- expect(@player).to receive(:dequeue) { track }
25
- expect(@player).to receive(:dequeue) { nil }
26
-
27
- expect(@player).to receive(:enqueue) { 1 }
28
- expect(@player).to receive(:enqueue) { 2 }
29
- expect(@player).to receive(:enqueue) { 3 }
30
-
31
- @command.execute
32
- end
33
- end
@@ -1,38 +0,0 @@
1
- require_relative '../spec_helper'
2
- require 'hearken/player'
3
-
4
- describe Hearken::Player do
5
- let(:preferences) { {} }
6
- let(:player) { Hearken::Player.new preferences }
7
-
8
- before do
9
- scrobbler = double 'scrobbler'
10
- library = double 'library'
11
- allow(Hearken::Scrobbler).to receive(:new) { scrobbler }
12
- allow(Hearken::Library).to receive(:new) { library }
13
- allow(library).to receive(:reload)
14
- allow(scrobbler).to receive(:enabled=)
15
- end
16
-
17
- describe '#current' do
18
- it 'should return current_track when player has pid and file is present' do
19
- player.instance_eval { @pid = 1 }
20
- hash = double 'hash'
21
- allow(File).to receive(:exist?).with('current_song') { true }
22
- allow(YAML).to receive(:load_file).with('current_song') { hash }
23
- expect(player.current).to eq(hash)
24
- end
25
-
26
- it 'should return nil when player has no pid and file is present' do
27
- player.instance_eval { @pid = nil }
28
- allow(File).to receive(:exist?).with('current_song') { true }
29
- expect(player.current).to be_nil
30
- end
31
-
32
- it 'should return nil when has pid and file is not present' do
33
- player.instance_eval { @pid = 1 }
34
- allow(File).to receive(:exist?).with('current_song') { false }
35
- expect(player.current).to be_nil
36
- end
37
- end
38
- end
@@ -1,28 +0,0 @@
1
- require_relative '../spec_helper'
2
- require 'hearken/range_expander'
3
-
4
- describe Hearken::RangeExpander do
5
- before do
6
- @expander = Hearken::RangeExpander.new
7
- end
8
-
9
- it 'should expand single values' do
10
- expect(@expander.expand('123')).to eq([1371])
11
- end
12
-
13
- it 'should expand multiple values separated by any non digit' do
14
- expect(@expander.expand("123 \t 456 , 789 ")).to eq([1371, 5370, 9369])
15
- end
16
-
17
- it 'should expand a fully specified range' do
18
- expect(@expander.expand(" 456-45i ")).to eq((5370..5382).to_a)
19
- end
20
-
21
- it 'should expand an abbreviated range' do
22
- expect(@expander.expand(" 456-i ")).to eq((5370..5382).to_a)
23
- end
24
-
25
- it 'should expand ids for a range' do
26
- expect(@expander.expand_to_ids(" s-z ")).to eq(%w{s t u v w x y z})
27
- end
28
- end
data/spec/spec_helper.rb DELETED
@@ -1,16 +0,0 @@
1
- $: << File.expand_path('../../lib', __FILE__)
2
-
3
- require 'bundler/setup'
4
- require 'rspec'
5
-
6
- module ShellShock
7
- module CommandSpec
8
- def with_usage text
9
- it('should display usage') { expect(@command.usage).to eq(text) }
10
- end
11
-
12
- def with_help text
13
- it('should display help') { expect(@command.help).to eq(text) }
14
- end
15
- end
16
- end