kicker 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/TODO.rdoc CHANGED
@@ -1 +1,35 @@
1
- * Add a recipe which implements the basic autotest mapping API.
1
+ * Add a recipe which implements the basic autotest mapping API.
2
+ * Need to figure out how this can occur:
3
+
4
+ [Thu Oct 01 17:21:04 +0200 2009] Could not handle: tmp/_variants/banners/bn, tmp/_variants/banners/bn/85, tmp/_variants/banners/bn/85/kz, tmp/_variants/banners/bn/85/kz/44, tmp/_variants/images/zx, tmp/_variants/images/zx/10, tmp/_variants/images/zx/10/nx, tmp/_variants/images/zx/10/nx/71
5
+ [Thu Oct 01 17:21:04 +0200 2009]
6
+ [Thu Oct 01 17:21:05 +0200 2009]
7
+ [Thu Oct 01 17:21:05 +0200 2009] Could not handle: tmp/_variants, tmp/_variants/review_photos, tmp/_variants/review_photos/kh, tmp/_variants/review_photos/kh/57, tmp/_variants/review_photos/kh/57/ll, tmp/_variants/review_photos/kh/57/ll/40
8
+ [Thu Oct 01 17:21:05 +0200 2009]
9
+ [Thu Oct 01 17:21:15 +0200 2009]
10
+ [Thu Oct 01 17:21:15 +0200 2009] Could not handle: tmp/_variants, tmp/_variants/flyers, tmp/_variants/flyers/rx, tmp/_variants/flyers/rx/84, tmp/_variants/flyers/rx/84/mc, tmp/_variants/flyers/rx/84/mc/22
11
+ [Thu Oct 01 17:21:15 +0200 2009]
12
+ [Thu Oct 01 17:21:16 +0200 2009]
13
+ [Thu Oct 01 17:21:16 +0200 2009] Could not handle: tmp/_variants, tmp/_variants/images, tmp/_variants/images/mr, tmp/_variants/images/mr/36, tmp/_variants/images/mr/36/as, tmp/_variants/images/mr/36/as/85
14
+ [Thu Oct 01 17:21:16 +0200 2009]
15
+ [Thu Oct 01 17:21:17 +0200 2009]
16
+ [Thu Oct 01 17:21:17 +0200 2009] Could not handle: tmp/_variants/images/zm/86/ez/68
17
+ [Thu Oct 01 17:21:17 +0200 2009]
18
+ [Thu Oct 01 17:21:19 +0200 2009]
19
+ [Thu Oct 01 17:21:19 +0200 2009] Could not handle: tmp/_variants, tmp/_variants/review_photos, tmp/_variants/review_photos/xd, tmp/_variants/review_photos/xd/81, tmp/_variants/review_photos/xd/81/wd, tmp/_variants/review_photos/xd/81/wd/97
20
+ [Thu Oct 01 17:21:19 +0200 2009]
21
+ /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/lib/kicker.rb:115:in `files_in_directory': undefined method `map' for nil:NilClass (NoMethodError)
22
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/lib/kicker.rb:110:in `changed_files'
23
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/lib/kicker.rb:109:in `map'
24
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/lib/kicker.rb:109:in `changed_files'
25
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/lib/kicker.rb:102:in `process'
26
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/lib/kicker.rb:88:in `run_watch_dog!'
27
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/vendor/rucola/fsevents.rb:112:in `call'
28
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/vendor/rucola/fsevents.rb:112:in `initialize'
29
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/lib/kicker.rb:81:in `call'
30
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/lib/kicker.rb:81:in `CFRunLoopRun'
31
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/lib/kicker.rb:81:in `start'
32
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/lib/kicker.rb:35:in `run'
33
+ from /Library/Ruby/Gems/1.8/gems/kicker-2.0.2/bin/kicker:5
34
+ from /usr/bin/kicker:19:in `load'
35
+ from /usr/bin/kicker:19
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 0
3
- :patch: 2
2
+ :patch: 0
4
3
  :major: 2
