mikeplayer 1.0.5 → 1.1.1

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
  SHA256:
3
- metadata.gz: e9879977df429314cabecaa45ecfbb6ccbbacec7fc37373ff662f9bad7e45e9b
4
- data.tar.gz: cf6ae72fbce490df8c9cd4c38c79ba5981b6d0f3e4bf9ffa49c75177da53daac
3
+ metadata.gz: 44526118ece6d69a3b2711ec7595ebf65da59a0729e49439b663b8c28d0db6ac
4
+ data.tar.gz: fd2a73b35a0d17a834f098a92a8f34485bb67e4d68a7889d05389626f0ea9560
5
5
  SHA512:
6
- metadata.gz: 9c033b5878334afee9c6dbe67f7a1695e8d128450d543bc441fab2bc94d0ab88ea2723701446f56284c734a4b9d1caa63e60a7a9250bf570b5f2fe20a3f984ea
7
- data.tar.gz: df8957048df10a07ed5a0a3169a93a479fdeea622dac3c4af8bfb344be89ab0ee71ab83a8e079ecc1adfb69440d4f5330237455b8c8c8da4ec983c0898931de9
6
+ metadata.gz: 1642c31f25824a61692fb4c7a8a0d8b1d61c06369ae7ccb85f231a82fbe3c6f62d7c30e7dbbaf77751fb72f0abc67cfa6b2cabacc795f0eb08bf592db0af8b53
7
+ data.tar.gz: 37491c892b710fd8984da1bf95995043a1c7569d04c34856d4b136b00242644f3dc6692088cd75e003749296a838b160f6886ef1907e257abd0d32a490e343ea
data/lib/mikeplayer.rb CHANGED
@@ -4,29 +4,29 @@ require 'open3'
4
4
  require 'io/console'
5
5
  require 'mp3info'
6
6
  require 'mikeplayer/version'
7
- require 'mikeplayer/settings'
7
+ require 'mikeplayer/display'
8
8
  require 'mikeplayer/playlist'
9
+ require 'mikeplayer/play_thread'
10
+ require 'mikeplayer/settings'
9
11
  require 'mikeplayer/song'
10
12
 
11
13
  module MikePlayer
12
14
  class Player
13
- PAUSE_INDICATOR = "||".freeze
14
- INDICATOR_SIZE = 4
15
- SLEEP_SETTING = 0.5
15
+ PLAY_SLEEP = 0.5
16
+ PAUSE_SLEEP = 1.0
16
17
  STOPPED = :stopped
17
18
  PLAYING = :playing
18
19
  PAUSED = :paused
20
+ SONG_CHANGE = :song_change
19
21
 
20
22
  def initialize(options, *args)
21
23
  @settings = Settings.new(options)
22
24
  @playlist = Playlist.new(@settings.playlist)
23
25
  @minutes = @settings.minutes
24
26
  @command = ''
25
- @pid = nil
26
- @timer_start = nil
27
+ @timer_start = Time.now if (@minutes > 0)
27
28
  @state = STOPPED
28
-
29
- check_system
29
+ @player = PlayThread.new(volume: @settings.volume)
30
30
 
31
31
  if (true == @settings.list?)
32
32
  @songs.map { |song| File.basename(song) }.sort.each {|song| puts "#{File.basename(song)}"}
@@ -58,66 +58,36 @@ module MikePlayer
58
58
  end
59
59
 
60
60
  @thread = Thread.new do
61
- @song_i = 0
62
- display_width = 0
61
+ @display = Display.new
62
+ @song_i = 0
63
63
 
64
64
  while (@song_i < @playlist.size)
65
- song = @playlist.get(@song_i)
66
- @song_start = Time.now
67
- @pause_time = nil
68
- info_prefix = "\r#{@playlist.song_info(@song_i)}".freeze
65
+ @display.song_info = @playlist.song_info(@song_i)
69
66
 
70
- stdin, stdother, thread_info = Open3.popen2e('play', '--no-show-progress', '--volume', @settings.volume, song.filename)
67
+ @player.play(song.filename)
71
68
 
