duck_test 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/duck_test/autorun.rb +6 -16
- data/lib/duck_test/base.rb +1 -1
- data/lib/duck_test/commands.rb +12 -0
- data/lib/duck_test/config.rb +12 -2
- data/lib/duck_test/frame_work/base.rb +26 -3
- data/lib/duck_test/logger.rb +2 -0
- data/lib/duck_test/railtie.rb +1 -1
- data/lib/duck_test/run_commands.rb +44 -0
- data/lib/duck_test/usage.yml +2 -0
- data/lib/duck_test/version.rb +1 -1
- data/lib/tasks/duck_tests.rake +2 -0
- metadata +36 -36
data/lib/duck_test/autorun.rb
CHANGED
@@ -1,20 +1,10 @@
|
|
1
|
-
|
1
|
+
require 'test/unit'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
::Test::Unit::Runner.class_eval do
|
9
|
-
alias_method :original_run, :run
|
10
|
-
def run(args = [])
|
11
|
-
if DuckTest::FrameWork::Base.ok_to_run
|
12
|
-
original_run(args)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
3
|
+
Test::Unit::Runner.class_eval do
|
4
|
+
alias_method :original_run, :run
|
5
|
+
def run(args = [])
|
6
|
+
if DuckTest::FrameWork::Base.ok_to_run
|
7
|
+
original_run(args)
|
16
8
|
end
|
17
|
-
|
18
9
|
end
|
19
|
-
|
20
10
|
end
|
data/lib/duck_test/base.rb
CHANGED
@@ -4,7 +4,6 @@ require "duck_test/version"
|
|
4
4
|
module DuckTest
|
5
5
|
|
6
6
|
autoload :AutoloadConfig, 'duck_test/autoload_config'
|
7
|
-
autoload :Autorun, 'duck_test/autorun'
|
8
7
|
autoload :Config, 'duck_test/config'
|
9
8
|
autoload :ConfigHelper, 'duck_test/config_helper'
|
10
9
|
autoload :Console, 'duck_test/console'
|
@@ -14,6 +13,7 @@ module DuckTest
|
|
14
13
|
autoload :Logger, 'duck_test/logger'
|
15
14
|
autoload :LoggerHelper, 'duck_test/logger'
|
16
15
|
autoload :Platforms, 'duck_test/platforms/base'
|
16
|
+
autoload :RunCommands, 'duck_test/run_commands'
|
17
17
|
autoload :Usage, 'duck_test/usage'
|
18
18
|
autoload :VersionHelper, 'duck_test/version'
|
19
19
|
|
data/lib/duck_test/commands.rb
CHANGED
@@ -181,6 +181,18 @@ module DuckTest
|
|
181
181
|
return DuckTest::Config.framework.run_all
|
182
182
|
end
|
183
183
|
|
184
|
+
##################################################################################
|
185
|
+
# Saves the current environment settings to the users home directory ~/.ducktestrc
|
186
|
+
def save
|
187
|
+
RunCommands.config[:latency] = DuckTest::Config.framework.queue.latency
|
188
|
+
RunCommands.config[:speed] = DuckTest::Config.framework.queue.speed
|
189
|
+
RunCommands.config[:listener_speed] = DuckTest::Config.framework.listener.speed
|
190
|
+
RunCommands.config[:ar] = Logger.to_severity(ActiveRecord::Base.logger.level)
|
191
|
+
RunCommands.config[:ll] = Logger.to_severity(Logger.log_level)
|
192
|
+
RunCommands.save
|
193
|
+
return ""
|
194
|
+
end
|
195
|
+
|
184
196
|
##################################################################################
|
185
197
|
# See {FrameWork::Queue#speed}
|
186
198
|
# @return [String] The output message
|
data/lib/duck_test/config.rb
CHANGED
@@ -9,7 +9,7 @@ module DuckTest
|
|
9
9
|
|
10
10
|
super
|
11
11
|
|
12
|
-
Logger.log_level = :debug
|
12
|
+
#Logger.log_level = :debug
|
13
13
|
|
14
14
|
#self.class.reset
|
15
15
|
|
@@ -480,6 +480,7 @@ module DuckTest
|
|
480
480
|
config[:autorun] = config[:autorun].nil? ? framework[:autorun] : config[:autorun]
|
481
481
|
config[:autorun] = false unless config[:runnable]
|
482
482
|
|
483
|
+
config[:watch_basedir] = config[:basedir] unless config[:basedir].blank?
|
483
484
|
config[:watch_basedir] = config[:watch_basedir].blank? ? framework[:watch_basedir] : config[:watch_basedir]
|
484
485
|
config[:runnable_basedir] = config[:runnable_basedir].blank? ? framework[:runnable_basedir] : config[:runnable_basedir]
|
485
486
|
buffer_config = {}
|
@@ -517,8 +518,17 @@ module DuckTest
|
|
517
518
|
def runnable(*args, &block)
|
518
519
|
args.push({}) unless args.last.kind_of?(Hash)
|
519
520
|
args.last[:runnable] = true
|
521
|
+
|
522
|
+
unless args.last[:basedir].blank?
|
523
|
+
args.last[:runnable_basedir] = args.last[:basedir]
|
524
|
+
end
|
525
|
+
|
520
526
|
if args.last[:watch_basedir].blank?
|
521
|
-
args.last[:
|
527
|
+
if args.last[:runnable_basedir].blank?
|
528
|
+
args.last[:watch_basedir] = self.get_framework(self.current_framework)[:runnable_basedir]
|
529
|
+
else
|
530
|
+
args.last[:watch_basedir] = args.last[:runnable_basedir]
|
531
|
+
end
|
522
532
|
end
|
523
533
|
watch(*args, &block)
|
524
534
|
end
|
@@ -420,7 +420,10 @@ module DuckTest
|
|
420
420
|
# See {Platforms::Listener#speed}
|
421
421
|
# @return [NilClass]
|
422
422
|
def set_listener_speed(value)
|
423
|
-
|
423
|
+
begin
|
424
|
+
self.listener.speed = value.to_f
|
425
|
+
rescue
|
426
|
+
end
|
424
427
|
return nil
|
425
428
|
end
|
426
429
|
|
@@ -428,7 +431,10 @@ module DuckTest
|
|
428
431
|
# See {Queue#speed}
|
429
432
|
# @return [NilClass]
|
430
433
|
def set_queue_speed(value)
|
431
|
-
|
434
|
+
begin
|
435
|
+
self.queue.set_speed(value.to_f)
|
436
|
+
rescue
|
437
|
+
end
|
432
438
|
return nil
|
433
439
|
end
|
434
440
|
|
@@ -436,7 +442,10 @@ module DuckTest
|
|
436
442
|
# See {Queue#latency}
|
437
443
|
# @return [NilClass]
|
438
444
|
def set_latency(value)
|
439
|
-
|
445
|
+
begin
|
446
|
+
self.queue.set_latency(value.to_f)
|
447
|
+
rescue
|
448
|
+
end
|
440
449
|
return nil
|
441
450
|
end
|
442
451
|
|
@@ -470,6 +479,20 @@ module DuckTest
|
|
470
479
|
|
471
480
|
self.start
|
472
481
|
|
482
|
+
RunCommands.load
|
483
|
+
|
484
|
+
self.set_latency(RunCommands.config[:latency]) unless RunCommands.config[:latency].blank?
|
485
|
+
self.set_listen_speed(RunCommands.config[:listen_speed]) unless RunCommands.config[:listen_speed].blank?
|
486
|
+
self.set_queue_speed(RunCommands.config[:speed]) unless RunCommands.config[:speed].blank?
|
487
|
+
|
488
|
+
unless RunCommands.config[:ar].blank?
|
489
|
+
ActiveRecord::Base.logger.level = Logger.to_severity(RunCommands.config[:ar].to_sym)
|
490
|
+
end
|
491
|
+
|
492
|
+
unless RunCommands.config[:ll].blank?
|
493
|
+
Logger.log_level = RunCommands.config[:ll]
|
494
|
+
end
|
495
|
+
|
473
496
|
rescue Exception => e
|
474
497
|
ducklog.exception e
|
475
498
|
end
|
data/lib/duck_test/logger.rb
CHANGED
data/lib/duck_test/railtie.rb
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
module DuckTest
|
2
|
+
|
3
|
+
# Run Commands provides support for linux style .rc config files to load and set environment, etc.
|
4
|
+
class RunCommands
|
5
|
+
|
6
|
+
include LoggerHelper
|
7
|
+
|
8
|
+
##################################################################################
|
9
|
+
# Loads environment settings from the home directory of the user.
|
10
|
+
def self.load
|
11
|
+
|
12
|
+
file_spec = File.expand_path("~/.ducktestrc")
|
13
|
+
if File.exist?(file_spec)
|
14
|
+
Logger.ducklog.console "Loading environment from: #{file_spec}"
|
15
|
+
self.config = YAML.load_file(file_spec)
|
16
|
+
self.config = self.config.inject({}){|object,(k,v)| object[k.to_sym] = v; object}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
##################################################################################
|
21
|
+
# Saves the current environment settings to the home directory of the user.
|
22
|
+
def self.save
|
23
|
+
file_spec = File.expand_path("~/.ducktestrc")
|
24
|
+
File.open(file_spec, "w") do |file|
|
25
|
+
file.write(YAML.dump(self.config))
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
##################################################################################
|
31
|
+
def self.config
|
32
|
+
unless defined?(@@config)
|
33
|
+
@@config = {}
|
34
|
+
end
|
35
|
+
return @@config
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.config=(value)
|
39
|
+
@@config = value
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
data/lib/duck_test/usage.yml
CHANGED
@@ -19,6 +19,8 @@ duck.runall - Loads all runnable test files from disk and executes the ru
|
|
19
19
|
|
20
20
|
duck.whitelist - Lists all of the files that have been whitelisted
|
21
21
|
|
22
|
+
duck.save - Saves the current environment to the user home directory ~/.ducktestrc
|
23
|
+
|
22
24
|
|
23
25
|
The following commands accept optional arguments. Type the command followed by :help Example: duck.run :help
|
24
26
|
|
data/lib/duck_test/version.rb
CHANGED
data/lib/tasks/duck_tests.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duck_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: DuckTest is a gem that facilitates automated running of TestUnit and
|
15
15
|
RSpec tests directly in the IRB console. Tests run within a second of being changed.
|
@@ -22,48 +22,49 @@ extra_rdoc_files: []
|
|
22
22
|
files:
|
23
23
|
- lib/tasks/gem_tasks.rake
|
24
24
|
- lib/tasks/duck_tests.rake
|
25
|
-
- lib/
|
26
|
-
- lib/duck_test
|
27
|
-
- lib/duck_test/
|
28
|
-
- lib/duck_test/default_config.rb
|
29
|
-
- lib/duck_test/autoload_config.rb
|
30
|
-
- lib/duck_test/config.rb
|
25
|
+
- lib/notes.txt
|
26
|
+
- lib/duck_test.rb
|
27
|
+
- lib/duck_test/logger.rb
|
31
28
|
- lib/duck_test/base.rb
|
32
|
-
- lib/duck_test/
|
33
|
-
- lib/duck_test/
|
29
|
+
- lib/duck_test/railtie.rb
|
30
|
+
- lib/duck_test/autoload_config.rb
|
34
31
|
- lib/duck_test/commands.rb
|
35
32
|
- lib/duck_test/autorun.rb
|
36
|
-
- lib/duck_test/
|
33
|
+
- lib/duck_test/frame_work/filter_set.rb
|
34
|
+
- lib/duck_test/frame_work/watch_config.rb
|
35
|
+
- lib/duck_test/frame_work/base.rb
|
36
|
+
- lib/duck_test/frame_work/queue.rb
|
37
|
+
- lib/duck_test/frame_work/queue_event.rb
|
38
|
+
- lib/duck_test/frame_work/file_manager.rb
|
39
|
+
- lib/duck_test/frame_work/rspec/base.rb
|
40
|
+
- lib/duck_test/frame_work/rspec/frame_work.rb
|
41
|
+
- lib/duck_test/frame_work/test_unit/base.rb
|
42
|
+
- lib/duck_test/frame_work/test_unit/frame_work.rb
|
43
|
+
- lib/duck_test/frame_work/map.rb
|
44
|
+
- lib/duck_test/usage.rb
|
45
|
+
- lib/duck_test/usage.yml
|
46
|
+
- lib/duck_test/config.rb
|
47
|
+
- lib/duck_test/console.rb
|
48
|
+
- lib/duck_test/option_parser.rb
|
49
|
+
- lib/duck_test/default_config.rb
|
50
|
+
- lib/duck_test/config_helper.rb
|
51
|
+
- lib/duck_test/run_commands.rb
|
52
|
+
- lib/duck_test/gem/helper.rb
|
53
|
+
- lib/duck_test/version.rb
|
37
54
|
- lib/duck_test/platforms/watch_event.rb
|
38
|
-
- lib/duck_test/platforms/listener.rb
|
39
55
|
- lib/duck_test/platforms/base.rb
|
40
|
-
- lib/duck_test/platforms/windows/listener.rb
|
41
|
-
- lib/duck_test/platforms/windows/base.rb
|
42
|
-
- lib/duck_test/platforms/generic/listener.rb
|
43
56
|
- lib/duck_test/platforms/generic/base.rb
|
57
|
+
- lib/duck_test/platforms/generic/listener.rb
|
58
|
+
- lib/duck_test/platforms/listener.rb
|
59
|
+
- lib/duck_test/platforms/dependencies.rb
|
60
|
+
- lib/duck_test/platforms/windows/base.rb
|
61
|
+
- lib/duck_test/platforms/windows/listener.rb
|
44
62
|
- lib/duck_test/platforms/os_helper.rb
|
45
|
-
- lib/duck_test/platforms/mac/listener.rb
|
46
63
|
- lib/duck_test/platforms/mac/base.rb
|
47
64
|
- lib/duck_test/platforms/mac/listener.rb.orig
|
48
|
-
- lib/duck_test/platforms/
|
65
|
+
- lib/duck_test/platforms/mac/listener.rb
|
49
66
|
- lib/duck_test/platforms/linux/base.rb
|
50
|
-
- lib/duck_test/
|
51
|
-
- lib/duck_test/logger.rb
|
52
|
-
- lib/duck_test/railtie.rb
|
53
|
-
- lib/duck_test/usage.yml
|
54
|
-
- lib/duck_test/frame_work/file_manager.rb
|
55
|
-
- lib/duck_test/frame_work/base.rb
|
56
|
-
- lib/duck_test/frame_work/queue.rb
|
57
|
-
- lib/duck_test/frame_work/rspec/base.rb
|
58
|
-
- lib/duck_test/frame_work/rspec/frame_work.rb
|
59
|
-
- lib/duck_test/frame_work/watch_config.rb
|
60
|
-
- lib/duck_test/frame_work/filter_set.rb
|
61
|
-
- lib/duck_test/frame_work/map.rb
|
62
|
-
- lib/duck_test/frame_work/test_unit/base.rb
|
63
|
-
- lib/duck_test/frame_work/test_unit/frame_work.rb
|
64
|
-
- lib/duck_test/frame_work/queue_event.rb
|
65
|
-
- lib/duck_test.rb
|
66
|
-
- lib/notes.txt
|
67
|
+
- lib/duck_test/platforms/linux/listener.rb
|
67
68
|
- bin/ducktest
|
68
69
|
homepage: http://www.jeffduckett.com/
|
69
70
|
licenses: []
|
@@ -85,9 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
86
|
version: '0'
|
86
87
|
requirements: []
|
87
88
|
rubyforge_project:
|
88
|
-
rubygems_version: 1.8.
|
89
|
+
rubygems_version: 1.8.24
|
89
90
|
signing_key:
|
90
91
|
specification_version: 3
|
91
92
|
summary: DuckTest runs TestUnit and RSpec tests directly in the IRB console.
|
92
93
|
test_files: []
|
93
|
-
has_rdoc:
|