4
+ :minor: 1
@@ -77,6 +77,7 @@ class Kicker #:nodoc:
77
77
 
78
78
  run_watch_dog!
79
79
  start_growl! if self.class.use_growl
80
+ startup_chain.call([], false)
80
81
 
81
82
  OSX.CFRunLoopRun
82
83
  end
@@ -3,15 +3,20 @@ class Kicker
3
3
  alias_method :append_callback, :push
4
4
  alias_method :prepend_callback, :unshift
5
5
 
6
- def call(files)
6
+ def call(files, stop_when_empty = true)
7
7
  each do |callback|
8
- break if files.empty?
8
+ break if stop_when_empty and files.empty?
9
9
  callback.call(files)
10
10
  end
11
11
  end
12
12
  end
13
13
 
14
14
  class << self
15
+ attr_writer :startup_chain
16
+ def startup_chain
17
+ @startup_chain ||= CallbackChain.new
18
+ end
19
+
15
20
  attr_writer :pre_process_chain
16
21
  def pre_process_chain
17
22
  @pre_process_chain ||= CallbackChain.new
@@ -33,6 +38,10 @@ class Kicker
33
38
  end
34
39
  end
35
40
 
41
+ def startup_chain
42
+ self.class.startup_chain
43
+ end
44
+
36
45
  def pre_process_chain
37
46
  self.class.pre_process_chain
38
47
  end
@@ -51,6 +60,15 @@ class Kicker
51
60
  end
52
61
 
53
62
  module Kernel
63
+ # Adds a handler to the startup chain. This chain is ran before the once
64
+ # Kicker is done loading. Note that an empty files array is given to the
65
+ # callback.
66
+ #
67
+ # Takes a +callback+ object that responds to <tt>#call</tt>, or a block.
68
+ def startup(callback = nil, &block)
69
+ Kicker.startup_chain.append_callback(block ? block : callback)
70
+ end
71
+
54
72
  # Adds a handler to the pre_process chain. This chain is ran before the
55
73
  # process chain and is processed from first to last.
56
74
  #
@@ -1,6 +1,9 @@
1
1
  Kicker.option_parser.on('-e', '--execute [COMMAND]', 'The command to execute.') do |command|
2
- pre_process do |files|
2
+ callback = lambda do |files|
3
3
  files.clear
4
4
  execute "sh -c #{command.inspect}"
5
5
  end
6
+
7
+ startup callback
8
+ pre_process callback
6
9
  end
@@ -2,7 +2,7 @@ require File.expand_path('../test_helper', __FILE__)
2
2
 
3
3
  describe "Kicker, concerning its callback chains" do
4
4
  before do
5
- @chains = [:pre_process_chain, :process_chain, :post_process_chain, :full_chain]
5
+ @chains = [:startup_chain, :pre_process_chain, :process_chain, :post_process_chain, :full_chain]
6
6
  end
7
7
 
8
8
  it "should return the callback chain instances" do
@@ -19,6 +19,14 @@ describe "Kicker, concerning its callback chains" do
19
19
  end
20
20
  end
21
21
 
22
+ it "should provide a shortcut method which appends a callback to the startup chain" do
23
+ Kicker.startup_chain.expects(:append_callback).with do |callback|
24
+ callback.call == :from_callback
25
+ end
26
+
27
+ startup { :from_callback }
28
+ end
29
+
22
30
  it "should provide a shortcut method which appends a callback to the pre-process chain" do
23
31
  Kicker.pre_process_chain.expects(:append_callback).with do |callback|
24
32
  callback.call == :from_callback
@@ -43,10 +51,10 @@ describe "Kicker, concerning its callback chains" do
43
51
  post_process { :from_callback }
44
52
  end
45
53
 
46
- it "should have assigned the chains to the `full_chain'" do
54
+ it "should have assigned the chains to the `full_chain' (except startup_chain)" do
47
55
  Kicker.full_chain.length.should == 3
