waiting_on_rails 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,12 +1,18 @@
1
1
  [![Build Status](https://travis-ci.org/AndrewRadev/waiting-on-rails.png)](https://travis-ci.org/AndrewRadev/waiting-on-rails)
2
2
 
3
- Bored of waiting on `rails server` or `rake routes`? No more! This gem provides two commands, `waiting-on-rails` and `waiting-on-rake`. They are meant as replacements to `rails` and `rake`, respectively, so you can call them like this:
3
+ Bored of waiting on `rails server` or `rake routes`? No more! This gem provides three commands, `waiting-on-rails`, `waiting-on-rake`, and the generic `waiting-on`. The first two are meant as replacements to `rails` and `rake`, respectively, so you can call them like this:
4
4
 
5
5
  waiting-on-rails server
6
6
  waiting-on-rake db:migrate
7
7
 
8
8
  What's the difference? Aside from running the required task, they also play some relaxing elevator music, so you'll never get bored of waiting again. Problem solved!
9
9
 
10
+ You can use the third one, `waiting-on` with any command and it'll play music until it's done:
11
+
12
+ waiting-on rspec spec
13
+ waiting-on cucumber
14
+ waiting-on cap deploy
15
+
10
16
  ## Gotchas
11
17
 
12
18
  Okay, so `waiting-on-rails` only plays music for the `server` task, not for the similarly long-loading `console` cousin, but I have no idea how to run the console in a child process and control its IO. Pull requests welcome. And `waiting-on-rake` only plays music for long-running tasks (see `slow_tasks` method in [this file](https://github.com/AndrewRadev/waiting-on-rails/blob/master/lib/waiting_on_rails/rake.rb)), but that's intentional.
data/bin/waiting-on ADDED
@@ -0,0 +1,14 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ $: << File.expand_path('../../lib', __FILE__)
4
+
5
+ require 'waiting_on_rails/anything'
6
+
7
+ if ARGV.empty?
8
+ puts 'USAGE: waiting-on <command>'
9
+ end
10
+
11
+ music = WaitingOnRails::Player.new('attempt_1.mp3')
12
+ ding = WaitingOnRails::Player.new('ding.wav')
13
+
14
+ WaitingOnRails::Anything.new(music, ding).run(ARGV)
@@ -0,0 +1,26 @@
1
+ require 'waiting_on_rails/player'
2
+
3
+ module WaitingOnRails
4
+ class Anything
5
+ def initialize(music_player, ding_player = nil)
6
+ @music_player = music_player
7
+ @ding_player = ding_player
8
+ end
9
+
10
+ def run(args)
11
+ @music_player.start
12
+ Process.wait(spawn_subprocess(args))
13
+ @music_player.stop
14
+ sleep 0.5
15
+ @ding_player.start if @ding_player
16
+ ensure
17
+ @music_player.stop
18
+ end
19
+
20
+ private
21
+
22
+ def spawn_subprocess(args)
23
+ spawn *args
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module WaitingOnRails
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waiting_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-03 00:00:00.000000000 Z
13
+ date: 2013-03-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -52,14 +52,17 @@ email:
52
52
  executables:
53
53
  - waiting-on-rails
54
54
  - waiting-on-rake
55
+ - waiting-on
55
56
  extensions: []
56
57
  extra_rdoc_files: []
57
58
  files:
58
59
  - lib/waiting_on_rails/player.rb
59
60
  - lib/waiting_on_rails/rake.rb
60
61
  - lib/waiting_on_rails/rails.rb
62
+ - lib/waiting_on_rails/anything.rb
61
63
  - lib/waiting_on_rails/version.rb
62
64
  - lib/waiting_on_rails.rb
65
+ - bin/waiting-on
63
66
  - bin/waiting-on-rake
64
67
  - bin/waiting-on-rails
65
68
  - vendor/attempt_1.mp3
@@ -82,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
85
  version: '0'
83
86
  segments:
84
87
  - 0
85
- hash: -1546165163177782417
88
+ hash: 3102063916746287775
86
89
  required_rubygems_version: !ruby/object:Gem::Requirement
87
90
  none: false
88
91
  requirements: