qspec 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +18 -0
- data/lib/qspec.rb +1 -1
- data/lib/qspec/command_line.rb +1 -1
- data/lib/qspec/config.rb +1 -0
- data/lib/qspec/ipc.rb +4 -3
- data/lib/qspec/ipc/file.rb +1 -4
- data/lib/qspec/ipc/redis.rb +6 -3
- data/lib/qspec/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -60,6 +60,24 @@ bundle exec qspec-helper spork
|
|
60
60
|
bundle exec qspec spec/
|
61
61
|
```
|
62
62
|
|
63
|
+
## Configuration
|
64
|
+
|
65
|
+
All configuration is done through `.qspec.yml`.
|
66
|
+
`qspec-helper init` will generate the template, but there are more options.
|
67
|
+
|
68
|
+
### redis
|
69
|
+
|
70
|
+
This option is given to redis's constructor.
|
71
|
+
See [redis-rb/README.md](https://github.com/redis/redis-rb/blob/master/README.md) for more details.
|
72
|
+
|
73
|
+
```yaml
|
74
|
+
redis:
|
75
|
+
host: localhost
|
76
|
+
port: 6379
|
77
|
+
namespace: qspec
|
78
|
+
driver: hiredis
|
79
|
+
```
|
80
|
+
|
63
81
|
## Contributing
|
64
82
|
|
65
83
|
1. Fork it
|
data/lib/qspec.rb
CHANGED
data/lib/qspec/command_line.rb
CHANGED
data/lib/qspec/config.rb
CHANGED
@@ -32,6 +32,7 @@ ipc: file # 'file' or 'redis', if 'redis', gem and server are required
|
|
32
32
|
sort_by: time # 'time' or 'size', if 'time', store execution time and use it next time
|
33
33
|
workers: 4 # half of cpu - number of cpu
|
34
34
|
spork_port: 9240 # specified port..port+N-1 are used
|
35
|
+
tmp_directory: tmp/qspec # the root directory for temporary files. relative or absolute
|
35
36
|
TMPL
|
36
37
|
end
|
37
38
|
puts "Config file created in #{path}. Check it before run `qspec spec`."
|
data/lib/qspec/ipc.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
module Qspec
|
2
2
|
# abstract
|
3
3
|
class IPC
|
4
|
-
def self.from_config(
|
4
|
+
def self.from_config(config)
|
5
|
+
name = config['ipc']
|
5
6
|
@@default =
|
6
7
|
case name
|
7
8
|
when 'redis'
|
8
9
|
require 'qspec/ipc/redis'
|
9
|
-
IPC::Redis.new
|
10
|
+
IPC::Redis.new(config['redis'])
|
10
11
|
when 'file', nil
|
11
12
|
require 'qspec/ipc/file'
|
12
|
-
IPC::File.new
|
13
|
+
IPC::File.new(config['file'])
|
13
14
|
else
|
14
15
|
raise "Unknown IPC method #{name}"
|
15
16
|
end
|
data/lib/qspec/ipc/file.rb
CHANGED
data/lib/qspec/ipc/redis.rb
CHANGED
@@ -2,13 +2,16 @@ require 'redis'
|
|
2
2
|
module Qspec
|
3
3
|
class IPC
|
4
4
|
class Redis < IPC
|
5
|
-
def initialize
|
6
|
-
|
5
|
+
def initialize(config)
|
6
|
+
config ||= {}
|
7
|
+
@redis = ::Redis.new(config)
|
8
|
+
@namespace = config['namespace'] || 'qspec'
|
7
9
|
end
|
8
10
|
|
9
11
|
[:del, :lpop, :rpush, :llen].each do |method|
|
10
12
|
define_method(method) do |*args|
|
11
|
-
|
13
|
+
key = args.shift
|
14
|
+
@redis.send(method, "#{@namespace}:#{key}", *args)
|
12
15
|
end
|
13
16
|
end
|
14
17
|
end
|
data/lib/qspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
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: 2013-06-
|
12
|
+
date: 2013-06-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec-core
|
@@ -71,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
71
|
version: '0'
|
72
72
|
segments:
|
73
73
|
- 0
|
74
|
-
hash:
|
74
|
+
hash: 698092429
|
75
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
76
|
none: false
|
77
77
|
requirements:
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
segments:
|
82
82
|
- 0
|
83
|
-
hash:
|
83
|
+
hash: 698092429
|
84
84
|
requirements: []
|
85
85
|
rubyforge_project:
|
86
86
|
rubygems_version: 1.8.23
|