looprun 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +16 -0
- data/LICENSE +20 -0
- data/README.rdoc +22 -0
- data/Rakefile +59 -0
- data/VERSION +1 -0
- data/bin/looprun +40 -0
- data/lib/looprun.rb +0 -0
- data/looprun.gemspec +62 -0
- data/test/helper.rb +10 -0
- data/test/test_looprun.rb +8 -0
- metadata +107 -0
data/.document
ADDED
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Christoph Olszowka
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
= looprun
|
2
|
+
|
3
|
+
Simple script to repeatedly execute shell commands after they exit - for example to automatically restart your server
|
4
|
+
|
5
|
+
gem install looprun
|
6
|
+
looprun "rails server -p 4567" # will automatically restart after 3 seconds (default)
|
7
|
+
looprun "rake test" --timeout 300 # Run tests every five minutes
|
8
|
+
|
9
|
+
|
10
|
+
== Note on Patches/Pull Requests
|
11
|
+
|
12
|
+
* Fork the project.
|
13
|
+
* Make your feature addition or bug fix.
|
14
|
+
* Add tests for it. This is important so I don't break it in a
|
15
|
+
future version unintentionally.
|
16
|
+
* Commit, do not mess with rakefile, version, or history.
|
17
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
18
|
+
* Send me a pull request. Bonus points for topic branches.
|
19
|
+
|
20
|
+
== Copyright
|
21
|
+
|
22
|
+
Copyright (c) 2010 Christoph Olszowka. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "looprun"
|
8
|
+
gem.summary = %Q{Simple script to repeatedly execute shell commands after they exit}
|
9
|
+
gem.description = %Q{looprun is a simple script to repeatedly execute shell commands after they exit - for example to automatically restart your server}
|
10
|
+
gem.email = "christoph at olszowka de"
|
11
|
+
gem.homepage = "http://github.com/colszowka/looprun"
|
12
|
+
gem.authors = ["Christoph Olszowka"]
|
13
|
+
|
14
|
+
gem.bindir = 'bin'
|
15
|
+
gem.executables = ['looprun']
|
16
|
+
gem.default_executable = 'looprun'
|
17
|
+
|
18
|
+
gem.add_dependency "trollop", ">= 1.16.0"
|
19
|
+
gem.add_development_dependency "shoulda", "2.10.3"
|
20
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
21
|
+
end
|
22
|
+
Jeweler::GemcutterTasks.new
|
23
|
+
rescue LoadError
|
24
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
Rake::TestTask.new(:test) do |test|
|
29
|
+
test.libs << 'lib' << 'test'
|
30
|
+
test.pattern = 'test/**/test_*.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
|
34
|
+
begin
|
35
|
+
require 'rcov/rcovtask'
|
36
|
+
Rcov::RcovTask.new do |test|
|
37
|
+
test.libs << 'test'
|
38
|
+
test.pattern = 'test/**/test_*.rb'
|
39
|
+
test.verbose = true
|
40
|
+
end
|
41
|
+
rescue LoadError
|
42
|
+
task :rcov do
|
43
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
task :test => :check_dependencies
|
48
|
+
|
49
|
+
task :default => :test
|
50
|
+
|
51
|
+
require 'rake/rdoctask'
|
52
|
+
Rake::RDocTask.new do |rdoc|
|
53
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
54
|
+
|
55
|
+
rdoc.rdoc_dir = 'rdoc'
|
56
|
+
rdoc.title = "looprun #{version}"
|
57
|
+
rdoc.rdoc_files.include('README*')
|
58
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
59
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/looprun
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'trollop'
|
4
|
+
|
5
|
+
command = ARGV.shift
|
6
|
+
|
7
|
+
if command.nil? or command.strip.length == 0 or command =~ /^\-/
|
8
|
+
ARGV << "--help"
|
9
|
+
end
|
10
|
+
|
11
|
+
options = Trollop::options do
|
12
|
+
version "looprun #{File.read(File.join(File.dirname(__FILE__), '../VERSION')).strip.chomp} (c) 2010 Christoph Olszowka, released under MIT License"
|
13
|
+
banner <<-EOS
|
14
|
+
looprun is a simple script to repeatedly execute shell commands after they exit - for example to automatically restart your server
|
15
|
+
|
16
|
+
Usage:
|
17
|
+
looprun COMMAND [options]
|
18
|
+
|
19
|
+
where [options] are:
|
20
|
+
EOS
|
21
|
+
|
22
|
+
opt :timeout, "Waiting time before relaunching", :default => 3, :short => '-t'
|
23
|
+
end
|
24
|
+
|
25
|
+
trap('INT') do
|
26
|
+
puts
|
27
|
+
puts "Interrupted, exiting"
|
28
|
+
exit
|
29
|
+
end
|
30
|
+
|
31
|
+
loop do
|
32
|
+
puts "Invoking '#{command}'"
|
33
|
+
system command
|
34
|
+
print "Command '#{command}' finished, waiting for #{options[:timeout]} seconds before relaunch. Press CTRL-C to abort"
|
35
|
+
options[:timeout].times do
|
36
|
+
sleep 1
|
37
|
+
print '.'
|
38
|
+
end
|
39
|
+
puts "", ""
|
40
|
+
end
|
data/lib/looprun.rb
ADDED
File without changes
|
data/looprun.gemspec
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{looprun}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Christoph Olszowka"]
|
12
|
+
s.date = %q{2010-10-23}
|
13
|
+
s.default_executable = %q{looprun}
|
14
|
+
s.description = %q{looprun is a simple script to repeatedly execute shell commands after they exit - for example to automatically restart your server}
|
15
|
+
s.email = %q{christoph at olszowka de}
|
16
|
+
s.executables = ["looprun"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE",
|
27
|
+
"README.rdoc",
|
28
|
+
"Rakefile",
|
29
|
+
"VERSION",
|
30
|
+
"bin/looprun",
|
31
|
+
"lib/looprun.rb",
|
32
|
+
"looprun.gemspec",
|
33
|
+
"test/helper.rb",
|
34
|
+
"test/test_looprun.rb"
|
35
|
+
]
|
36
|
+
s.homepage = %q{http://github.com/colszowka/looprun}
|
37
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
s.rubygems_version = %q{1.3.7}
|
40
|
+
s.summary = %q{Simple script to repeatedly execute shell commands after they exit}
|
41
|
+
s.test_files = [
|
42
|
+
"test/helper.rb",
|
43
|
+
"test/test_looprun.rb"
|
44
|
+
]
|
45
|
+
|
46
|
+
if s.respond_to? :specification_version then
|
47
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
48
|
+
s.specification_version = 3
|
49
|
+
|
50
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
51
|
+
s.add_runtime_dependency(%q<trollop>, [">= 1.16.0"])
|
52
|
+
s.add_development_dependency(%q<shoulda>, ["= 2.10.3"])
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<trollop>, [">= 1.16.0"])
|
55
|
+
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
|
56
|
+
end
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<trollop>, [">= 1.16.0"])
|
59
|
+
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
data/test/helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: looprun
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Christoph Olszowka
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-10-23 00:00:00 +02:00
|
18
|
+
default_executable: looprun
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: trollop
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 16
|
31
|
+
- 0
|
32
|
+
version: 1.16.0
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: shoulda
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - "="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 2
|
45
|
+
- 10
|
46
|
+
- 3
|
47
|
+
version: 2.10.3
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
50
|
+
description: looprun is a simple script to repeatedly execute shell commands after they exit - for example to automatically restart your server
|
51
|
+
email: christoph at olszowka de
|
52
|
+
executables:
|
53
|
+
- looprun
|
54
|
+
extensions: []
|
55
|
+
|
56
|
+
extra_rdoc_files:
|
57
|
+
- LICENSE
|
58
|
+
- README.rdoc
|
59
|
+
files:
|
60
|
+
- .document
|
61
|
+
- .gitignore
|
62
|
+
- Gemfile
|
63
|
+
- Gemfile.lock
|
64
|
+
- LICENSE
|
65
|
+
- README.rdoc
|
66
|
+
- Rakefile
|
67
|
+
- VERSION
|
68
|
+
- bin/looprun
|
69
|
+
- lib/looprun.rb
|
70
|
+
- looprun.gemspec
|
71
|
+
- test/helper.rb
|
72
|
+
- test/test_looprun.rb
|
73
|
+
has_rdoc: true
|
74
|
+
homepage: http://github.com/colszowka/looprun
|
75
|
+
licenses: []
|
76
|
+
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options:
|
79
|
+
- --charset=UTF-8
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
version: "0"
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
version: "0"
|
98
|
+
requirements: []
|
99
|
+
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 1.3.7
|
102
|
+
signing_key:
|
103
|
+
specification_version: 3
|
104
|
+
summary: Simple script to repeatedly execute shell commands after they exit
|
105
|
+
test_files:
|
106
|
+
- test/helper.rb
|
107
|
+
- test/test_looprun.rb
|