72
69
  @state = PLAYING
73
- @pid = thread_info.pid
74
- indicator = ''
75
- info_changed = false
76
70
 
77
- while (true == pid_alive?)
71
+ while @player.playing?
78
72
  pause_if_over_time_limit
79
73
 
80
- if (true == playing?)
81
- indicator = "#{'>' * (playing_time % INDICATOR_SIZE)}".ljust(INDICATOR_SIZE)
82
- info_changed = true
83
- elsif (true == paused?) && (false == indicator.include?(PAUSE_INDICATOR))
84
- indicator = PAUSE_INDICATOR.ljust(INDICATOR_SIZE)
85
- info_changed = true
86
- end
87
-
88
- if (true == info_changed)
89
- mindicator = ""
90
-
91
- if (0 < minutes_remaining)
92
- mindicator = "(#{minutes_remaining}↓) "
93
- end
94
-
95
- print("\r" << ' '.ljust(display_width))
74
+ @display.elapsed = @player.elapsed if playing?
96
75
 
97
- info = "#{info_prefix} #{song.length_str(playing_time)} #{mindicator}#{indicator}"
76
+ @display.display!(song.length_str(@player.elapsed), minutes_remaining)
98
77
 
99
- print(info)
100
-
101
- display_width = info.size
102
-
103
- info_changed = false
104
- $stdout.flush
105
- end
106
-
107
- sleep SLEEP_SETTING
78
+ sleep(sleep_time)
108
79
  end
109
80
 
110
- stdin.close
111
- stdother.close
112
-
113
- @pid = nil
114
-
115
- if (true == playing?) && (playing_time >= (song.length - 1))
81
+ if playing? && @player.stopped?
116
82
  next_song
83
+ elsif paused?
84
+ while paused?
85
+ sleep(sleep_time)
86
+ end
117
87
  end
118
88
  end
119
89
 
120
- @pid = nil
90
+ @player.stop
121
91
  print("\r\n")
122
92
  exit
123
93
  end
@@ -127,30 +97,8 @@ module MikePlayer
127
97
  print("\r\n")
128
98
  end
129
99
 
130
- def cmd_exist?(cmd)
131
- if (true != system('command'))
132
- raise "Missing 'command' command, which is used to test compatibility."
133
- end
134
-
135
- if (true != system("command -v #{cmd} >/dev/null 2>&1"))
136
- return false
137
- end
138
-
139
- return true
140
- end
141
-
142
100
  private
143
101
 
144
- def check_system
145
- %w(play).each do |cmd|
146
- if (false == cmd_exist?(cmd))
147
- raise "#{cmd} failed, do you have sox installed?"
148
- end
149
- end
150
-
151
- return nil
152
- end
153
-
154
102
  def wait_on_user
155
103
  while ('q' != @command)
156
104
  @command = STDIN.getch
@@ -161,9 +109,8 @@ module MikePlayer
161
109
  next_song
162
110
  elsif ('z' == @command)
163
111
  previous_song
164
- elsif ('q' == @command) && (false == @pid.nil?)
165
- stop_song
166
- @thread.kill
112
+ elsif ('q' == @command)
113
+ press_stop
167
114
  elsif ('t' == @command)
168
115
  @timer_start = Time.now
169
116
  elsif (false == @timer_start.nil?) && ("#{@command.to_i}" == @command)
@@ -185,68 +132,58 @@ module MikePlayer
185
132
  return (PAUSED == @state)
186
133
  end
187
134
 
188
- def press_pause
189
- if (true == playing?)
190
- kill("STOP")
191
- @pause_time = Time.now
192
- @state = PAUSED
193
- elsif (true == paused?)
194
- kill("CONT")
195
- @song_start += (Time.now - @pause_time)
196
- @pause_time = nil
197
- @state = PLAYING
198
- else
199
- print("Confused state #{@state}.")
200
- end
135
+ def changing?
136
+ return (SONG_CHANGE == @state)
201
137
  end
202
138
 
