jar_wrapper 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ jar_wrapper
@@ -0,0 +1 @@
1
+ ruby-1.9.3
data/CHANGES CHANGED
@@ -12,4 +12,9 @@
12
12
  == Version 0.1.7
13
13
 
14
14
  * Removing jeweler.
15
- * Bug fixes.
15
+ * Bug fixes.
16
+
17
+ == Version 0.1.8
18
+
19
+ * Bug fixes
20
+ * Adding specs
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
2
 
3
3
  require 'rbconfig'
4
4
 
@@ -6,8 +6,10 @@ def windows?
6
6
  !!(RbConfig::CONFIG['host_os'] =~ /mswin|mingw|windows/)
7
7
  end
8
8
 
9
- gem "zip"
10
- gem "rubyzip" if windows?
9
+ group :default do
10
+ gem "zip"
11
+ gem "rubyzip" if windows?
12
+ end
11
13
 
12
14
  group :development do
13
15
  gem "gemspec_deps_gen"
@@ -1,25 +1,27 @@
1
1
  GEM
2
- remote: http://rubygems.org/
2
+ remote: https://rubygems.org/
3
3
  specs:
4
- diff-lcs (1.1.3)
5
- file_utils (1.0.6)
4
+ diff-lcs (1.2.5)
5
+ file_utils (1.0.7)
6
6
  gemcutter (0.7.1)
7
- gemspec_deps_gen (1.0.5)
7
+ gemspec_deps_gen (1.1.2)
8
+ bundler
8
9
  file_utils
9
10
  metaclass (0.0.1)
10
- mocha (0.13.2)
11
+ mocha (0.14.0)
11
12
  metaclass (~> 0.0.1)
12
- rspec (2.12.0)
13
- rspec-core (~> 2.12.0)
14
- rspec-expectations (~> 2.12.0)
15
- rspec-mocks (~> 2.12.0)
16
- rspec-core (2.12.2)
17
- rspec-expectations (2.12.1)
18
- diff-lcs (~> 1.1.3)
19
- rspec-mocks (2.12.2)
13
+ rspec (2.14.1)
14
+ rspec-core (~> 2.14.0)
15
+ rspec-expectations (~> 2.14.0)
16
+ rspec-mocks (~> 2.14.0)
17
+ rspec-core (2.14.7)
18
+ rspec-expectations (2.14.4)
19
+ diff-lcs (>= 1.1.3, < 2.0)
20
+ rspec-mocks (2.14.4)
20
21
  zip (2.0.2)
21
22
 
22
23
  PLATFORMS
24
+ java
23
25
  ruby
24
26
 
25
27
  DEPENDENCIES
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Jar Wrapper -- Jar wrapper for executable java jarjava jar
1
+ # Jar Wrapper - wrapper for executable java jar files
2
2
 
3
3
  ## Installing Jar Wrapper
4
4
 
@@ -6,25 +6,26 @@
6
6
 
7
7
  ## Usage
8
8
 
9
+ ```ruby
9
10
  require 'jar_wrapper'
10
11
 
11
12
  wrapper = JarWrapper::Runner.new
12
13
  wrapper.java_opts = ["-Xmx1024m", "-Xss1024k" ]
13
14
 
14
- 1. install jar file from source URL into target file:
15
+ # install jar file from source URL into target file:
15
16
 
16
17
  wrapper.install source, target
17
18
 
18
- 2. execute jar file (java -jar jar_file):
19
+ # execute jar file (java -jar jar_file.jar):
19
20
 
20
- wrapper.jar_file = jar_file
21
- wrapper.run ARGV
21
+ wrapper.jar_file = "jar_file.jar"
22
+ wrapper.run
22
23
 
23
- 3. execute main class (java -cp ... main_class):
24
-
25
- wrapper.classpath = some_class_path
26
- wrapper.main_class = main_class
27
- wrapper.run ARGV
24
+ # execute main class (java -cp some_class_path main_class):
28
25
 
26
+ wrapper.classpath = "some_class_path"
27
+ wrapper.main_class = "main_class"
28
+ wrapper.run
29
+ ```
29
30
 
30
31
 
data/Rakefile CHANGED
@@ -6,20 +6,16 @@ require "rspec/core/rake_task"
6
6
  require "jar_wrapper/version"
7
7
  require "gemspec_deps_gen/gemspec_deps_gen"
8
8
 
9
- def version
10
- JarWrapper::VERSION
11
- end
12
-
13
- def project_name
14
- File.basename(Dir.pwd)
15
- end
9
+ version = JarWrapper::VERSION
10
+ project_name = File.basename(Dir.pwd)
16
11
 
17
- task :build do
18
- system "rm #{project_name}.gemspec"
12
+ task :gen do
19
13
  generator = GemspecDepsGen.new
20
14
 
21
- generator.generate_dependencies "#{project_name}.gemspec.erb", "#{project_name}.gemspec"
15
+ generator.generate_dependencies "spec", "#{project_name}.gemspec.erb", "#{project_name}.gemspec"
16
+ end
22
17
 
