JonathanTron-specjour 0.2.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/.dev ADDED
@@ -0,0 +1,3 @@
1
+ export RUBYLIB=`pwd`/lib
2
+ export RUBYOPT=rubygems
3
+ export PATH=`pwd`/bin:$PATH
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,23 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ .specjour
23
+ spec/spec.opts
@@ -0,0 +1,55 @@
1
+ History
2
+ =======
3
+ 0.2.6
4
+ -----
5
+ *master*
6
+ * [added] Allow setting project name used by dispatcher via SPECJOUR_PROJECT_NAME environment variable
7
+ * [fixed] Rsync now transfer symbolic links. gh-6
8
+ * [fixed] DbScrub explicitly requires its dependencies and no longer loads the
9
+ Rakefile. gh-10
10
+ 0.2.5
11
+ -----
12
+ *2010-05-13*
13
+
14
+ * [changed] The rails plugin now runs in a Rails.configuration.after_intialize
15
+ block
16
+
17
+ 0.2.4
18
+ -----
19
+ *2010-05-10*
20
+
21
+ * [added] Correct exit status
22
+ * [fixed] Will reconnect when connection is lost while requesting tests
23
+
24
+ 0.2.3
25
+ -----
26
+ *2010-04-25*
27
+
28
+ * [fixed] Absolute paths in rsyncd.conf restrict portability. The rsync daemon
29
+ completely fails when it can't find the path to serve which typically happens
30
+ running specjour on another computer. Remove your rsyncd.conf to regenerate a
31
+ new one. Back it up first if you've made changes to it.
32
+ **Backwards Incompatible**
33
+
34
+ * [fixed] CPU core detection works on OSX Core i7 (thanks Hashrocket!)
35
+
36
+ 0.2.2
37
+ -----
38
+ *2010-04-22*
39
+
40
+ * [added] Backtrace for cucumber failures
41
+
42
+ 0.2.1
43
+ -----
44
+ *2010-04-21*
45
+
46
+ * [added] The rsync daemon configuration file now lives in
47
+ project_path/.specjour/rsyncd.conf. Edit your rsync exclusions there.
48
+ * [fixed] Don't report connection errors when CTRL-C is sent.
49
+
50
+ 0.2.0
51
+ -----
52
+ *2010-04-20*
53
+
54
+ * [added] Cucumber support. `rake specjour:cucumber`
55
+ * [added] CPU Core detection, use -w to override with less or more workers
@@ -0,0 +1,102 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{JonathanTron-specjour}
8
+ s.version = "0.2.5.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Sandro Turriate"]
12
+ s.date = %q{2010-06-15}
13
+ s.default_executable = %q{specjour}
14
+ s.description = %q{Distribute your spec suite amongst your LAN via Bonjour.}
15
+ s.email = %q{sandro.turriate@gmail.com}
16
+ s.executables = ["specjour"]
17
+ s.extra_rdoc_files = [
18
+ "README.markdown"
19
+ ]
20
+ s.files = [
21
+ ".dev",
22
+ ".document",
23
+ ".gitignore",
24
+ "History.markdown",
25
+ "JonathanTron-specjour.gemspec",
26
+ "MIT_LICENSE",
27
+ "README.markdown",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "bin/specjour",
31
+ "lib/specjour.rb",
32
+ "lib/specjour/connection.rb",
33
+ "lib/specjour/cpu.rb",
34
+ "lib/specjour/cucumber.rb",
35
+ "lib/specjour/cucumber/dispatcher.rb",
36
+ "lib/specjour/cucumber/distributed_formatter.rb",
37
+ "lib/specjour/cucumber/final_report.rb",
38
+ "lib/specjour/cucumber/printer.rb",
39
+ "lib/specjour/db_scrub.rb",
40
+ "lib/specjour/dispatcher.rb",
41
+ "lib/specjour/manager.rb",
42
+ "lib/specjour/printer.rb",
43
+ "lib/specjour/protocol.rb",
44
+ "lib/specjour/rspec.rb",
45
+ "lib/specjour/rspec/distributed_formatter.rb",
46
+ "lib/specjour/rspec/final_report.rb",
47
+ "lib/specjour/rspec/marshalable_rspec_failure.rb",
48
+ "lib/specjour/rsync_daemon.rb",
49
+ "lib/specjour/socket_helpers.rb",
50
+ "lib/specjour/tasks/dispatch.rake",
51
+ "lib/specjour/tasks/specjour.rb",
52
+ "lib/specjour/worker.rb",
53
+ "rails/init.rb",
54
+ "spec/cpu_spec.rb",
55
+ "spec/lib/specjour/worker_spec.rb",
56
+ "spec/manager_spec.rb",
57
+ "spec/rsync_daemon_spec.rb",
58
+ "spec/spec.opts",
59
+ "spec/spec_helper.rb",
60
+ "spec/specjour_spec.rb",
61
+ "specjour.gemspec"
62
+ ]
63
+ s.homepage = %q{http://github.com/sandro/specjour}
64
+ s.rdoc_options = ["--charset=UTF-8"]
65
+ s.require_paths = ["lib"]
66
+ s.rubygems_version = %q{1.3.6}
67
+ s.summary = %q{Distribute your spec suite amongst your LAN via Bonjour.}
68
+ s.test_files = [
69
+ "spec/cpu_spec.rb",
70
+ "spec/lib/specjour/worker_spec.rb",
71
+ "spec/manager_spec.rb",
72
+ "spec/rsync_daemon_spec.rb",
73
+ "spec/spec_helper.rb",
74
+ "spec/specjour_spec.rb"
75
+ ]
76
+
77
+ if s.respond_to? :specification_version then
78
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
79
+ s.specification_version = 3
80
+
81
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
82
+ s.add_runtime_dependency(%q<dnssd>, ["= 1.3.1"])
83
+ s.add_runtime_dependency(%q<rspec>, [">= 0"])
84
+ s.add_development_dependency(%q<rspec>, ["= 1.3.0"])
85
+ s.add_development_dependency(%q<rr>, ["= 0.10.11"])
86
+ s.add_development_dependency(%q<yard>, ["= 0.5.3"])
87
+ else
88
+ s.add_dependency(%q<dnssd>, ["= 1.3.1"])
89
+ s.add_dependency(%q<rspec>, [">= 0"])
90
+ s.add_dependency(%q<rspec>, ["= 1.3.0"])
91
+ s.add_dependency(%q<rr>, ["= 0.10.11"])
92
+ s.add_dependency(%q<yard>, ["= 0.5.3"])
93
+ end
94
+ else
95
+ s.add_dependency(%q<dnssd>, ["= 1.3.1"])
96
+ s.add_dependency(%q<rspec>, [">= 0"])
97
+ s.add_dependency(%q<rspec>, ["= 1.3.0"])
98
+ s.add_dependency(%q<rr>, ["= 0.10.11"])
99
+ s.add_dependency(%q<yard>, ["= 0.5.3"])
100
+ end
101
+ end
102
+
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Sandro Turriate
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,110 @@
1
+ # Specjour
2
+
3
+ ## FUCK SETI. Run specs with your spare CPU cycles.
4
+
5
+ _Distribute your spec suite amongst your LAN via Bonjour._
6
+
7
+ 1. Spin up a manager on each machine that can run your specs.
8
+ 2. Start a dispatcher in your project directory.
9
+ 3. Say farewell to your long coffee breaks.
10
+
11
+ ## Requirements
12
+ * Bonjour or DNSSD (the capability and the gem)
13
+ * Rsync (system command used)
14
+ * Rspec (officially v1.3.0)
15
+
16
+ ## Installation
17
+ gem install specjour
18
+
19
+ ## Start a manager
20
+ Running `specjour` on the command-line will start a manager which advertises that it's ready to run specs. By default, the manager will use your system cores to determine the number of workers to use. Two cores equals two workers. If you only want to dedicate 1 core to running specs, use `$ specjour --workers 1`.
21
+
22
+ $ specjour
23
+
24
+ ## Setup the dispatcher
25
+ Require specjour's rake tasks in your project's `Rakefile`.
26
+
27
+ require 'specjour/tasks/specjour'
28
+
29
+ ## Distribute the specs
30
+ Run the rake task to distribute the specs among the managers you started.
31
+
32
+ $ rake specjour
33
+
34
+ ## Distribute the features
35
+ Run the rake task to distribute the features among the managers you started.
36
+
37
+ $ rake specjour:cucumber
38
+
39
+ ## Rails
40
+ Each worker should run their specs in an isolated database. Modify the test database name in your `config/database.yml` to include the following environment variable (Influenced by [parallel\_tests](http://github.com/grosser/parallel_tests)):
41
+
42
+ test:
43
+ database: blog_test<%=ENV['TEST_ENV_NUMBER']%>
44
+
45
+ Add the specjour gem to your project:
46
+
47
+ config.gem 'specjour'
48
+
49
+ Doing this enables a rails plugin wherein each worker will attempt to clear its database tables before running any specs via `DELETE FROM <table_name>;`. Additionally, test databases will be created if they don't exist (i.e. `CREATE DATABASE blog_test8` for the 8th worker) and your schema will be loaded when the database is out of date.
50
+
51
+ ### Customizing database setup
52
+ If the plugin doesn't set up the database properly for your test suite, bypass it entirely. Remove specjour as a project gem and create your own initializer to setup the database. Specjour sets the environment variable PREPARE\_DB when it runs your specs so you can look for that when setting up the database.
53
+
54
+ # config/initializers/specjour.rb
55
+
56
+ if ENV['PREPARE_DB']
57
+ load 'Rakefile'
58
+
59
+ # clear the db and load db/seeds.rb
60
+ Rake::Task['db:reset'].invoke
61
+ end
62
+
63
+ ## Only listen to supported projects
64
+ By default, a manager will listen to all projects trying to distribute specs over the network. Sometimes you'll only want a manager to respond to one specific spec suite. You can accomplish this with the `--projects` flag.
65
+
66
+ $ specjour --projects bizconf # only run specs for the bizconf project
67
+
68
+ You could also listen to multiple projects:
69
+
70
+ $ specjour --projects bizconf,workbeast # only run specs for the bizconf and workbeast projects
71
+
72
+ ## Customize what gets rsync'd
73
+ The standard rsync configuration file may be too broad for your
74
+ project. If you find you're rsyncing gigs of extraneous data from your public
75
+ directory, add an exclusion to your projects rsyncd.conf file.
76
+
77
+ $ vi workbeast/.specjour/rsyncd.conf
78
+
79
+ ## Use a specific project name
80
+ The default configuration is using the project directory as project name. If you want to change the default name for the project, you can set the SPECJOUR_PROJECT_NAME environment variable when starting the tasks.
81
+
82
+ $ SPECJOUR_PROJECT_NAME=myproject rake specjour
83
+ $ SPECJOUR_PROJECT_NAME=myproject rake specjour:cucumber
84
+
85
+ ## Use one machine
86
+ Distributed testing doesn't have to happen over multiple machines, just multiple processes. Specjour is an excellent candidiate for running 4 tests at once on one machine with 4 cores. Just run `$ specjour` in one window and `$ rake specjour` in another.
87
+
88
+ ## Thanks
89
+
90
+ * shayarnett - Cucumber support, pairing and other various patches
91
+ * voxdolo - Endless support, alpha testing, various patches
92
+ * leshill - Made rsync daemon configurable
93
+ * testjour - Ripped off your name
94
+ * parallel\_tests - Made my test suite twice as fast
95
+
96
+ ## Note on Patches/Pull Requests
97
+
98
+ * Fork the project.
99
+ * `$ source .dev` to ensure you're using the local specjour binary, not the
100
+ rubygems version
101
+ * Make your feature addition or bug fix.
102
+ * Add tests for it. This is important so I don't break it in a
103
+ future version unintentionally.
104
+ * Commit, do not mess with rakefile, version, or history.
105
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
106
+ * Send me a pull request. Bonus points for topic branches.
107
+
108
+ ## Copyright
109
+
110
+ Copyright (c) 2010 Sandro Turriate. See MIT\_LICENSE for details.
@@ -0,0 +1,51 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "JonathanTron-specjour"
8
+ gem.summary = %Q{Distribute your spec suite amongst your LAN via Bonjour.}
9
+ gem.description = %Q{Distribute your spec suite amongst your LAN via Bonjour.}
10
+ gem.email = "sandro.turriate@gmail.com"
11
+ gem.homepage = "http://github.com/sandro/specjour"
12
+ gem.authors = ["Sandro Turriate"]
13
+ gem.add_dependency "dnssd", "1.3.1"
14
+ gem.add_dependency "rspec"
15
+ gem.add_development_dependency "rspec", "1.3.0"
16
+ gem.add_development_dependency "rr", "0.10.11"
17
+ gem.add_development_dependency "yard", "0.5.3"
18
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+ rescue LoadError
22
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
23
+ end
24
+
25
+ require 'spec/rake/spectask'
26
+ Spec::Rake::SpecTask.new(:spec) do |spec|
27
+ spec.libs << 'lib' << 'spec'
28
+ spec.spec_files = FileList['spec/**/*_spec.rb']
29
+ end
30
+
31
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
32
+ spec.libs << 'lib' << 'spec'
33
+ spec.pattern = 'spec/**/*_spec.rb'
34
+ spec.rcov = true
35
+ end
36
+
37
+ task :spec => :check_dependencies
38
+
39
+ task :default => :spec
40
+
41
+ begin
42
+ require 'yard'
43
+ YARD::Rake::YardocTask.new
44
+ rescue LoadError
45
+ task :yardoc do
46
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
47
+ end
48
+ end
49
+
50
+ $:.unshift(File.dirname(__FILE__) + "/lib")
51
+ require 'specjour/tasks/specjour'
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.5.1
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+ require 'optparse'
3
+ require 'specjour'
4
+
5
+ options = {:batch_size => 1}
6
+
7
+ optparse = OptionParser.new do |opts|
8
+ opts.banner = "Usage: specjour [options]"
9
+
10
+ opts.on('-w', '--workers WORKERS', Numeric, "Number of WORKERS to spin up, defaults to available cores") do |n|
11
+ options[:worker_size] = n
12
+ end
13
+
14
+ opts.on('-b', '--batch-size [SIZE]', Integer, "Number of specs to run before reporting back to the dispatcher, defaults to #{options[:batch_size]}") do |n|
15
+ options[:batch_size] = n
16
+ end
17
+
18
+ opts.on('-p', '--projects PROJECTS', Array, "Only run specs for these comma delimited project names, i.e. workbeast,taigan") do |project_names|
19
+ options[:registered_projects] = project_names
20
+ end
21
+
22
+ opts.on('--do-work OPTIONS', Array, 'INTERNAL USE ONLY') do |args|
23
+ options[:worker_args] = args[0], args[1], args[2]
24
+ end
25
+
26
+ opts.on('--log', TrueClass, 'print debug messages to stdout') do |val|
27
+ Specjour.new_logger Logger::DEBUG
28
+ end
29
+
30
+ opts.on_tail('-v', '--version', 'Show the version of specjour') do
31
+ abort Specjour::VERSION
32
+ end
33
+
34
+ opts.on_tail("-h", "--help", "Show this message") do
35
+ summary = opts.to_a
36
+ summary.first << "\n"
37
+ abort summary.reject {|s| s =~ /INTERNAL/}.join
38
+ end
39
+ end
40
+
41
+ optparse.parse!
42
+
43
+ abort(%(ERROR: I don't understand the following flags: "#{ARGV.join(', ')}")) if ARGV.any?
44
+
45
+ if options[:worker_args]
46
+ options[:worker_args] << options[:batch_size]
47
+ Specjour::Worker.new(*options[:worker_args]).run
48
+ else
49
+ options[:worker_size] ||= Specjour::CPU.cores
50
+ Specjour::Manager.new(options).start
51
+ end
@@ -0,0 +1,43 @@
1
+ require 'drb'
2
+
3
+ autoload :URI, 'uri'
4
+ autoload :Forwardable, 'forwardable'
5
+ autoload :GServer, 'gserver'
6
+ autoload :Timeout, 'timeout'
7
+ autoload :Benchmark, 'benchmark'
8
+ autoload :Logger, 'logger'
9
+ autoload :Socket, 'socket'
10
+
11
+ module Specjour
12
+ autoload :CPU, 'specjour/cpu'
13
+ autoload :Connection, 'specjour/connection'
14
+ autoload :Dispatcher, 'specjour/dispatcher'
15
+ autoload :Manager, 'specjour/manager'
16
+ autoload :OpenStruct, 'ostruct'
17
+ autoload :Printer, 'specjour/printer'
18
+ autoload :Protocol, 'specjour/protocol'
19
+ autoload :RsyncDaemon, 'specjour/rsync_daemon'
20
+ autoload :SocketHelpers, 'specjour/socket_helpers'
21
+ autoload :Worker, 'specjour/worker'
22
+
23
+ autoload :Cucumber, 'specjour/cucumber'
24
+ autoload :Rspec, 'specjour/rspec'
25
+
26
+ VERSION = "0.2.5.1".freeze
27
+
28
+ class Error < StandardError; end
29
+
30
+ def self.logger
31
+ @logger ||= new_logger
32
+ end
33
+
34
+ def self.new_logger(level = Logger::UNKNOWN)
35
+ @logger = Logger.new $stdout
36
+ @logger.level = level
37
+ @logger
38
+ end
39
+
40
+ def self.log?
41
+ logger.level != Logger::UNKNOWN
42
+ end
43
+ end