203
- def stop_song
204
- kill("INT")
205
-
206
- sleep 0.2
207
-
208
- if (true == pid_alive?)
209
- kill("KILL")
210
- end
211
-
139
+ def press_stop
140
+ @player.stop
212
141
  @state = STOPPED
213
142
  end
214
143
 
215
- def pid_alive?(pid = @pid)
216
- if (false == pid.nil?)
217
- return system("ps -p #{pid} > /dev/null")
218
- end
144
+ def press_pause
145
+ debug('|')
219
146
 
220
- return false
147
+ if playing?
148
+ debug('>')
149
+ @state = PAUSED
150
+ @display.paused
151
+ @player.pause
152
+ elsif paused?
153
+ debug('|')
154
+ @state = PLAYING
155
+ else
156
+ print("Confused state #{@state}.")
157
+ end
221
158
  end
222
159
 
223
160
  def next_song
224
161
  debug('n')
225
- stop_song
162
+
163
+ @state = SONG_CHANGE
164
+
165
+ @player.stop
226
166
 
227
167
  @song_i += 1
228
168
  end
229
169
 
230
170
  def previous_song
231
171
  debug('p')
232
- stop_song
233
172
 
234
- if (playing_time < 10)
235
- @song_i -= 1 unless @song_i <= 0
173
+ @state = SONG_CHANGE
174
+
175
+ if (@player.elapsed < 10)
176
+ @song_i -= 1 if @song_i.positive?
236
177
  else
237
178
  debug('x')
238
179
  end
239
- end
240
180
 
241
- def kill(signal)
242
- if (false == @pid.nil?)
243
- Process.kill(signal, @pid)
244
- end
181
+ @player.stop
245
182
  end
246
183
 
247
184
  def pause_if_over_time_limit
248
185
  if (false == @timer_start.nil?) && (0 < @minutes) && (true == playing?)
249
- if (0 > minutes_remaining)
186
+ if (minutes_remaining && 0 >= minutes_remaining)
250
187
  press_pause
251
188
  @timer_start = nil
252
189
  @minutes = 0
@@ -254,24 +191,20 @@ module MikePlayer
254
191
  end
255
192
  end
256
193
 
257
- def playing_time
258
- return (Time.now - @song_start).to_i - pause_time
194
+ def minutes_remaining
195
+ return if ((0 == @minutes) || (@timer_start.nil?))
196
+
197
+ (@minutes - ((Time.now - @timer_start).to_i / 60).to_i)
259
198
  end
260
199
 
261
- def pause_time
262
- if (@pause_time.nil?)
263
- return 0
264
- else
265
- return (Time.now - @pause_time).to_i
266
- end
200
+ def sleep_time
201
+ return PLAY_SLEEP if playing?
202
+
203
+ PAUSE_SLEEP
267
204
  end
268
205
 
269
- def minutes_remaining
270
- if ((0 == @minutes) || (@timer_start.nil?))
271
- return -1
272
- else
273
- return (@minutes - ((Time.now - @timer_start).to_i / 60).to_i)
274
- end
206
+ def song
207
+ @playlist.get(@song_i)
275
208
  end
276
209
 
277
210
  def debug(str)
@@ -0,0 +1,49 @@
1
+ module MikePlayer
2
+ class Display
3
+ PAUSE_INDICATOR = '||'.freeze
4
+ INDICATOR_SIZE = 4
5
+
6
+ def initialize
7
+ @width = 0
8
+ @indicator = ''
9
+ @changed = false
10
+ end
11
+
12
+ def song_info=(v)
13
+ @info_prefix = "\r#{v}".freeze
14
+ end
15
+
16
+ def elapsed=(v)
17
+ @indicator = "#{'>' * (v % INDICATOR_SIZE)}".ljust(INDICATOR_SIZE)
18
+ @changed = true
19
+ end
20
+
21
+ def paused
22
+ if (false == @indicator.include?(PAUSE_INDICATOR))
23
+ @indicator = PAUSE_INDICATOR.ljust(INDICATOR_SIZE)
24
+ @changed = true
25
+ end
26
+ end
27
+
28
+ def display!(elapsed_info, countdown = nil)
29
+ return unless changed?
30
+
31
+ mindicator = "(#{countdown}↓) " if countdown
32
+
33
+ print("\r" << ' '.ljust(@width))
34
+
35
+ info = "#{@info_prefix} #{elapsed_info} #{mindicator}#{@indicator}"
36
+
37
+ print(info)
38
+
39
+ @width = info.size
40
+ @changed = false
41
+
42
+ $stdout.flush
43
+ end
44
+
45
+ def changed?
46
+ true == @changed
47
+ end
48
+ end
49
+ end
@@ -1,13 +1,141 @@
1
1
  module MikePlayer