48
56
  Kicker.full_chain.each_with_index do |chain, index|
49
- chain.should.be Kicker.send(@chains[index])
57
+ chain.should.be Kicker.send(@chains[index + 1])
50
58
  end
51
59
  end
52
60
  end
@@ -117,6 +125,13 @@ describe "An instance of Kicker::CallbackChain, when calling the chain" do
117
125
  @result.should == [1]
118
126
  end
119
127
 
128
+ it "should not halt the chain if the array is empty if specified" do
129
+ @chain.append_callback lambda { |files| @result << 1; files.clear }
130
+ @chain.append_callback lambda { |files| @result << 2 }
131
+ @chain.call(%w{ /file/1 /file/2 }, false)
132
+ @result.should == [1, 2]
133
+ end
134
+
120
135
  it "should not call any callback if the given array is empty" do
121
136
  @chain.append_callback lambda { |files| @result << 1 }
122
137
  @chain.call([])
@@ -140,13 +140,6 @@ describe "Kicker, when starting" do
140
140
  @kicker.start
141
141
  end
142
142
 
143
- it "should start a CFRunLoop" do
144
- @kicker.stubs(:validate_options!)
145
-
146
- OSX.expects(:CFRunLoopRun)
147
- @kicker.start
148
- end
149
-
150
143
  it "should register with growl if growl should be used" do
151
144
  @kicker.stubs(:validate_options!)
152
145
  Kicker.use_growl = true
@@ -162,4 +155,18 @@ describe "Kicker, when starting" do
162
155
  Growl::Notifier.sharedInstance.expects(:register).never
163
156
  @kicker.start
164
157
  end
158
+
159
+ it "should call the startup chain" do
160
+ @kicker.stubs(:validate_options!)
161
+
162
+ @kicker.startup_chain.expects(:call).with([], false)
163
+ @kicker.start
164
+ end
165
+
166
+ it "should start a CFRunLoop" do
167
+ @kicker.stubs(:validate_options!)
168
+
169
+ OSX.expects(:CFRunLoopRun)
170
+ @kicker.start
171
+ end
165
172
  end
@@ -29,4 +29,9 @@ describe "Kicker, concerning the `execute a command-line' callback" do
29
29
  Kicker.pre_process_chain.last.call(files)
30
30
  files.should.be.empty
31
31
  end
32
+
33
+ it "should run the command directly once Kicker is done loading" do
34
+ callback = Kicker.pre_process_chain.last
35
+ Kicker.startup_chain.should.include callback
36
+ end
32
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kicker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-30 00:00:00 +02:00
12
+ date: 2009-10-07 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -24,16 +24,12 @@ extra_rdoc_files:
24
24
  - LICENSE
25
25
  - README.rdoc
26
26
  files:
27
- - .gitignore
28
- - .kick
29
27
  - LICENSE
30
28
  - README.rdoc
31
29
  - Rakefile
32
30
  - TODO.rdoc
33
31
  - VERSION.yml
34
32
  - bin/kicker
35
- - html/images/kikker.jpg
36
- - kicker.gemspec
37
33
  - lib/kicker.rb
38
34
  - lib/kicker/callback_chain.rb
