kicker 4.0.0.p1 → 4.0.0.p2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b3f1b8e56a45f76314daaf713f764f37228d42b4
4
- data.tar.gz: 4867e2dbf6f21d39ecd0f7367c6d87bb0b94a9d7
2
+ SHA256:
3
+ metadata.gz: 2c59242935451e5929112dc5421520c5042442b6a9cb268e1e3190b52b2265d9
4
+ data.tar.gz: 779c659ae41efc2e4f7b34170d214fd2341e67d6fff142d00fd8cdd51df5550d
5
5
  SHA512:
6
- metadata.gz: 1ed6e797ccff80a9a4cbd9d056ac6ae205907fef59c94b72c61c811576caa678df63b82eb043b657fe08e48438b24e5ea8e49eee62839cbc66ca5a97b2eecf2f
7
- data.tar.gz: f23d431352c3eea377adee626ae6a76001151585e3a2a50d5f6203a2426a68fd79ebe65eff3781969bafa5ba4c6b351b9ecf033ef7ee9990c2f0a9f9f1b942df
6
+ metadata.gz: a647c2913d8861809b590e7dbb9f95c0f7bb80d48835a1b39ca99a7f0e80ebac73d09e381ec922206bb3876bd178bc837dfd1bd210738c772388a0b97495f326
7
+ data.tar.gz: 62d524f1c8ce3dff5200b52d3ed4b513358779abc3439829f68197bfee9e1837a445f8c76ac6821b5dca1538e5552dd57798caa56f0d5a306905218169e7de68
@@ -1,5 +1,4 @@
1
1
  require 'tidings'
2
- require 'kicker/core_ext/array'
3
2
 
4
3
  class Kicker
5
4
  autoload :CLI, 'kicker/cli'
@@ -36,5 +36,3 @@ class Kicker
36
36
  end
37
37
  end
38
38
  end
39
-
40
- Array.send(:include, Kicker::CoreExt::Array)
@@ -1,70 +1,39 @@
1
1
  class Kicker
2
2
  class Script
3
- class Context
4
- attr_accessor :cwd, :watcher, :script
5
-
6
- include Kicker::Deprecated
7
-
8
- def initialize(cwd: Dir.pwd, watcher: nil, script: nil)
9
- @cwd = cwd
10
- @watcher = watcher
11
- @script = script
12
- end
13
-
14
- def recipe(name)
15
- filename = File.join(::Kicker::Script.recipes_path, name.to_s + '.rb')
16
- if File.exist?(filename)
17
- ::Kicker.debug("Loading recipe: #{filename}")
18
- load(filename)
19
- else
20
- ::Kicker.debug("Unknown recipe: #{name}")
21
- end
22
- end
23
-
24
- def load(filename)
25
- eval(File.read(filename), binding, filename)
26
- end
27
-
28
- def process(callable=nil, &block)
29
- processor = callable || block
30
- ::Kicker.debug("Adding processor: #{processor}")
31
- script.processors << processor
32
- end
33
- end
3
+ autoload :Context, 'script/context'
4
+ autoload :DeprecatedContext, 'script/deprecated_context'
34
5
 
35
6
  class << self
36
7
  attr_accessor :recipes_path
37
8
  end
38
9
  self.recipes_path = File.expand_path('recipe', __dir__)
39
10
 
40
- attr_accessor :cwd, :watcher, :recipes, :processors
11
+ attr_accessor :cwd, :watcher, :recipes, :contexts
41
12
 
42
13
  def initialize(cwd: Dir.pwd, watcher: nil)
43
14
  @cwd = cwd
44
15
  @watcher = watcher
45
16
  @recipes = []
46
- @processors = []
47
- @context = Kicker::Script::Context.new(cwd: @cwd, watcher: @watcher, script: self)
17
+ @contexts = []
18
+ end
19
+
20
+ def create_context
21
+ context = Kicker::Script::Context.new(cwd: cwd, watcher: watcher, script: self)
22
+ @contexts << context
23
+ context
48
24
  end
49
25
 
50
26
  def recipe(name)
51
- @context.recipe(name)
27
+ create_context.recipe(name)
52
28
  end
53
29
 
54
30
  def load(filename)
55
- @context.load(filename)
31
+ create_context.load(filename)
56
32
  end
57
33
 
58
34
  def call(file_or_path, flags)