18
+ task :build => :gen do
23
19
  system "gem build #{project_name}.gemspec"
24
20
  end
25
21
 
@@ -27,6 +23,10 @@ task :install do
27
23
  system "gem install #{project_name}-#{version}.gem"
28
24
  end
29
25
 
26
+ task :uninstall do
27
+ system "gem uninstall #{project_name}"
28
+ end
29
+
30
30
  task :release => :build do
31
31
  system "gem push #{project_name}-#{version}.gem"
32
32
  end
@@ -4,8 +4,8 @@ require File.expand_path(File.dirname(__FILE__) + '/lib/jar_wrapper/version')
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "jar_wrapper"
7
- spec.summary = %q{Jar wrapper for executable java jar.}
8
- spec.description = %q{Jar wrapper for executable java jar.}
7
+ spec.summary = %q{Wrapper for executable java jar file (summary).}
8
+ spec.description = %q{Wrapper for executable java jar file.}
9
9
  spec.email = "alexander.shvets@gmail.com"
10
10
  spec.authors = ["Alexander Shvets"]
11
11
  spec.homepage = "http://github.com/shvets/jar_wrapper"
@@ -15,8 +15,9 @@ Gem::Specification.new do |spec|
15
15
  spec.require_paths = ["lib"]
16
16
  spec.version = JarWrapper::VERSION
17
17
 
18
+
18
19
  spec.add_runtime_dependency "zip", [">= 0"]
19
20
  spec.add_development_dependency "gemspec_deps_gen", [">= 0"]
20
21
  spec.add_development_dependency "gemcutter", [">= 0"]
21
-
22
+
22
23
  end
@@ -4,8 +4,8 @@ require File.expand_path(File.dirname(__FILE__) + '/lib/jar_wrapper/version')
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "jar_wrapper"
7
- spec.summary = %q{Jar wrapper for executable java jar.}
8
- spec.description = %q{Jar wrapper for executable java jar.}
7
+ spec.summary = %q{Wrapper for executable java jar file (summary).}
8
+ spec.description = %q{Wrapper for executable java jar file.}
9
9
  spec.email = "alexander.shvets@gmail.com"
10
10
  spec.authors = ["Alexander Shvets"]
11
11
  spec.homepage = "http://github.com/shvets/jar_wrapper"
@@ -15,5 +15,5 @@ Gem::Specification.new do |spec|
15
15
  spec.require_paths = ["lib"]
16
16
  spec.version = JarWrapper::VERSION
17
17
 
18
- <%= include_dependencies %>
18
+ <%= project_dependencies %>
19
19
  end
@@ -1,18 +1 @@
1
- require 'rubygems' unless Object.const_defined?(:Gem)
2
-
3
- $:.unshift(File.dirname(__FILE__)) unless
4
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
5
-
6
- require 'fileutils'
7
- require 'net/http'
8
-
9
1
  require 'jar_wrapper/runner'
10
-
11
- require 'rbconfig'
12
-
13
- def windows?
14
- !!(RbConfig::CONFIG['host_os'] =~ /mswin|mingw|windows/)
15
- end
16
-
17
- windows? ? (require "zip/zipfilesystem") : (require 'zip/zip')
18
-
@@ -1,4 +1,6 @@
1
+ require 'fileutils'
1
2
  require 'open-uri'
3
+ require 'rbconfig'
2
4
 
3
5
  # some code is extracted from redcar project (https://github.com/redcar/redcar) which is in turn extracted
4
6
  # from ruby-processing gem (https://github.com/jashkenas/ruby-processing).
@@ -7,6 +9,10 @@ module JarWrapper
7
9
  class Runner
8
10
  attr_accessor :main_class, :classpath, :jar_file, :java_opts
9
11
 
12
+ def initialize
13
+ windows? ? (require "zip/zipfilesystem") : (require 'zip/zip')
14
+ end
15
+
10
16
  def install source, destination
11
17
  download_file_to(source, destination)
12
18
 
@@ -21,12 +27,16 @@ module JarWrapper
21
27
 
22
28
  private
23
29
 
30
+ def windows?
31
+ !!(RbConfig::CONFIG['host_os'] =~ /mswin|mingw|windows/)
32
+ end
33
+
24
34
  def construct_command(args="")
25
35
  command = ["java"]
26
36
  command.push(*java_args)
27
37
  # command.push("-Xbootclasspath/a:#{jruby_complete}")
28
38
  # command.push("-Dfile.encoding=UTF8", "-Xmx320m", "-Xss1024k", "-Djruby.memory.max=320m", "-Djruby.stack.max=1024k", "org.jruby.Main")
29
- command.push(*java_opts) if not (java_opts.nil? or java_opts.length == 0)
39
+ command.push(*java_opts) unless java_opts.nil? or java_opts.length == 0
30
40
 
31
41
  command.push("-jar", jar_file) if jar_file
32
42
  command.push("-cp", classpath, main_class) if main_class
