playa 0.0.3 → 0.0.4

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
2
  SHA1:
3
- metadata.gz: 6aa98ac7fd6bfdcaf5c944f0205c92391645c1c8
4
- data.tar.gz: a12a189b5257b8d526aabdf44de62064bea9b31a
3
+ metadata.gz: 4878ba1ffdd6bac5e65efca51700fb2c4eb04c78
4
+ data.tar.gz: 857acc9d3e9d1b0d9467626887a1ce6925628ddc
5
5
  SHA512:
6
- metadata.gz: 83e26c2ac1cbd29422133f51fba5716a3b442858c584ca1fd515b722546971c9b7a21f9b1aa430d03ee4e01552398b8b55f6f79112e1f59edceb57d582fd9862
7
- data.tar.gz: 5fc45aec59dbc751921873f608b67e31663fb6c8b4a912c0759652ee72d4ec5b635d35cdd981d8cac5153489a5dedeade71474481789366f1e596615cb2c78d2
6
+ metadata.gz: 4a38780c433bb4ab05fa20b7abd5439876ba05d953b6f2f6c3e5ea2a7b4370d7001649bb20cf81f7c2e12ed39ad24ceb0e5fd40424835a59e2b380481e6dc8d4
7
+ data.tar.gz: 6a0dda0911e38eaec891fc39582d869705408cf5b6ff7437b740741e1b09f4810a2078100751fb338af3255f4214d8f88f3d13818b14bb3cc4bece1919f1d928
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
3
 
4
- task :default => :test
4
+ task default: :test
5
5
 
6
6
  Rake::TestTask.new do |t|
7
- t.libs.push "lib"
8
- t.libs.push "test"
9
- t.pattern = "test/**/*_test.rb"
7
+ t.libs.push 'lib'
8
+ t.libs.push 'test'
9
+ t.pattern = 'test/**/*_test.rb'
10
10
  end
data/bin/playa CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
2
+ unless $LOAD_PATH.include?(File.dirname(__FILE__) + '/../lib')
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
4
+ end
3
5
 
4
6
  -> { its -> { a } }
5
7
  trap('INT') { exit! }
@@ -8,10 +10,6 @@ require 'playa'
8
10
 
9
11
  args = ARGV.dup
10
12
 
11
- play_directory = if args.empty? || args.nil?
12
- Dir.pwd
13
- else
14
- args
15
- end
13
+ play_directory = args.empty? || args.nil? ? Dir.pwd : args
16
14
 
17
- Playa::Application.start(args)
15
+ Playa::Application.start(play_directory)
@@ -20,28 +20,15 @@ module Playa
20
20
 
21
21
  event :key do |key|
22
22
  case key
23
- when :left
24
- player.rewind
25
-
26
- when :right
27
- player.forward
28
-
29
- when :space
30
- player.toggle
31
-
23
+ when :left then player.rewind
24
+ when :right then player.forward
25
+ when :space then player.toggle
26
+ when :up then trigger(:menu_prev)
27
+ when :down then trigger(:menu_next)
28
+ when 'q' then trigger(:_exit_)
32
29
  when :enter
33
30
  trigger(:menu_select)
34
31
  trigger(:select, menu.current_item)
35
-
36
- when :up
37
- trigger(:menu_prev)
38
-
39
- when :down
40
- trigger(:menu_next)
41
-
42
- when 'q'
43
- trigger(:_exit_)
44
-
45
32
  end
46
33
  trigger(:update)
47
34
  end
@@ -1,7 +1,7 @@
1
1
  require 'mp3info'
2
2
 
3
3
  module Playa
4
- class Track
4
+ class Track
5
5
  def initialize(file)
6
6
  @file = file
7
7
  end
@@ -14,7 +14,7 @@ module Playa
14
14
  album: album,
15
15
  track_number: track_number,
16
16
  duration: duration,
17
- bitrate: bitrate,
17
+ bitrate: bitrate
18
18
  }
19
19
  end
20
20
 
@@ -7,7 +7,7 @@ module Playa
7
7
  end
8
8
 
9
9
  def tracks
10
- @_tracks ||= files.inject([]) do |acc, file|
10
+ @_tracks ||= files.reduce([]) do |acc, file|
11
11
  acc << Track.new(file)
12
12
  acc
13
13
  end
