hydra-console 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009-2010 Nick Gauthier
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ = Hydra Console
2
+
3
+ Run test files repeatedly without rebooting your environment
4
+
5
+ == Usage
6
+
7
+ hydra-console file1 [file2, file3, ...]
8
+
9
+ Currently it always runs on four processors. I will add a config flag when
10
+ I rewrite the binary with a real option parser.
11
+
12
+ == More Info
13
+
14
+ http://github.com/ngauthier/hydra
15
+
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'hydra'
4
+ ENV['RAILS_ENV']='test'
5
+
6
+ @files = ARGV.inject([]){|memo,f| memo += Dir.glob f}
7
+
8
+ if @files.empty?
9
+ puts "You must specify a list of files to run"
10
+ puts "If you specify a pattern, it must be in quotes"
11
+ puts %{USAGE: #{$0} test/unit/my_test.rb "test/functional/**/*_test.rb"}
12
+ exit(1)
13
+ end
14
+
15
+ Signal.trap("TERM", "KILL") do
16
+ puts "Warm Snake says bye bye"
17
+ exit(0)
18
+ end
19
+
20
+ bold_yellow = "\033[1;33m"
21
+ reset = "\033[0m"
22
+
23
+ loop do
24
+ env_proc = Process.fork do
25
+ # First, we run the tests in the local process. This is slow, but forces all relevant
26
+ # code to be loaded into this fork so we can re-use it.
27
+ puts "#{bold_yellow}Booting up#{reset}"
28
+ start = Time.now
29
+ runner = Hydra::Runner.new(:io => File.new('/dev/null', 'w'))
30
+ @files.each{|f| runner.run_file(f)}
31
+ finish = Time.now
32
+ puts "#{bold_yellow}Boot complete (#{finish-start})#{reset}"
33
+
34
+ loop do
35
+ # Grab the next command
36
+ $stdout.write "Press #{bold_yellow}ENTER#{reset} to retest. Type #{bold_yellow}r#{reset} then hit enter to cold boot (reload environment). #{bold_yellow}CTRL-C#{reset} to quit\n> "
37
+ begin
38
+ command = $stdin.gets
39
+ rescue Interrupt
40
+ exit(0)
41
+ end
42
+ break if !command.nil? and command.chomp == "r"
43
+
44
+ # Now we do a warm run, which runs the files in subprocesses
45
+ puts "#{bold_yellow}Warm Run#{reset} [#{@files.inspect}]"
46
+ start = Time.now
47
+ Hydra::Master.new(
48
+ :files => @files.dup,
49
+ :listeners => Hydra::Listener::ProgressBar.new(STDOUT),
50
+ :workers => [{:type => :local, :runners => 4}]
51
+ )
52
+ finish = Time.now
53
+
54
+ puts "#{bold_yellow}Tests finished#{reset} (#{finish-start})"
55
+ puts ""
56
+ end
57
+ end
58
+ begin
59
+ Process.wait env_proc
60
+ rescue Interrupt
61
+ puts "\n#{bold_yellow}SSsssSsssSSssSs#{reset}"
62
+ break
63
+ end
64
+ end
65
+
@@ -0,0 +1,25 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{hydra-console}
3
+ s.version = "0.1.0"
4
+
5
+ s.authors = ["Nick Gauthier"]
6
+ s.date = %q{2010-11-03}
7
+ s.description = %q{Run tests repeatedly without rebooting your environment}
8
+ s.email = %q{nick@smartlogicsolutions.com}
9
+ s.extra_rdoc_files = [
10
+ "LICENSE",
11
+ "README.rdoc"
12
+ ]
13
+ s.files = [
14
+ "bin/hydra-console",
15
+ "LICENSE",
16
+ "README.rdoc",
17
+ "hydra-console.gemspec"
18
+ ]
19
+ s.homepage = %q{http://github.com/ngauthier/hydra-console}
20
+ s.rdoc_options = ["--charset=UTF-8"]
21
+ s.rubygems_version = %q{1.3.7}
22
+ s.summary = %q{Run tests repeatedly}
23
+ s.add_dependency('hydra', ['= 0.23.2'])
24
+ end
25
+
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hydra-console
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Nick Gauthier
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-03 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: hydra
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - "="
28
+ - !ruby/object:Gem::Version
29
+ hash: 71
30
+ segments:
31
+ - 0
32
+ - 23
33
+ - 2
34
+ version: 0.23.2
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: Run tests repeatedly without rebooting your environment
38
+ email: nick@smartlogicsolutions.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE
45
+ - README.rdoc
46
+ files:
47
+ - bin/hydra-console
48
+ - LICENSE
49
+ - README.rdoc
50
+ - hydra-console.gemspec
51
+ has_rdoc: true
52
+ homepage: http://github.com/ngauthier/hydra-console
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options:
57
+ - --charset=UTF-8
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ requirements: []
79
+
80
+ rubyforge_project:
81
+ rubygems_version: 1.3.7
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Run tests repeatedly
85
+ test_files: []
86
+