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 CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .torquespec/*
@@ -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
@@ -6,11 +6,7 @@ module TorqueSpec
6
6
  class Server
7
7
 
8
8
  def initialize
9
- if File.exist?( File.join( TorqueSpec.jboss_home, "bin/run.sh" ) )
10
- self.extend AS6
11
- else
12
- self.extend AS7
13
- end
9
+ self.extend( TorqueSpec.as7? ? AS7 : AS6 )
14
10
  end
15
11
 
16
12
  def start(opts={})
@@ -14,13 +14,16 @@ module TorqueSpec
14
14
  end
15
15
 
16
16
  class << self
17
- attr_accessor :host, :port, :knob_root, :jboss_home, :jboss_conf, :jvm_args, :max_heap, :lazy
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
 
@@ -1,3 +1,3 @@
1
1
  module TorqueSpec
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -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: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
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-15 00:00:00 -04:00
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