@@ -4,17 +4,17 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'playa'
7
- spec.version = '0.0.3'
7
+ spec.version = '0.0.4'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
- spec.summary = %q{Plays mp3s from a directory.}
11
- spec.description = %q{An example app using Vedeu.}
10
+ spec.summary = 'Plays mp3s from a directory.'
11
+ spec.description = 'An example app using Vedeu.'
12
12
  spec.homepage = 'https://github.com/gavinlaking/playa'
13
13
  spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0")
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(/^(test|spec|features)\//)
18
18
  spec.require_paths = ['lib']
19
19
 
20
20
  spec.add_development_dependency 'bundler', '~> 1.6'
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'rake', '10.3.2'
27
27
  spec.add_development_dependency 'simplecov', '0.9.0'
28
28
 
29
- spec.add_development_dependency 'audite', '0.3.0'
30
- spec.add_development_dependency 'ruby-mp3info', '0.8.4'
31
- spec.add_development_dependency 'vedeu', '0.0.41'
29
+ spec.add_dependency 'audite', '0.3.0'
30
+ spec.add_dependency 'ruby-mp3info', '0.8.4'
31
+ spec.add_dependency 'vedeu', '0.0.41'
32
32
  end
@@ -5,9 +5,6 @@ module Playa
5
5
  describe TrackCollection do
6
6
  describe '#tracks' do
7
7
  it 'returns a collection of Track objects' do
8
- files = [
9
- "/some/path/dance.mp3"
10
- ]
11
8
  collection = TrackCollection.new
12
9
  collection.tracks.must_be_instance_of(Array)
13
10
  collection.tracks.first.must_be_instance_of(Track)
@@ -17,9 +14,9 @@ module Playa
17
14
  describe '#files' do
18
15
  it 'returns a list of files for the specified directory' do
19
16
  files = [
20
- "/some/path/dance.mp3",
21
- "/some/path/electro.mp3",
22
- "/some/path/dubstep.mp3"
17
+ '/some/path/dance.mp3',
18
+ '/some/path/electro.mp3',
19
+ '/some/path/dubstep.mp3'
23
20
  ]
24
21
  collection = TrackCollection.new
25
22
 
@@ -4,37 +4,35 @@ require 'ostruct'
4
4
  module Playa
5
5
  describe Track do
6
6
  let(:file) { '/some/path/electro.mp3' }
7
- let(:tag) {
8
- OpenStruct.new({
7
+ let(:tag) do
8
+ OpenStruct.new(
9
9
  title: 'eee-lectro',
10
10
  artist: 'Gavin Laking + Various',
11
11
  album: 'That night at Sankeys',
12
- tracknum: 3,
13
- })
14
- }
15
- let(:mp3info) {
16
- OpenStruct.new({
12
+ tracknum: 3
13
+ )
14
+ end
15
+ let(:mp3info) do
16
+ OpenStruct.new(
17
17
  filename: '/some/path/electro.mp3',
18
18
  tag: tag,
19
19
  length: 3623.0270625,
20
20
  bitrate: 320
21
- })
22
- }
21
+ )
22
+ end
23
23
  let(:track) { Track.new(file) }
24
24
 
25
25
  describe '#attributes' do
26
26
  it 'returns a collection of attributes' do
27
27
  Mp3Info.stub(:open, mp3info) do
28
28
  track.attributes.must_equal(
29
- {
30
- filename: '/some/path/electro.mp3',
31
- title: 'eee-lectro',
32
- artist: 'Gavin Laking + Various',
33
- album: 'That night at Sankeys',
34
- track_number: 3,
35
- duration: 3623.0270625,
36
- bitrate: 320
37
- }
29
+ filename: '/some/path/electro.mp3',
30
+ title: 'eee-lectro',
31
+ artist: 'Gavin Laking + Various',
32
+ album: 'That night at Sankeys',
33
+ track_number: 3,
34
+ duration: 3623.0270625,
35
+ bitrate: 320
38
36
  )
39
37
  end
40
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
@@ -129,7 +129,7 @@ dependencies:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.3.0
132
- type: :development
132
+ type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
@@ -143,7 +143,7 @@ dependencies:
143
143
  - - '='
144
144
  - !ruby/object:Gem::Version
145
145
  version: 0.8.4
146
- type: :development
146
+ type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
@@ -157,7 +157,7 @@ dependencies:
157
157
  - - '='
158
158
  - !ruby/object:Gem::Version
159
159
  version: 0.0.41
160
- type: :development
160
+ type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements: