torquespec 0.0.2 → 0.0.3
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.
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module TorqueSpec
|
6
|
+
|
7
|
+
class DeploymentDescriptor
|
8
|
+
def initialize(descriptor, name)
|
9
|
+
@descriptor = descriptor
|
10
|
+
@path = Pathname.new( name.gsub(/\W/,'_') + "-knob.yml" ).expand_path( TorqueSpec.knob_root )
|
11
|
+
end
|
12
|
+
def path
|
13
|
+
hash || filename || heredoc
|
14
|
+
end
|
15
|
+
def hash
|
16
|
+
if @descriptor.is_a? Hash
|
17
|
+
File.open( @path, 'w' ) do |file|
|
18
|
+
YAML.dump( stringify_keys(@descriptor), file )
|
19
|
+
end
|
20
|
+
@path.to_s
|
21
|
+
end
|
22
|
+
end
|
23
|
+
def filename
|
24
|
+
filename = Pathname.new(@descriptor).expand_path( TorqueSpec.knob_root )
|
25
|
+
if filename.exist?
|
26
|
+
filename.to_s
|
27
|
+
end
|
28
|
+
end
|
29
|
+
def heredoc
|
30
|
+
File.open( @path, 'w' ) do |file|
|
31
|
+
file.write(@descriptor)
|
32
|
+
end
|
33
|
+
@path.to_s
|
34
|
+
end
|
35
|
+
def stringify_keys(x)
|
36
|
+
x.is_a?(Hash) ? x.inject({}) {|h,(k,v)| h[k.to_s] = stringify_keys(v); h} : x
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
@@ -1,11 +1,16 @@
|
|
1
|
-
require '
|
1
|
+
require 'torquespec/deployment_descriptor'
|
2
2
|
|
3
3
|
module TorqueSpec
|
4
4
|
|
5
|
-
|
5
|
+
# Accepts any combination of hashes, filenames, or heredocs
|
6
|
+
def deploy(*descriptors)
|
7
|
+
paths = descriptors.map do |descriptor|
|
8
|
+
DeploymentDescriptor.new(descriptor, self.display_name).path
|
9
|
+
end
|
6
10
|
metaclass = class << self; self; end
|
7
11
|
metaclass.send(:define_method, :deploy_paths) do
|
8
|
-
|
12
|
+
FileUtils.mkdir_p(TorqueSpec.knob_root) unless File.exist?(TorqueSpec.knob_root)
|
13
|
+
paths
|
9
14
|
end
|
10
15
|
end
|
11
16
|
|
@@ -23,6 +28,7 @@ end
|
|
23
28
|
|
24
29
|
# Default TorqueSpec options
|
25
30
|
TorqueSpec.configure do |config|
|
31
|
+
config.knob_root = ".torquespec"
|
26
32
|
config.lazy = true
|
27
33
|
config.host = 'localhost'
|
28
34
|
config.port = 8080
|
data/lib/torquespec/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torquespec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jim Crossley
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-04-
|
19
|
+
date: 2011-04-30 00:00:00 -04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- README.md
|
48
48
|
- Rakefile
|
49
49
|
- lib/torquespec.rb
|
50
|
+
- lib/torquespec/deployment_descriptor.rb
|
50
51
|
- lib/torquespec/rspec.rb
|
51
52
|
- lib/torquespec/server.rb
|
52
53
|
- lib/torquespec/torquespec.rb
|