torquebox-vfs 1.0.0.CR1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/lib/gem_hook.rb +18 -0
  2. data/lib/jboss-common-core-2.2.17.GA.jar +0 -0
  3. data/lib/jboss-logging-3.0.0.Beta4.jar +0 -0
  4. data/lib/jboss-logging-spi-2.2.0.CR1.jar +0 -0
  5. data/lib/jboss-logmanager-1.2.0.CR9.jar +0 -0
  6. data/lib/jboss-logmanager-log4j-1.0.0.CR3.jar +0 -0
  7. data/lib/jboss-vfs-3.0.0.GA.jar +0 -0
  8. data/lib/log4j-1.2.14.jar +0 -0
  9. data/lib/org.torquebox.vfs.rb +20 -0
  10. data/lib/torquebox/vfs/debug_filter.rb +37 -0
  11. data/lib/torquebox/vfs/dir.rb +78 -0
  12. data/lib/torquebox/vfs/ext/dir.rb +188 -0
  13. data/lib/torquebox/vfs/ext/file.rb +278 -0
  14. data/lib/torquebox/vfs/ext/file_test.rb +48 -0
  15. data/lib/torquebox/vfs/ext/io.rb +158 -0
  16. data/lib/torquebox/vfs/ext/jdbc.rb +65 -0
  17. data/lib/torquebox/vfs/ext/kernel.rb +30 -0
  18. data/lib/torquebox/vfs/ext/pathname.rb +31 -0
  19. data/lib/torquebox/vfs/ext/tempfile.rb +31 -0
  20. data/lib/torquebox/vfs/ext/vfs.rb +24 -0
  21. data/lib/torquebox/vfs/ext/virtual_file.rb +72 -0
  22. data/lib/torquebox/vfs/file.rb +188 -0
  23. data/lib/torquebox/vfs/glob_filter.rb +46 -0
  24. data/lib/torquebox/vfs/glob_translator.rb +204 -0
  25. data/lib/torquebox/vfs.rb +100 -0
  26. data/lib/torquebox-vfs.jar +0 -0
  27. data/lib/torquebox-vfs.rb +20 -0
  28. data/lib/vfs.rb +20 -0
  29. data/licenses/lgpl-2.1.txt +504 -0
  30. data/spec/dir_spec.rb +259 -0
  31. data/spec/file_spec.rb +451 -0
  32. data/spec/file_test_spec.rb +34 -0
  33. data/spec/io_spec.rb +82 -0
  34. data/spec/jdbc_spec.rb +68 -0
  35. data/spec/pathname_spec.rb +20 -0
  36. data/spec/spec_helper.rb +171 -0
  37. data/spec/vfs_dir_spec.rb +23 -0
  38. data/spec/vfs_spec.rb +36 -0
  39. metadata +121 -0