2
2
  class PlayThread
3
- def self.run(file, volume)
3
+ def initialize(volume: 1.0)
4
+ check_system
5
+
6
+ @pid = nil
7
+ @volume = volume
8
+ @start_t = 0
9
+ @elapsed = 0
10
+ @paused = false
11
+ end
12
+
13
+ def play(file)
14
+ start_position = 0
15
+
16
+ if paused?
17
+ start_position = @elapsed
18
+ else
19
+ @elapsed = 0
20
+ end
21
+
22
+ start_thread(file: file, start_position: start_position)
23
+
24
+ @start_t = Time.now.to_i
25
+ end
26
+
27
+ def stop
28
+ pause
29
+
30
+ @elapsed = 0
31
+ @start_t = 0
32
+ @paused = false
33
+ end
34
+
35
+ def pause
36
+ kill('INT')
37
+
38
+ @elapsed += Time.now.to_i - @start_t
39
+ @start_t = 0
40
+
41
+ 10.times do
42
+ break unless alive?
43
+
44
+ sleep 0.1
45
+ end
46
+
47
+ kill('KILL')
48
+
49
+ 10.times do
50
+ break unless alive?
51
+
52
+ sleep 0.1
53
+ end
54
+
55
+ @paused = true
56
+ end
57
+
58
+ def kill(signal)
59
+ Process.kill(signal, @pid) if alive?
60
+ end
61
+
62
+ def alive?
63
+ MikePlayer::PlayThread.alive?(@pid)
64
+ end
65
+
66
+ def stopped?
67
+ false == alive?
68
+ end
69
+
70
+ def paused?
71
+ @paused && stopped?
72
+ end
73
+
74
+ def playing?
75
+ alive?
76
+ end
77
+
78
+ def elapsed
79
+ return (@elapsed + (Time.now.to_i - @start_t)) if @start_t.positive?
80
+
81
+ @elapsed
82
+ end
83
+
84
+ def self.alive?(pid)
85
+ return system("ps -p #{pid} > /dev/null") unless pid.nil?
86
+
87
+ false
88
+ end
89
+
90
+ def self.cmd_exist?(cmd)
91
+ if @test_cmd.nil?
92
+ if system('command')
93
+ @test_cmd = 'command -v'
94
+ elsif system('bash -c "command"')
95
+ @test_cmd = 'bash -c "command -v"'
96
+ else
97
+ raise "Missing 'command' command, which is used to test compatibility."
98
+ end
99
+ end
100
+
101
+ if (true != system("#{@test_cmd} #{cmd} >/dev/null 2>&1"))
102
+ return false
103
+ end
104
+
105
+ return true
106
+ end
107
+
108
+ private
109
+ def start_thread(file:, start_position: )
4
110
  args = [
5
- :play,
111
+ 'play',
6
112
  '--no-show-progress',
7
- '--volume', volume,
8
- song
113
+ '--volume', @volume.to_s,
114
+ file,
115
+ 'trim', start_position.to_s,
9
116
  ]
