autotask 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. data/CHANGELOG +4 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +12 -0
  4. data/Rakefile +46 -0
  5. data/bin/autotask +12 -0
  6. data/lib/autotask.rb +65 -0
  7. metadata +50 -0
@@ -0,0 +1,4 @@
1
+
2
+ = 0.1.0
3
+
4
+ * Pre-release
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2006 Geoffrey Grosenbach boss@topfunky.com
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.
21
+
data/README ADDED
@@ -0,0 +1,12 @@
1
+ autotask
2
+ ========
3
+
4
+ A simple script for running commands when Ruby file change.
5
+
6
+ Requires the stakeout command-line tool.
7
+
8
+ http://topfunky.com/clients/ruby/stakeout.tgz
9
+
10
+
11
+
12
+
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/packagetask'
4
+ require 'rake/gempackagetask'
5
+
6
+ $:.unshift(File.dirname(__FILE__) + "/lib/")
7
+ require 'autotask'
8
+
9
+ PKG_NAME = 'autotask'
10
+ PKG_VERSION = Autotask::VERSION
11
+ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
+
13
+ RELEASE_NAME = "REL #{PKG_VERSION}"
14
+
15
+ RUBY_FORGE_PROJECT = PKG_NAME
16
+ RUBY_FORGE_USER = "topfunky"
17
+
18
+ # Create compressed packages
19
+ spec = Gem::Specification.new do |s|
20
+ s.platform = Gem::Platform::RUBY
21
+ s.name = PKG_NAME
22
+ s.summary = "A script to run shell commands when Ruby files change."
23
+ s.description = %q{Runs any shell command or rake task when specified files are updated. Requires the stakeout command-line tool for Mac OS X.}
24
+ s.version = PKG_VERSION
25
+
26
+ s.authors = ["Geoffrey Grosenbach"]
27
+ s.email = "boss@topfunky.com"
28
+ s.rubyforge_project = RUBY_FORGE_PROJECT
29
+ s.homepage = "http://nubyonrails.com/pages/stakeout"
30
+
31
+ s.has_rdoc = false
32
+ s.requirements << 'none'
33
+ s.require_path = 'lib'
34
+
35
+ s.files = [ "Rakefile", "README", "CHANGELOG", "MIT-LICENSE" ]
36
+ %w(bin lib).each do |dir|
37
+ s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
38
+ end
39
+ s.executables = ["autotask"]
40
+ end
41
+
42
+ Rake::GemPackageTask.new(spec) do |p|
43
+ p.gem_spec = spec
44
+ p.need_tar = true
45
+ p.need_zip = true
46
+ end
@@ -0,0 +1,12 @@
1
+ #!/usr/local/bin/ruby -ws
2
+
3
+ require "autotask"
4
+
5
+ $h ||= false
6
+ $help ||= false
7
+ if $h or $help then
8
+ Autotask.usage
9
+ else
10
+ Autotask.run
11
+ end
12
+
@@ -0,0 +1,65 @@
1
+ ##
2
+ # Run a command with stakeout when any
3
+ # Ruby files in subdirectories change.
4
+ #
5
+ # Requires this tool (only for MacOS X): http://topfunky.com/clients/ruby/stakeout.tgz
6
+ #
7
+ # AUTHOR: Geoffrey Grosenbach http://nubyonrails.com
8
+
9
+ class Autotask
10
+
11
+ VERSION = '0.1.1'
12
+
13
+ def self.run
14
+ # Get the command to run
15
+ command = ARGV.shift || 'rake'
16
+
17
+ # Watch files recursively in all folders requested
18
+ watched_folders = ARGV.length > 0 ?
19
+ ARGV.map { |f| "#{f.gsub(/\/$/, '')}/**/*.rb" } :
20
+ ['**/*.rb']
21
+ watched_files = watched_folders.map { |f| Dir[f] }.flatten
22
+
23
+ puts <<-MSG
24
+ Watching #{watched_files.length} file(s): #{watched_files.join(' ')}
25
+ Hit ^C to quit.
26
+ MSG
27
+
28
+ results = IO.popen(%(stakeout "#{command}" #{watched_files.join(' ')}))
29
+
30
+ trap('INT') do
31
+ puts "\nClosing stakeout..."
32
+ results.close
33
+ exit
34
+ end
35
+
36
+ while results.gets do
37
+ puts $_
38
+ end
39
+ end
40
+
41
+ def self.usage
42
+ puts <<-HELP
43
+ Runs a command when .rb files change. The default is to run 'rake' and watch all Ruby files in the current directory and all subdirectories.
44
+
45
+ #{$0} [command_to_run folders_to_watch]
46
+
47
+ Examples:
48
+
49
+ Run a specific test
50
+ #{$0} 'ruby test/bar_test.rb'
51
+
52
+ Run a specific rake task
53
+ #{$0} 'rake clean'
54
+
55
+ Run rake for all .rb files in 'test' and subfolders
56
+ #{$0} rake test
57
+
58
+ Run test:recent for all .rb files in 'app' and 'test'
59
+ #{$0} 'rake test:recent' app test
60
+
61
+ HELP
62
+ exit
63
+ end
64
+
65
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: autotask
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.1
7
+ date: 2006-08-04 00:00:00 -07:00
8
+ summary: A script to run shell commands when Ruby files change.
9
+ require_paths:
10
+ - lib
11
+ email: boss@topfunky.com
12
+ homepage: http://nubyonrails.com/pages/stakeout
13
+ rubyforge_project: autotask
14
+ description: Runs any shell command or rake task when specified files are updated. Requires the stakeout command-line tool for Mac OS X.
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ authors:
29
+ - Geoffrey Grosenbach
30
+ files:
31
+ - Rakefile
32
+ - README
33
+ - CHANGELOG
34
+ - MIT-LICENSE
35
+ - bin/autotask
36
+ - lib/autotask.rb
37
+ test_files: []
38
+
39
+ rdoc_options: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ executables:
44
+ - autotask
45
+ extensions: []
46
+
47
+ requirements:
48
+ - none
49
+ dependencies: []
50
+