59
- @processors.each do |processor|
60
- case processor.method(:call).arity
61
- when 0
62
- processor.call
63
- when 1
64
- processor.call([file_or_path])
65
- else
66
- processor.call(file_or_path, flags)
67
- end
35
+ contexts.each do |context|
36
+ context.call(file_or_path, flags)
68
37
  end
69
38
  end
70
39
 
@@ -1,3 +1,3 @@
1
1
  class Kicker
2
- VERSION = '4.0.0.p1'
2
+ VERSION = '4.0.0.p2'
3
3
  end
@@ -97,6 +97,7 @@ class Kicker
97
97
  while(buffer = master.read(@buffer_size))
98
98
  write(buffer)
99
99
  end
100
+ Process.waitpid(pid)
100
101
  end
101
102
  write("\n")
102
103
  end
@@ -0,0 +1,40 @@
1
+ class Kicker
2
+ class Script
3
+ class Context
4
+ attr_accessor :cwd, :watcher, :script
5
+
6
+ def initialize(cwd: Dir.pwd, watcher: nil, script: nil)
7
+ @cwd = cwd
8
+ @watcher = watcher
9
+ @script = script
10
+ @processors = []
11
+ end
12
+
13
+ def recipe(name)
14
+ filename = File.join(::Kicker::Script.recipes_path, name.to_s + '.rb')
15
+ if File.exist?(filename)
16
+ ::Kicker.debug("Loading recipe: #{filename}")
17
+ load(filename)
18
+ else
19
+ ::Kicker.debug("Unknown recipe: #{name}")
20
+ end
21
+ end
22
+
23
+ def load(filename)
24
+ eval(File.read(filename), binding, filename)
25
+ end
26
+
27
+ def process(callable=nil, &block)
28
+ processor = callable || block
29
+ ::Kicker.debug("Adding processor: #{processor}")
30
+ @processors << processor
31
+ end
32
+
33
+ def call(file_or_path, flags)
34
+ @processors.each do |processor|
35
+ processor.call(file_or_path, flags)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,24 @@
1
+ class Kicker
2
+ class Script
3
+ class DeprecatedContext < Kicker::Script::Context
4
+ def execute(command)
5
+ Kicker.debug("[DEPRECATED] Calling `execute' directly is deprecated, instead use `watcher.execute'. Called from #{_last_caller(caller)}.")
6
+ watcher.execute(command)
7
+ end
8
+
9
+ def call(file_or_path, flags)
10
+ files = [file_or_path]
11
+ files.extend(Kicker::CoreExt::Array)
12
+ @processors.each do |processor|
13
+ processor.call(files)
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def _last_caller(stack)
20
+ stack[0]
21
+ end
22
+ end
23
+ end
24
+ 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: 4.0.0.p1
4
+ version: 4.0.0.p2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-03 00:00:00.000000000 Z
12
+ date: 2018-06-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tidings
@@ -44,7 +44,6 @@ files:
44
44
  - lib/kicker/cli.rb
45
45
  - lib/kicker/core_ext/array.rb
46
46
  - lib/kicker/debug.rb
47
- - lib/kicker/deprecated.rb
48
47
  - lib/kicker/formatter.rb
49
48
  - lib/kicker/option_parser.rb
50
49
  - lib/kicker/recipe/ignore.rb
@@ -54,6 +53,8 @@ files:
54
53
  - lib/kicker/script.rb
55
54
  - lib/kicker/version.rb
56
55
  - lib/kicker/watcher.rb
56
+ - lib/script/context.rb
57
+ - lib/script/deprecated_context.rb
57
58
  homepage: http://github.com/Manfred/kicker
58
59
  licenses: []
59
60
  metadata: {}
@@ -73,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
74
  version: 1.3.1
74
75
  requirements: []
75
76
  rubyforge_project:
76
- rubygems_version: 2.2.2
77
+ rubygems_version: 2.7.6
77
78
  signing_key:
78
79
  specification_version: 4
79
80
  summary: A lean, agnostic, flexible file-change watcher.
@@ -1,14 +0,0 @@
1
- class Kicker
2
- module Deprecated
3
- def execute(command)
4
- Kicker.debug("[DEPRECATED] Calling `execute' directly is deprecated, instead use `watcher.execute'. Called from #{_last_caller(caller)}.")
5
- watcher.execute(command)
6
- end
7
-
8
- private
9
-
10
- def _last_caller(stack)
11
- stack[0]
12
- end
13
- end
14
- end