10
- Open3.popen2e(*args) do |stdin, out, wait_thr|
117
+
118
+ stdin, stdother, thread_info = Open3.popen2e(*args)
119
+
120
+ @pid = thread_info.pid
121
+
122
+ 10.times do
123
+ break if alive?
124
+
125
+ sleep 0.2
126
+ end
127
+
128
+ raise "Failed to play #{stdother.read}" unless alive?
129
+
130
+ stdin.close
131
+ stdother.close
132
+
133
+ self
134
+ end
135
+
136
+ def check_system
137
+ %w[play].each do |cmd|
138
+ raise "#{cmd} failed, do you have sox installed?" unless MikePlayer::PlayThread.cmd_exist?(cmd)
11
139
  end
12
140
  end
13
141
  end
@@ -64,7 +64,7 @@ module MikePlayer
64
64
  end
65
65
 
66
66
  def info
67
- return "#{self.name} loaded #{@loaded_song_count} songs with length #{Song.as_duration_str(@length)}, added #{self.size - @loaded_song_count}"
67
+ return "#{self.name} loaded #{@loaded_song_count} and added #{self.size - @loaded_song_count} songs with length #{Song.as_duration_str(@length)}"
68
68
  end
69
69
 
70
70
  def song_info(i)
@@ -1,3 +1,3 @@
1
1
  module MikePlayer
2
- VERSION = '1.0.5'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
data/mikeplayer.gemspec CHANGED
@@ -3,15 +3,15 @@ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'mikeplayer/version'
5
5
 
6
- Gem::Specification.new do |gem|
7
- gem.name = 'mikeplayer'
8
- gem.version = MikePlayer::VERSION
9
- gem.authors = ['Mike Crockett']
10
- gem.email = ['rubygems@mmcrockett.com']
11
- gem.summary = 'Wraps Sox\'s `play` command, allowing playslists, find, random and time limit.'
12
- gem.executables << 'MikePlayer.rb'
13
- gem.description = <<-EOF.gsub(/^\s+/, '')
14
- #{gem.summary}
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'mikeplayer'
8
+ spec.version = MikePlayer::VERSION
9
+ spec.authors = ['Mike Crockett']
10
+ spec.email = ['rubygems@mmcrockett.com']
11
+ spec.summary = 'Wraps Sox\'s `play` command, allowing playslists, find, random and time limit.'
12
+ spec.executables << 'MikePlayer.rb'
13
+ spec.description = <<-EOF.gsub(/^\s+/, '')
14
+ #{spec.summary}
15
15
 
16
16
  Once a song is playing you can:
17
17
  'x' to previous
@@ -20,17 +20,20 @@ Gem::Specification.new do |gem|
20
20
  'q' to quit
21
21
  't' n to set a timer that will pause the music after n minutes
22
22
  EOF
23
- gem.homepage = 'https://github.com/mmcrockett/mikeplayer'
23
+ spec.homepage = 'https://github.com/mmcrockett/mikeplayer'
24
24
 
25
- gem.files = `git ls-files`.split($/)
26
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
27
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
28
- gem.require_paths = ['lib']
29
- gem.licenses = ['MIT']
25
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
+ f.match?(%r{^(test|spec|features|helpers|)/}) || f.match?(%r{^(\.[[:alnum:]]+)}) || f.match?(/console/)
27
+ end
30
28
 
31
- gem.add_dependency 'json', '~> 1.8'
32
- gem.add_dependency 'ruby-mp3info', '~> 0.8'
33
- gem.add_dependency 'minitest', '~> 5'
34
- gem.add_development_dependency 'rake', '~> 12'
35
- gem.add_development_dependency 'byebug', '~> 11'
29
+ spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
30
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
31
+ spec.require_paths = ['lib']
32
+ spec.licenses = ['MIT']
33
+
34
+ spec.add_dependency 'json', '~> 2.5'
35
+ spec.add_dependency 'ruby-mp3info', '~> 0.8'
36
+ spec.add_dependency 'minitest', '~> 5'
37
+ spec.add_development_dependency 'rake', '~> 12'
38
+ spec.add_development_dependency 'byebug', '~> 11'
36
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mikeplayer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Crockett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-30 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.8'
19
+ version: '2.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.8'
26
+ version: '2.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-mp3info
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -95,13 +95,13 @@ executables:
95
95
  extensions: []
