torquespec 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/apps/simple/config.ru +1 -0
- data/lib/torquespec/deployment_descriptor.rb +10 -1
- data/lib/torquespec/server.rb +1 -5
- data/lib/torquespec/torquespec.rb +4 -3
- data/lib/torquespec/version.rb +1 -1
- data/spec/hello_world_spec.rb +14 -1
- metadata +5 -4
data/.gitignore
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
run lambda { |env| [200, {'Content-Type'=>'text/plain'}, "Hello World!\n" ] }
|
@@ -10,7 +10,7 @@ module TorqueSpec
|
|
10
10
|
@path = Pathname.new( name.gsub(/\W/,'_') + "-knob.yml" ).expand_path( TorqueSpec.knob_root )
|
11
11
|
end
|
12
12
|
def path
|
13
|
-
hash || filename || heredoc
|
13
|
+
archive( hash || filename || heredoc )
|
14
14
|
end
|
15
15
|
def hash
|
16
16
|
if @descriptor.is_a? Hash
|
@@ -32,6 +32,15 @@ module TorqueSpec
|
|
32
32
|
end
|
33
33
|
@path.to_s
|
34
34
|
end
|
35
|
+
def archive(path)
|
36
|
+
if TorqueSpec.as7? && path.end_with?('.yml')
|
37
|
+
jar = path.sub(/yml$/,'jar')
|
38
|
+
`jar cf #{jar} -C #{File.dirname(path)} #{File.basename(path)}`
|
39
|
+
jar
|
40
|
+
else
|
41
|
+
path
|
42
|
+
end
|
43
|
+
end
|
35
44
|
def stringify_keys(x)
|
36
45
|
x.is_a?(Hash) ? x.inject({}) {|h,(k,v)| h[k.to_s] = stringify_keys(v); h} : x
|
37
46
|
end
|
data/lib/torquespec/server.rb
CHANGED
@@ -14,13 +14,16 @@ module TorqueSpec
|
|
14
14
|
end
|
15
15
|
|
16
16
|
class << self
|
17
|
-
attr_accessor :
|
17
|
+
attr_accessor :knob_root, :jboss_home, :jvm_args, :max_heap, :lazy
|
18
18
|
def configure
|
19
19
|
yield self
|
20
20
|
end
|
21
21
|
def jvm_args
|
22
22
|
max_heap ? @jvm_args.sub(/-Xmx\w+/, "-Xmx#{max_heap}") : @jvm_args
|
23
23
|
end
|
24
|
+
def as7?
|
25
|
+
File.exist?( File.join( jboss_home, "bin/standalone.sh" ) )
|
26
|
+
end
|
24
27
|
end
|
25
28
|
|
26
29
|
end
|
@@ -28,9 +31,7 @@ end
|
|
28
31
|
# Default TorqueSpec options
|
29
32
|
TorqueSpec.configure do |config|
|
30
33
|
config.knob_root = ".torquespec"
|
31
|
-
config.lazy = false
|
32
34
|
config.jboss_home = ENV['JBOSS_HOME']
|
33
|
-
config.jboss_conf = 'default'
|
34
35
|
config.jvm_args = "-Xms64m -Xmx1024m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -Djruby_home.env.ignore=true -Dgem.path=default"
|
35
36
|
end
|
36
37
|
|
data/lib/torquespec/version.rb
CHANGED
data/spec/hello_world_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'open-uri'
|
|
3
3
|
|
4
4
|
TorqueSpec.lazy = false
|
5
5
|
|
6
|
-
describe "simple deployment" do
|
6
|
+
describe "simple knob deployment" do
|
7
7
|
|
8
8
|
deploy File.join( File.dirname(__FILE__), "../apps/simple.knob" )
|
9
9
|
|
@@ -12,3 +12,16 @@ describe "simple deployment" do
|
|
12
12
|
response.strip.should == "Hello World!"
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
describe "simple directory deployment" do
|
17
|
+
|
18
|
+
deploy <<-END.gsub(/^ {4}/,'')
|
19
|
+
application:
|
20
|
+
root: #{File.dirname(__FILE__)}/../apps/simple
|
21
|
+
END
|
22
|
+
|
23
|
+
it "should greet the world" do
|
24
|
+
response = open("http://localhost:8080") {|f| f.read}
|
25
|
+
response.strip.should == "Hello World!"
|
26
|
+
end
|
27
|
+
end
|
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
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
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-05-
|
19
|
+
date: 2011-05-16 00:00:00 -04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- README.md
|
62
62
|
- Rakefile
|
63
63
|
- apps/simple.knob
|
64
|
+
- apps/simple/config.ru
|
64
65
|
- lib/torquespec.rb
|
65
66
|
- lib/torquespec/as6.rb
|
66
67
|
- lib/torquespec/as7.rb
|