@@ -0,0 +1,171 @@
1
+ require 'java'
2
+
3
+ $: << File.dirname(__FILE__) + '/../lib'
4
+
5
+ require 'torquebox/vfs'
6
+
7
+ TEST_DATA_BASE = 'target/test-data'
8
+ TEST_COPY_BASE = File.join( File.dirname( TEST_DATA_BASE ), 'test-copy' )
9
+
10
+ TESTING_ON_WINDOWS = ( java.lang::System.getProperty( "os.name" ) =~ /windows/i )
11
+
12
+ module PathHelper
13
+ def self.extended(cls)
14
+ cls.class_eval do
15
+
16
+ def pwd()
17
+ self.class.pwd
18
+ end
19
+
20
+ def self.pwd()
21
+ ::Dir.pwd
22
+ end
23
+
24
+ def archive1_vfs_path()
25
+ vfs_path( @archive1_path )
26
+ end
27
+
28
+ def archive2_vfs_path()
29
+ vfs_path( @archive2_path )
30
+ end
31
+
32
+ def archive1_path()
33
+ @archive1_path
34
+ end
35
+
36
+ def archive2_path()
37
+ @archive2_path
38
+ end
39
+
40
+ def absolute_prefix
41
+ self.class.absolute_prefix
42
+ end
43
+
44
+ def self.absolute_prefix
45
+ return '' unless ( TESTING_ON_WINDOWS )
46
+ 'C:'
47
+ end
48
+
49
+ def vfs_path(path)
50
+ self.class.vfs_path( path )
51
+ end
52
+
53
+ def self.vfs_path(path)
54
+ return path if ( path[0,4] == 'vfs:' )
55
+ return "vfs:#{path}" if ( path[0,1] == '/' )
56
+ return "vfs:#{path}" if ( path[0,1] == '\\' )
57
+ return vfs_path( "/#{path}" ) if ( path =~ %r(^[a-zA-Z]:) )
58
+ return vfs_path( File.join( pwd, path ) )
59
+ end
60
+
61
+ def test_data_base_path(style)
62
+ self.class.test_data_base_path(style)
63
+ end
64
+
65
+ def self.test_data_base_path(style)
66
+ path = nil
67
+ case ( style )
68
+ when :relative
69
+ path = "./#{TEST_DATA_BASE}"
70
+ when :absolute
71
+ path = File.expand_path( File.join( File.dirname( __FILE__ ), '..', TEST_DATA_BASE ) )
72
+ when :vfs
73
+ path = vfs_path( test_data_base_path( :absolute ) )
74
+ end
75
+ if ( path =~ /^[a-z]:/ )
76
+ path = path[0,1].upcase + path[1..-1]
77
+ end
78
+ path
79
+ end
80
+
81
+ def test_copy_base_path(style)
82
+ self.class.test_copy_base_path(style)
83
+ end
84
+
85
+ def self.test_copy_base_path(style)
86
+ path = nil
87
+ case ( style )
88
+ when :relative
89
+ path = "./#{TEST_COPY_BASE}"
90
+ when :absolute
91
+ path = File.expand_path( File.join( File.dirname( __FILE__ ), '..', TEST_COPY_BASE ) )
92
+ when :vfs
93
+ path = vfs_path( test_copy_base_path( :absolute ) )
94
+ end
95
+ if ( path =~ /^[a-z]:/ )
96
+ path = path[0,1].upcase + path[1..-1]
97
+ end
98
+ path
99
+ end
100
+
101
+
102
+ end
103
+
104
+ end
105
+ end
106
+
107
+ module TestDataHelper
108
+
109
+ def self.extended(cls)
110
+
111
+ cls.extend( PathHelper )
112
+
113
+ cls.before(:each) do
114
+ @executor = java.util.concurrent::Executors.newScheduledThreadPool( 1 )
115
+ @temp_file_provider = org.jboss.vfs::TempFileProvider.create( "vfs-test", @executor )
116
+
117
+ @archive1_path = File.expand_path( "#{test_data_base_path(:absolute)}/home/larry/archive1.jar" )
118
+ @archive1_file = org.jboss.vfs::VFS.child( @archive1_path )
119
+ @archive1_mount_point = org.jboss.vfs::VFS.child( @archive1_path )
120
+ @archive1_handle = org.jboss.vfs::VFS.mountZip( @archive1_file, @archive1_mount_point, @temp_file_provider )
121
+
122
+ @archive2_path = "#{@archive1_path}/lib/archive2.jar"
123
+ @archive2_file = org.jboss.vfs::VFS.child( @archive2_path )
124
+ @archive2_mount_point = org.jboss.vfs::VFS.child( @archive2_path )
125
+ @archive2_handle = org.jboss.vfs::VFS.mountZip( @archive2_file, @archive2_mount_point, @temp_file_provider )
126
+ end
127
+
128
+ cls.after(:each) do
129
+ @archive2_handle.close
130
+ @archive1_handle.close
131
+ @temp_file_provider.close
132
+ @executor.shutdown
133
+ end
134
+
135
+ end
136
+ end
137
+
138
+ module TestDataCopyHelper
139
+
140
+ def self.extended(cls)
141
+
142
+ cls.extend( PathHelper )
143
+
144
+ cls.before(:each) do
145
+ FileUtils.rm_rf( test_copy_base_path(:absolute) )
146
+ FileUtils.cp_r( test_data_base_path(:absolute), test_copy_base_path(:absolute) )
147
+
148
+ @executor = java.util.concurrent::Executors.newScheduledThreadPool( 1 )
149
+ @temp_file_provider = org.jboss.vfs::TempFileProvider.create( "vfs-test", @executor )
150
+
151
+ @archive1_path = File.join( test_copy_base_path(:absolute), "/home/larry/archive1.jar" )
152
+ @archive1_file = org.jboss.vfs::VFS.child( @archive1_path )
153
+ @archive1_mount_point = org.jboss.vfs::VFS.child( @archive1_path )
154
+ @archive1_handle = org.jboss.vfs::VFS.mountZip( @archive1_file, @archive1_mount_point, @temp_file_provider )
155
+
156
+ @archive2_path = "#{@archive1_path}/lib/archive2.jar"
157
+ @archive2_file = org.jboss.vfs::VFS.child( @archive2_path )
158
+ @archive2_mount_point = org.jboss.vfs::VFS.child( @archive2_path )
159
+ @archive2_handle = org.jboss.vfs::VFS.mountZip( @archive2_file, @archive2_mount_point, @temp_file_provider )
160
+ end
161
+
162
+ cls.after(:each) do
163
+ @archive2_handle.close
164
+ @archive1_handle.close
165
+ @temp_file_provider.close
166
+ @executor.shutdown
167
+ FileUtils.rm_rf( test_copy_base_path(:absolute) )
168
+ end
169
+
170
+ end
171
+ end
@@ -0,0 +1,23 @@
1
+
2
+ require File.dirname(__FILE__) + '/spec_helper.rb'
3
+
4
+ describe "TorqueBox::VFS::Dir" do
5
+
6
+ extend TestDataHelper
7
+
8
+ describe "entries" do
9
+ it "should find vfs entries outside of archives" do
10
+ path = "#{archive1_path}/.."
11
+ ::Dir.new( path ).entries.should == TorqueBox::VFS::Dir.new( vfs_path(path) ).entries
12
+ end
13
+
14
+ it "should find vfs entries inside of archives" do
15
+ path = "#{archive1_vfs_path}/other_lib/subdir"
16
+ entries = TorqueBox::VFS::Dir.new( path ).entries
17
+ entries.size.should == 3
18
+ entries.should include( "." )
19
+ entries.should include( ".." )
20
+ entries.should include( "archive6.jar" )
21
+ end
22
+ end
23
+ end
data/spec/vfs_spec.rb ADDED
@@ -0,0 +1,36 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+
4
+ require 'pathname'
5
+
6
+ describe "VFS path resolution" do
7
+
8
+ extend PathHelper
9
+
10
+ describe "resolve_within_archive" do
11
+ it "should return pathnames with vfs: prefix unmodified" do
12
+ pathname = Pathname.new("vfs:/tmp/foo")
13
+ path = TorqueBox::VFS.resolve_within_archive(pathname)
14
+ path.should == pathname.to_s
15
+ end
16
+ end
17
+
18
+ describe "resolve_path_url" do
19
+ it "should prefix relative paths with the current dir" do
20
+ cwd = Dir.pwd
21
+ path = TorqueBox::VFS.resolve_path_url( "foo/bar" )
22
+ path.should match /^#{vfs_path(cwd)}\/foo\/bar$/
23
+ end
24
+
25
+ it "should not prefix absolute paths with the current dir" do
26
+ path = TorqueBox::VFS.resolve_path_url( "/foo/bar" )
27
+ path.should match /^vfs:\/foo\/bar$/
28
+ end
29
+
30
+ it "should treat paths with windows drive letters as absolute" do
31
+ path = TorqueBox::VFS.resolve_path_url( "C:/foo/bar" )
32
+ path.should match /^vfs:\/C:\/foo\/bar$/
33
+ end
34
+ end
35
+
36
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: torquebox-vfs
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: 6
5
+ version: 1.0.0.CR1
6
+ platform: java
7
+ authors: []
8
+
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-04-15 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rspec
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - "="
23
+ - !ruby/object:Gem::Version
24
+ version: 2.3.0
25
+ type: :development
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - "="
34
+ - !ruby/object:Gem::Version
35
+ version: 0.8.7
36
+ type: :development
37
+ version_requirements: *id002
38
+ description: ""
39
+ email:
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - licenses/lgpl-2.1.txt
48
+ - lib/torquebox-vfs.jar
49
+ - lib/torquebox-vfs.rb
50
+ - lib/jboss-vfs-3.0.0.GA.jar
51
+ - lib/jboss-logging-spi-2.2.0.CR1.jar
52
+ - lib/jboss-logging-3.0.0.Beta4.jar
53
+ - lib/jboss-logmanager-1.2.0.CR9.jar
54
+ - lib/jboss-logmanager-log4j-1.0.0.CR3.jar
55
+ - lib/log4j-1.2.14.jar
56
+ - lib/jboss-common-core-2.2.17.GA.jar
57
+ - lib/gem_hook.rb
58
+ - lib/org.torquebox.vfs.rb
59
+ - lib/vfs.rb
60
+ - lib/torquebox/vfs.rb
61
+ - lib/torquebox/vfs/debug_filter.rb
62
+ - lib/torquebox/vfs/dir.rb
63
+ - lib/torquebox/vfs/file.rb
64
+ - lib/torquebox/vfs/glob_filter.rb
65
+ - lib/torquebox/vfs/glob_translator.rb
66
+ - lib/torquebox/vfs/ext/dir.rb
67
+ - lib/torquebox/vfs/ext/file.rb
68
+ - lib/torquebox/vfs/ext/file_test.rb
69
+ - lib/torquebox/vfs/ext/io.rb
70
+ - lib/torquebox/vfs/ext/jdbc.rb
71
+ - lib/torquebox/vfs/ext/kernel.rb
72
+ - lib/torquebox/vfs/ext/pathname.rb
73
+ - lib/torquebox/vfs/ext/tempfile.rb
74
+ - lib/torquebox/vfs/ext/vfs.rb
75
+ - lib/torquebox/vfs/ext/virtual_file.rb
76
+ - spec/dir_spec.rb
77
+ - spec/file_spec.rb
78
+ - spec/file_test_spec.rb
79
+ - spec/io_spec.rb
80
+ - spec/jdbc_spec.rb
81
+ - spec/pathname_spec.rb
82
+ - spec/spec_helper.rb
83
+ - spec/vfs_dir_spec.rb
84
+ - spec/vfs_spec.rb
85
+ has_rdoc: true
86
+ homepage: http://www.torquebox.org/gem-parent/torquebox-vfs/
87
+ licenses:
88
+ - lgpl
89
+ post_install_message:
90
+ rdoc_options: []
91
+
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: "0"
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ">"
104
+ - !ruby/object:Gem::Version
105
+ version: 1.3.1
106
+ requirements: []
107
+
108
+ rubyforge_project:
109
+ rubygems_version: 1.5.1
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: TorqueBox VFS
113
+ test_files:
114
+ - spec/dir_spec.rb
115
+ - spec/file_spec.rb
116
+ - spec/file_test_spec.rb
117
+ - spec/io_spec.rb
118
+ - spec/jdbc_spec.rb
119
+ - spec/pathname_spec.rb
120
+ - spec/vfs_dir_spec.rb
121
+ - spec/vfs_spec.rb