96
96
  extra_rdoc_files: []
97
97
  files:
98
- - ".gitignore"
99
98
  - Gemfile
100
99
  - LICENSE
101
100
  - README.md
102
101
  - Rakefile
103
102
  - bin/MikePlayer.rb
104
103
  - lib/mikeplayer.rb
104
+ - lib/mikeplayer/display.rb
105
105
  - lib/mikeplayer/executable.rb
106
106
  - lib/mikeplayer/play_thread.rb
107
107
  - lib/mikeplayer/playlist.rb
@@ -109,9 +109,6 @@ files:
109
109
  - lib/mikeplayer/song.rb
110
110
  - lib/mikeplayer/version.rb
111
111
  - mikeplayer.gemspec
112
- - test/mikeplayer/settings_test.rb
113
- - test/mikeplayer_test.rb
114
- - test/test_helper.rb
115
112
  homepage: https://github.com/mmcrockett/mikeplayer
116
113
  licenses:
117
114
  - MIT
@@ -131,12 +128,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
128
  - !ruby/object:Gem::Version
132
129
  version: '0'
133
130
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.7.6
131
+ rubygems_version: 3.1.4
136
132
  signing_key:
137
133
  specification_version: 4
138
134
  summary: Wraps Sox's `play` command, allowing playslists, find, random and time limit.
139
- test_files:
140
- - test/mikeplayer/settings_test.rb
141
- - test/mikeplayer_test.rb
142
- - test/test_helper.rb
135
+ test_files: []
data/.gitignore DELETED
@@ -1,51 +0,0 @@
1
- *.gem
2
- Gemfile.lock
3
- *.rbc
4
- /.config
5
- /coverage/
6
- /InstalledFiles
7
- /pkg/
8
- /spec/reports/
9
- /spec/examples.txt
10
- /test/tmp/
11
- /test/version_tmp/
12
- /tmp/
13
-
14
- # Used by dotenv library to load environment variables.
15
- # .env
16
-
17
- ## Specific to RubyMotion:
18
- .dat*
19
- .repl_history
20
- build/
21
- *.bridgesupport
22
- build-iPhoneOS/
23
- build-iPhoneSimulator/
24
-
25
- ## Specific to RubyMotion (use of CocoaPods):
26
- #
27
- # We recommend against adding the Pods directory to your .gitignore. However
28
- # you should judge for yourself, the pros and cons are mentioned at:
29
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
30
- #
31
- # vendor/Pods/
32
-
33
- ## Documentation cache and generated files:
34
- /.yardoc/
35
- /_yardoc/
36
- /doc/
37
- /rdoc/
38
-
39
- ## Environment normalization:
40
- /.bundle/
41
- /vendor/bundle
42
- /lib/bundler/man/
43
-
44
- # for a library or gem, you might want to ignore these files since the code is
45
- # intended to run in multiple environments; otherwise, check them in:
46
- # Gemfile.lock
47
- # .ruby-version
48
- # .ruby-gemset
49
-
50
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
51
- .rvmrc
@@ -1,17 +0,0 @@
1
- require 'test_helper'
2
-
3
- class SettingsTest < Minitest::Test
4
- describe 'settings' do
5
- let(:home) { File.join('', 'tmp') }
6
- let(:sdir) { File.join(home, MikePlayer::Settings::SETTINGS_DIRECTORY) }
7
-
8
- before do
9
- Dir.delete(sdir) if Dir.exist?(sdir)
10
- end
11
-
12
- it 'creates a settings directory' do
13
- MikePlayer::Settings.new(home: home)
14
- assert(Dir.exist?(sdir))
15
- end
16
- end
17
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- class MikePlayerTest < Minitest::Test
4
- describe 'mikeplayer' do
5
- it 'has a version' do
6
- assert(MikePlayer::VERSION)
7
- end
8
- end
9
- end
data/test/test_helper.rb DELETED
@@ -1,5 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
2
- require 'mikeplayer'
3
-
4
- require 'minitest/autorun'
5
- require 'byebug'