warbler-exec 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,25 @@
1
+ = warbler-exec
2
+
3
+ warbler-exec is provided under the terms of the MIT license.
4
+
5
+ warbler-exec (c) 2012 Joe Kutner
6
+
7
+ Permission is hereby granted, free of charge, to any person
8
+ obtaining a copy of this software and associated documentation files
9
+ (the "Software"), to deal in the Software without restriction,
10
+ including without limitation the rights to use, copy, modify, merge,
11
+ publish, distribute, sublicense, and/or sell copies of the Software,
12
+ and to permit persons to whom the Software is furnished to do so,
13
+ subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
data/README.md CHANGED
@@ -25,7 +25,21 @@ Then run Bundler the with `--binstubs` option, and use `warbler-exec` to run the
25
25
 
26
26
  Every time that `warbler-exec` runs, it extracts the WAR file. Don't expect it to be fast.
27
27
 
28
- # Roadmap
28
+ ## Wait! I need Ruby installed to run the Ruby in my WAR?
29
29
 
30
- It would be a lot easier if we didn't have to run Bundler with the `--binstubs` option. Eventually, someone (probably the person writing this) will submit a patch to Warbler that gets around this.
30
+ Yes, you'll need a Ruby runtime installed on your machine in order to run this Gem (even though it switches to the Ruby inside your WAR file). There are a few reasons for this:
31
+
32
+ + Gems are nice way to distribute tools (better than "go download this script from ...")
33
+
34
+ + Ruby is more portable than Shell scripts (this tool works on Windows).
35
+
36
+ + This tool can be run on MRI, and most environments have that already installed (especially if they are using Puppet or Chef for configuration management).
37
+
38
+ + Eventually, this tool will support more advanced options; such as exploding the WAR file once and running multiple commands. Use Ruby for this will be much nicer than the alternatives.
39
+
40
+ ## Roadmap
41
+
42
+ + It would be a lot easier if we didn't have to run Bundler with the `--binstubs` option. Eventually, someone (probably the person writing this) will submit a patch to Warbler that gets around this.
43
+
44
+ + It would be better if we didn't have to extract the WAR file every time. That's easy enough to do, but i'm not sure how it would look from the command line. Would there be a special command to extract the WAR to a particular location?
31
45
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'zip/zip'
4
4
  require 'tmpdir'
5
+ require 'rbconfig'
5
6
 
6
7
  path_to_war = ARGV.shift
7
8
 
@@ -14,13 +15,26 @@ Zip::ZipFile.open(path_to_war) do |zipfile|
14
15
  end
15
16
  end
16
17
 
17
- Dir.chdir(File.join(destination, "WEB-INF"))
18
- ENV["CLASSPATH"] = Dir["#{Dir.pwd}/lib/*.jar"].join(":")
18
+ workdir = File.join(destination, "WEB-INF")
19
+ Dir.chdir(workdir)
20
+
21
+ ENV["CLASSPATH"] = Dir["#{Dir.pwd}/lib/*.jar"].join(File::PATH_SEPARATOR)
19
22
  ENV["GEM_PATH"] = "#{Dir.pwd}/gems"
20
23
  ENV["GEM_HOME"] = "#{Dir.pwd}/gems"
21
24
 
22
- begin
23
- Kernel.exec("java -Xmx512m -cp $CLASSPATH org.jruby.Main #{ARGV.join(" ")}")
25
+ begin
26
+ # the unix way is the default way
27
+ cmd = "java -Xmx512m -cp $CLASSPATH org.jruby.Main #{ARGV.join(" ")}"
28
+
29
+ if /mswin/ =~ RbConfig::CONFIG["host_os"]
30
+ cmd = "java -Xmx512m -cp %CLASSPATH% org.jruby.Main #{ARGV.join(" ")}"
31
+ # work around http://jira.codehaus.org/browse/JRUBY-6994 which makes Kernel.exec forget about chdir
32
+ if defined?(JRUBY_VERSION) && JRUBY_VERSION < "1.7.1"
33
+ cmd = "cd #{workdir} & #{cmd}"
34
+ end
35
+ end
36
+
37
+ Kernel.exec(cmd)
24
38
  rescue Errno::EACCES
25
39
  puts "warbler-exec: not executable: #{ARGV.first}"
26
40
  exit 126
@@ -30,6 +44,6 @@ rescue Errno::ENOENT
30
44
  rescue ArgumentError
31
45
  puts "warbler-exec: exec needs a command to run"
32
46
  exit 128
33
- end
47
+ end
34
48
 
35
49
 
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "warbler-exec"
6
- s.version = "0.1.0"
6
+ s.version = "0.1.1"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Joe Kutner"]
9
9
  s.email = ["jpkutner@gmail.com"]
metadata CHANGED
@@ -1,68 +1,69 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: warbler-exec
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
6
  platform: ruby
7
- authors:
8
- - Joe Kutner
9
- autorequire:
7
+ authors:
8
+ - Joe Kutner
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-03-26 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rubyzip
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 0.9.4
24
- type: :runtime
25
- version_requirements: *id001
12
+ date: 2012-12-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rubyzip
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ! '>='
19
+ - !ruby/object:Gem::Version
20
+ version: 0.9.4
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.4
27
+ none: false
28
+ prerelease: false
29
+ type: :runtime
26
30
  description: This utility allows you to execute commands with the context of a Warbler WAR file
27
- email:
28
- - jpkutner@gmail.com
29
- executables:
30
- - warbler-exec
31
+ email:
32
+ - jpkutner@gmail.com
33
+ executables:
34
+ - warbler-exec
31
35
  extensions: []
32
-
33
36
  extra_rdoc_files: []
34
-
35
- files:
36
- - .gitignore
37
- - README.md
38
- - bin/warbler-exec
39
- - warbler-exec.gemspec
37
+ files:
38
+ - .gitignore
39
+ - LICENSE.txt
40
+ - README.md
41
+ - bin/warbler-exec
42
+ - warbler-exec.gemspec
40
43
  homepage: https://github.com/jkutner/warbler-exec
41
44
  licenses: []
42
-
43
- post_install_message:
45
+ post_install_message:
44
46
  rdoc_options: []
45
-
46
- require_paths:
47
- - lib
48
- required_ruby_version: !ruby/object:Gem::Requirement
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: !binary |-
54
+ MA==
49
55
  none: false
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: "0"
54
- required_rubygems_version: !ruby/object:Gem::Requirement
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: !binary |-
61
+ MA==
55
62
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: "0"
60
63
  requirements: []
61
-
62
64
  rubyforge_project: warbler-exec
63
- rubygems_version: 1.8.15
64
- signing_key:
65
+ rubygems_version: 1.8.24
66
+ signing_key:
65
67
  specification_version: 3
66
68
  summary: Allows execution of commands from a Warbler WAR file
67
69
  test_files: []
68
-