39
35
  - lib/kicker/core_ext.rb
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- *.sw?
2
- .DS_Store
3
- coverage
4
- rdoc
5
- pkg
6
- html/*.html
7
- html/*.rid
8
- html/*.css
9
- html/classes
10
- html/files
data/.kick DELETED
@@ -1,20 +0,0 @@
1
- require 'ignore'
2
-
3
- process do |files|
4
- test_files = files.take_and_map do |file|
5
- case file
6
- when %r{^test/.+_test\.rb$}
7
- file
8
- when %r{^lib/kicker(\.rb|/validate\.rb|/growl\.rb)$}
9
- ["test/initialization_test.rb", ("test/filesystem_change_test.rb" if $1 == '.rb')]
10
- when %r{^lib/kicker/(.+)\.rb$}
11
- "test/#{$1}_test.rb"
12
- end
13
- end
14
-
15
- run_ruby_tests test_files
16
- end
17
-
18
- process do |files|
19
- execute("rake docs:generate && open -a Safari html/index.html") if files.delete("README.rdoc")
20
- end
Binary file
@@ -1,95 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{kicker}
8
- s.version = "2.0.2"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Eloy Duran"]
12
- s.date = %q{2009-09-30}
13
- s.email = %q{eloy.de.enige@gmail.com}
14
- s.executables = ["kicker", "kicker"]
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".gitignore",
21
- ".kick",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "TODO.rdoc",
26
- "VERSION.yml",
27
- "bin/kicker",
28
- "html/images/kikker.jpg",
29
- "kicker.gemspec",
30
- "lib/kicker.rb",
31
- "lib/kicker/callback_chain.rb",
32
- "lib/kicker/core_ext.rb",
33
- "lib/kicker/growl.rb",
34
- "lib/kicker/options.rb",
35
- "lib/kicker/recipes/could_not_handle_file.rb",
36
- "lib/kicker/recipes/dot_kick.rb",
37
- "lib/kicker/recipes/execute_cli_command.rb",
38
- "lib/kicker/recipes/ignore.rb",
39
- "lib/kicker/recipes/jstest.rb",
40
- "lib/kicker/recipes/rails.rb",
41
- "lib/kicker/utils.rb",
42
- "lib/kicker/validate.rb",
43
- "test/callback_chain_test.rb",
44
- "test/core_ext_test.rb",
45
- "test/filesystem_change_test.rb",
46
- "test/fixtures/a_file_thats_reloaded.rb",
47
- "test/initialization_test.rb",
48
- "test/options_test.rb",
49
- "test/recipes/could_not_handle_file_test.rb",
50
- "test/recipes/dot_kick_test.rb",
51
- "test/recipes/execute_cli_command_test.rb",
52
- "test/recipes/ignore_test.rb",
53
- "test/recipes/jstest_test.rb",
54
- "test/recipes/rails_test.rb",
55
- "test/test_helper.rb",
56
- "test/utils_test.rb",
57
- "vendor/growlnotifier/growl.rb",
58
- "vendor/growlnotifier/growl.rb",
59
- "vendor/growlnotifier/growl_helpers.rb",
60
- "vendor/growlnotifier/growl_helpers.rb",
61
- "vendor/rucola/fsevents.rb",
62
- "vendor/rucola/fsevents.rb"
63
- ]
64
- s.homepage = %q{http://github.com/alloy/kicker}
65
- s.rdoc_options = ["--charset=UTF-8"]
66
- s.require_paths = ["lib", "vendor"]
67
- s.rubygems_version = %q{1.3.5}
68
- s.summary = %q{A lean, agnostic, flexible file-change watcher, using OS X FSEvents.}
69
- s.test_files = [
70
- "test/callback_chain_test.rb",
71
- "test/core_ext_test.rb",
72
- "test/filesystem_change_test.rb",
73
- "test/fixtures/a_file_thats_reloaded.rb",
74
- "test/initialization_test.rb",
75
- "test/options_test.rb",
76
- "test/recipes/could_not_handle_file_test.rb",
77
- "test/recipes/dot_kick_test.rb",
78
- "test/recipes/execute_cli_command_test.rb",
79
- "test/recipes/ignore_test.rb",
80
- "test/recipes/jstest_test.rb",
81
- "test/recipes/rails_test.rb",
82
- "test/test_helper.rb",
83
- "test/utils_test.rb"
84
- ]
85
-
86
- if s.respond_to? :specification_version then
87
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
88
- s.specification_version = 3
89
-
90
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
91
- else
92
- end
93
- else
94
- end
95
- end