automaker 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
@@ -0,0 +1,28 @@
1
+ = automaker
2
+
3
+ This tool is inspired by autotest/autospec and automatically calls make when something changes in the directory it monitors. I added the 'r' in automakeR because I don't want to clash with GNU automake.
4
+
5
+ == Prerequisites and dependencies
6
+
7
+ * uses FSEvents API so work only on Mac OS X
8
+ * requires fsevents gem
9
+
10
+ == Installing
11
+
12
+ It's on gemcutter so just do:
13
+
14
+ $ sudo gem install fsevents automaker
15
+
16
+ == Using
17
+
18
+ Like autospec:
19
+
20
+ $ automaker [/path/to/watch]
21
+
22
+ == Todo
23
+
24
+ * need to make it return a proper exit code
25
+ * make it react to ctrl-c autospec-style
26
+ - ctrl-c c to make clean
27
+ - ctrl-c a to make all
28
+ - ctrl-c ctrl-c to exit
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "automaker"
8
+ gem.summary = "Not autotest, not autospec, but automake(r)"
9
+ gem.description = "Will monitor a directory using fsevents api and call make when something changes. Only works on Mac OS X."
10
+ gem.email = "ronaldpaulusevers@gmail.com"
11
+ gem.homepage = "http://github.com/ronaldevers/automaker"
12
+ gem.authors = ["Ronald Evers"]
13
+ gem.add_dependency "fsevents", ">= 0.1.1"
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
18
+ end
19
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,49 @@
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{automaker}
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 = ["Ronald Evers"]
12
+ s.date = %q{2009-12-15}
13
+ s.default_executable = %q{automaker}
14
+ s.description = %q{Will monitor a directory using fsevents api and call make when something changes. Only works on Mac OS X.}
15
+ s.email = %q{ronaldpaulusevers@gmail.com}
16
+ s.executables = ["automaker"]
17
+ s.extra_rdoc_files = [
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".gitignore",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "automaker.gemspec",
27
+ "bin/automaker",
28
+ "lib/automaker.rb"
29
+ ]
30
+ s.homepage = %q{http://github.com/ronaldevers/automaker}
31
+ s.rdoc_options = ["--charset=UTF-8"]
32
+ s.require_paths = ["lib"]
33
+ s.rubygems_version = %q{1.3.5}
34
+ s.summary = %q{Not autotest, not autospec, but automake(r)}
35
+
36
+ if s.respond_to? :specification_version then
37
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
38
+ s.specification_version = 3
39
+
40
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
41
+ s.add_runtime_dependency(%q<fsevents>, [">= 0.1.1"])
42
+ else
43
+ s.add_dependency(%q<fsevents>, [">= 0.1.1"])
44
+ end
45
+ else
46
+ s.add_dependency(%q<fsevents>, [">= 0.1.1"])
47
+ end
48
+ end
49
+
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require 'automaker'
4
+ exit Automaker.new
5
+
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+ require 'fsevents'
3
+
4
+ class Automaker
5
+ def initialize
6
+ if !check_arguments
7
+ print_usage
8
+ else
9
+ @path_to_watch = ARGV.shift
10
+ @filters = ARGV
11
+ run_stream
12
+ end
13
+ end
14
+
15
+ def check_arguments
16
+ ARGV.size > 1
17
+ end
18
+
19
+ def print_usage
20
+ $stderr.puts "Usage: automaker </path/to/watch> <filter> [filter [filter [ etc.. ]]]
21
+ You must specify the path to watch. Make is only triggered if a file whose name
22
+ one of the filters is changed. (Otherwise you will likely enter an infinite loop.)"
23
+ end
24
+
25
+ def run_stream
26
+ stream = FSEvents::Stream.watch(@path_to_watch) { |events|
27
+ puts "FILES MODIFIED"
28
+ puts events.modified_files
29
+ make if should_make(events.modified_files)
30
+ }
31
+ stream.run
32
+ end
33
+
34
+ def should_make(modified_files)
35
+ modified_files.each { |filename|
36
+ @filters.each { |filter|
37
+ return true if filename.include?(filter)
38
+ }
39
+ }
40
+ false
41
+ end
42
+
43
+ def make
44
+ system("cd #{@path_to_watch} && make")
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: automaker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ronald Evers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-12-15 00:00:00 +01:00
13
+ default_executable: automaker
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: fsevents
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.1.1
24
+ version:
25
+ description: Will monitor a directory using fsevents api and call make when something changes. Only works on Mac OS X.
26
+ email: ronaldpaulusevers@gmail.com
27
+ executables:
28
+ - automaker
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README.rdoc
33
+ files:
34
+ - .document
35
+ - .gitignore
36
+ - README.rdoc
37
+ - Rakefile
38
+ - VERSION
39
+ - automaker.gemspec
40
+ - bin/automaker
41
+ - lib/automaker.rb
42
+ has_rdoc: true
43
+ homepage: http://github.com/ronaldevers/automaker
44
+ licenses: []
45
+
46
+ post_install_message:
47
+ rdoc_options:
48
+ - --charset=UTF-8
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ version:
63
+ requirements: []
64
+
65
+ rubyforge_project:
66
+ rubygems_version: 1.3.5
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Not autotest, not autospec, but automake(r)
70
+ test_files: []
71
+