rsanheim-beholder 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +38 -58
- data/examples/lib/beholder_example.rb +8 -8
- data/lib/beholder.rb +7 -7
- metadata +10 -9
data/Rakefile
CHANGED
|
@@ -1,66 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require '
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
s.summary = SUMMARY
|
|
21
|
-
s.description = s.summary
|
|
22
|
-
s.author = AUTHOR
|
|
23
|
-
s.email = EMAIL
|
|
24
|
-
s.homepage = HOMEPAGE
|
|
25
|
-
s.add_dependency "fsevents"
|
|
26
|
-
s.bindir = 'bin'
|
|
27
|
-
s.default_executable = 'beholder'
|
|
28
|
-
s.executables = ["beholder"]
|
|
29
|
-
s.require_path = 'lib'
|
|
30
|
-
s.autorequire = GEM
|
|
31
|
-
s.files = %w(LICENSE README.textile Rakefile TODO) + Dir.glob("{lib,examples}/**/*")
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
|
35
|
-
pkg.gem_spec = spec
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
desc "install the gem locally"
|
|
39
|
-
task :install => [:package] do
|
|
40
|
-
sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
desc "create a gemspec file"
|
|
44
|
-
task :make_gemspec do
|
|
45
|
-
File.open("#{GEM}.gemspec", "w") do |file|
|
|
46
|
-
file.puts spec.to_ruby
|
|
1
|
+
GEM_VERSION = "0.5.5.1"
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require 'jeweler'
|
|
5
|
+
Jeweler::Tasks.new do |s|
|
|
6
|
+
s.name = "beholder"
|
|
7
|
+
s.summary = "An ancient beholder that watches your treasure, and deals with thiefs"
|
|
8
|
+
s.email = "chad@spicycode.com, rsanheim@gmail.com"
|
|
9
|
+
s.homepage = "http://github.com/rsanheim/beholder"
|
|
10
|
+
s.description = "beholder"
|
|
11
|
+
s.authors = "Chad Humphries, Rob Sanheim"
|
|
12
|
+
s.has_rdoc = true
|
|
13
|
+
s.extra_rdoc_files = ["README.textile", "LICENSE", 'TODO']
|
|
14
|
+
s.add_dependency "fsevents"
|
|
15
|
+
s.bindir = 'bin'
|
|
16
|
+
s.default_executable = 'beholder'
|
|
17
|
+
s.executables = ["beholder"]
|
|
18
|
+
s.require_path = 'lib'
|
|
19
|
+
s.files = %w(LICENSE README.textile Rakefile TODO) + Dir.glob("{lib,examples}/**/*")
|
|
47
20
|
end
|
|
21
|
+
rescue LoadError
|
|
22
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
|
48
23
|
end
|
|
49
24
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
end
|
|
25
|
+
begin
|
|
26
|
+
gem "spicycode-micronaut"
|
|
27
|
+
require 'micronaut/rake_task'
|
|
54
28
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
desc "Run all micronaut examples using rcov"
|
|
58
|
-
Micronaut::RakeTask.new :coverage do |t|
|
|
29
|
+
desc "Run all micronaut examples"
|
|
30
|
+
Micronaut::RakeTask.new :examples do |t|
|
|
59
31
|
t.pattern = "examples/**/*_example.rb"
|
|
60
|
-
t.rcov = true
|
|
61
|
-
t.rcov_opts = "--exclude \"examples/*,gems/*,db/*,/Library/Frameworks/*,/Library/Ruby/*,config/*\" --text-summary --sort coverage --no-validator-links"
|
|
62
32
|
end
|
|
63
33
|
|
|
64
|
-
|
|
34
|
+
namespace :examples do
|
|
35
|
+
desc "Run all micronaut examples using rcov"
|
|
36
|
+
Micronaut::RakeTask.new :coverage do |t|
|
|
37
|
+
t.pattern = "examples/**/*_example.rb"
|
|
38
|
+
t.rcov = true
|
|
39
|
+
t.rcov_opts = "--exclude \"examples/*,gems/*,db/*,/Library/Frameworks/*,/Library/Ruby/*,config/*\" --text-summary --sort coverage --no-validator-links"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
65
42
|
|
|
66
|
-
task :default => 'examples:coverage'
|
|
43
|
+
task :default => 'examples:coverage'
|
|
44
|
+
rescue LoadError
|
|
45
|
+
puts "Micronaut required to run examples. Install it with: sudo gem install spicycode-micronaut -s http://gems.github.com"
|
|
46
|
+
end
|
|
@@ -34,23 +34,23 @@ describe Beholder do
|
|
|
34
34
|
describe "when it notices file(s) changed" do
|
|
35
35
|
|
|
36
36
|
it "should identify what was changed" do
|
|
37
|
-
|
|
37
|
+
files = ['widgets']
|
|
38
38
|
beholder = Beholder.new
|
|
39
|
-
mock(beholder).
|
|
40
|
-
beholder.
|
|
39
|
+
mock(beholder).find_matches('widgets') { nil }
|
|
40
|
+
beholder.on_change files
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
it "should run tests for the file that changed" do
|
|
44
|
-
|
|
44
|
+
files = ['widgets']
|
|
45
45
|
beholder = Beholder.new
|
|
46
|
-
stub(beholder).
|
|
47
|
-
mock(beholder).run_tests(['
|
|
48
|
-
beholder.
|
|
46
|
+
stub(beholder).find_matches('widgets') { 'widgets_example' }
|
|
47
|
+
mock(beholder).run_tests(['widgets_example'])
|
|
48
|
+
beholder.on_change files
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
describe "
|
|
53
|
+
describe "blink" do
|
|
54
54
|
|
|
55
55
|
it "should forget about any interlopers" do
|
|
56
56
|
beholder = Beholder.new
|
data/lib/beholder.rb
CHANGED
|
@@ -8,10 +8,10 @@ class Beholder
|
|
|
8
8
|
attr_reader :watcher, :treasure_maps, :possible_map_locations, :all_examples
|
|
9
9
|
|
|
10
10
|
def initialize
|
|
11
|
+
@working_directory = Dir.pwd
|
|
11
12
|
@paths_to_watch, @all_examples = [], []
|
|
12
13
|
@mappings, @treasure_maps = {}, {}
|
|
13
14
|
@sent_an_int = false
|
|
14
|
-
@working_directory = Dir.pwd
|
|
15
15
|
@verbose = ARGV.include?("-v") || ARGV.include?("--verbose")
|
|
16
16
|
@possible_map_locations = ["#{@working_directory}/.treasure_map.rb", "#{@working_directory}/treasure_map.rb", "#{@working_directory}/config/treasure_map.rb"]
|
|
17
17
|
end
|
|
@@ -52,8 +52,8 @@ class Beholder
|
|
|
52
52
|
|
|
53
53
|
def start
|
|
54
54
|
say("Watching the following locations:\n #{paths_to_watch.join(", ")}")
|
|
55
|
-
@watcher = FSEvents::Stream.watch(paths_to_watch) do |
|
|
56
|
-
|
|
55
|
+
@watcher = FSEvents::Stream.watch(paths_to_watch) do |event|
|
|
56
|
+
on_change(event.modified_files)
|
|
57
57
|
puts "\n\nWaiting to hear from the disk since #{Time.now}"
|
|
58
58
|
end
|
|
59
59
|
@watcher.run
|
|
@@ -122,7 +122,7 @@ class Beholder
|
|
|
122
122
|
exit
|
|
123
123
|
end
|
|
124
124
|
|
|
125
|
-
def
|
|
125
|
+
def find_matches(treasure)
|
|
126
126
|
treasure_maps.each do |name, treasure_locations|
|
|
127
127
|
treasure_locations.each do |stolen_by_enemy, spell|
|
|
128
128
|
if spell_components = treasure.match(stolen_by_enemy)
|
|
@@ -151,10 +151,10 @@ class Beholder
|
|
|
151
151
|
blink
|
|
152
152
|
end
|
|
153
153
|
|
|
154
|
-
def
|
|
154
|
+
def on_change(treasure)
|
|
155
155
|
say "#{treasure} changed" unless treasure.empty?
|
|
156
|
-
|
|
157
|
-
run_tests
|
|
156
|
+
matches = treasure.map { |t| find_matches(t) }.uniq.compact
|
|
157
|
+
run_tests matches
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
private
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rsanheim-beholder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- Chad Humphries
|
|
8
|
-
autorequire:
|
|
7
|
+
- Chad Humphries, Rob Sanheim
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-
|
|
12
|
+
date: 2009-03-03 00:00:00 -08:00
|
|
13
13
|
default_executable: beholder
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -22,8 +22,8 @@ dependencies:
|
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
23
|
version: "0"
|
|
24
24
|
version:
|
|
25
|
-
description:
|
|
26
|
-
email: chad@spicycode.com
|
|
25
|
+
description: beholder
|
|
26
|
+
email: chad@spicycode.com, rsanheim@gmail.com
|
|
27
27
|
executables:
|
|
28
28
|
- beholder
|
|
29
29
|
extensions: []
|
|
@@ -43,10 +43,11 @@ files:
|
|
|
43
43
|
- examples/lib/beholder_example.rb
|
|
44
44
|
- bin/beholder
|
|
45
45
|
has_rdoc: true
|
|
46
|
-
homepage: http://github.com/
|
|
46
|
+
homepage: http://github.com/rsanheim/beholder
|
|
47
47
|
post_install_message:
|
|
48
|
-
rdoc_options:
|
|
49
|
-
|
|
48
|
+
rdoc_options:
|
|
49
|
+
- --inline-source
|
|
50
|
+
- --charset=UTF-8
|
|
50
51
|
require_paths:
|
|
51
52
|
- lib
|
|
52
53
|
required_ruby_version: !ruby/object:Gem::Requirement
|