@@ -91,6 +101,8 @@ module JarWrapper
91
101
  :windows
92
102
  when /linux/
93
103
  :linux
104
+ else
105
+ # type code here
94
106
  end
95
107
  end
96
108
 
@@ -113,7 +125,7 @@ module JarWrapper
113
125
  open(uri) do |in_file|
114
126
  done = false
115
127
 
116
- while (!done) do
128
+ until done do
117
129
  buffer = in_file.read(1024*1000)
118
130
  out_file.write(buffer)
119
131
 
@@ -148,6 +160,7 @@ module JarWrapper
148
160
  begin
149
161
  entry.extract
150
162
  rescue Zip::ZipDestinationFileExistsError
163
+ # ignored
151
164
  end
152
165
  end
153
166
  end
@@ -1,3 +1,3 @@
1
1
  module JarWrapper
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -0,0 +1,38 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ require 'jar_wrapper/runner'
4
+
5
+ describe JarWrapper::Runner do
6
+ describe "#build" do
7
+ before do
8
+ subject.java_opts = ["-Xmx1024m", "-Xss1024k" ]
9
+ end
10
+
11
+ it "should install jar file from URL" do
12
+ source = "http://selenium.googlecode.com/files/selenium-server-standalone-2.37.0.jar"
13
+ target = "selenium-server-standalone-2.37.0.jar"
14
+
15
+ subject.stub(:download_file_to)
16
+ subject.stub(:unzip_file)
17
+
18
+ subject.install source, target
19
+ end
20
+
21
+ it "should execute java jar file" do
22
+ subject.jar_file = "selenium-server-standalone.jar"
23
+
24
+ subject.stub(:exec).with "java -XstartOnFirstThread -d32 -client -Xmx1024m -Xss1024k -jar selenium-server-standalone.jar #{`pwd`.chomp!}/spec/runner_spec.rb"
25
+
26
+ subject.run ARGV
27
+ end
28
+
29
+ it "should execute java main class" do
30
+ subject.classpath = "some_class_path"
31
+ subject.main_class = "main_class"
32
+
33
+ subject.stub(:exec).with "java -XstartOnFirstThread -d32 -client -Xmx1024m -Xss1024k -cp some_class_path main_class #{`pwd`.chomp!}/spec/runner_spec.rb"
34
+
35
+ subject.run ARGV
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,2 @@
1
+ $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
2
+
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jar_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
5
- prerelease:
4
+ version: 0.1.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alexander Shvets
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-12 00:00:00.000000000 Z
11
+ date: 2013-11-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: zip
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: gemspec_deps_gen
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: gemcutter
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,12 +48,11 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
- description: Jar wrapper for executable java jar.
55
+ description: Wrapper for executable java jar file.
63
56
  email: alexander.shvets@gmail.com
64
57
  executables: []
65
58
  extensions: []
@@ -75,7 +68,8 @@ files:
75
68
  - .idea/scopes/scope_settings.xml
76
69
  - .idea/vcs.xml
77
70
  - .idea/workspace.xml
78
- - .rvmrc
71
+ - .ruby-gemset
72
+ - .ruby-version
79
73
  - CHANGES
80
74
  - Gemfile
81
75
  - Gemfile.lock
@@ -87,28 +81,31 @@ files:
87
81
  - lib/jar_wrapper.rb
88
82
  - lib/jar_wrapper/runner.rb
89
83
  - lib/jar_wrapper/version.rb
84
+ - spec/runner_spec.rb
85
+ - spec/spec_helper.rb
90
86
  homepage: http://github.com/shvets/jar_wrapper
91
87
  licenses: []
88
+ metadata: {}
92
89
  post_install_message:
93
90
  rdoc_options: []
94
91
  require_paths:
95
92
  - lib
96
93
  required_ruby_version: !ruby/object:Gem::Requirement
97
- none: false
98
94
  requirements:
99
95
  - - ! '>='
100
96
  - !ruby/object:Gem::Version
101
97
  version: '0'
102
98
  required_rubygems_version: !ruby/object:Gem::Requirement
103
- none: false
104
99
  requirements:
105
100
  - - ! '>='
106
101
  - !ruby/object:Gem::Version
107
102
  version: '0'
108
103
  requirements: []
109
104
  rubyforge_project:
110
- rubygems_version: 1.8.25
105
+ rubygems_version: 2.0.7
111
106
  signing_key:
112
- specification_version: 3
113
- summary: Jar wrapper for executable java jar.
114
- test_files: []
107
+ specification_version: 4
108
+ summary: Wrapper for executable java jar file (summary).
109
+ test_files:
110
+ - spec/runner_spec.rb
111
+ - spec/spec_helper.rb
data/.rvmrc DELETED
@@ -1,6 +0,0 @@
1
- rvm_project_rvmrc=1
2
- rvm_trust_rvmrcs_flag=1
3
- rvm_gemset_create_on_use_flag=1
4
- rvm_pretty_print_flag=1
5
-
6
- rvm use 1.9.3@jar_wrapper