torquebox-vfs 1.0.1-java → 1.1-java

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -1,6 +1,6 @@
1
1
  module TorqueboxVfs
2
- VERSION = '1.0.1'
3
- MAVEN_VERSION = '1.0.1'
2
+ VERSION = '1.1'
3
+ MAVEN_VERSION = '1.1'
4
4
  end
5
5
  begin
6
6
  require 'java'
@@ -41,17 +41,17 @@ module TorqueBox
41
41
  path = path.to_s
42
42
  return path if ( path =~ %r(^vfs:) )
43
43
  cur = path
44
+ trim_size = cur.length
44
45
  while ( cur != '.' && cur != '/' )
45
46
  if ( ::File.exist_without_vfs?( cur ) )
46
-
47
- child_path = path[cur.length..-1]
48
-
47
+ child_path = path[trim_size..-1]
49
48
  if ( cur[-1,1] == '/' )
50
49
  cur = cur[0..-2]
51
50
  end
52
51
  return TorqueBox::VFS.resolve_path_url( cur ), child_path
53
52
  end
54
53
  cur = ::File.dirname( cur )
54
+ trim_size = cur.length
55
55
  cur << '/' unless cur[-1,1] == '/'
56
56
  end
57
57
  nil
@@ -116,9 +116,6 @@ class Dir
116
116
  private
117
117
 
118
118
  def glob_one(pattern, flags=0, &block)
119
-
120
- is_absolute_vfs = false
121
-
122
119
  #str_pattern = "#{pattern}"
123
120
  str_pattern = pattern.to_str
124
121
 
@@ -135,23 +132,15 @@ class Dir
135
132
  base = base_segments.join( '/' )
136
133
 
137
134
  base.gsub!( /\\(.)/, '\1' )
138
-
139
- #if ( base.empty? || ( ::File.exist_without_vfs?( base ) && ! Java::OrgJbossVirtualPluginsContextJar::JarUtils.isArchive( base ) ) )
140
- #if ( base.empty? || ( ::File.exist_without_vfs?( base ) ) )
141
- #puts "doing FS glob"
142
- #paths = glob_before_vfs( str_pattern, flags, &block )
143
- #return paths
144
- #end
145
-
146
135
  #puts "base= #{base}"
147
-
136
+
148
137
  vfs_url, child_path = TorqueBox::VFS.resolve_within_archive( base )
149
138
  #puts "vfs_url=#{vfs_url}"
150
139
  #puts "child_path=#{child_path}"
151
140
 
152
141
  return [] if vfs_url.nil?
153
142
  #puts "segments.size==base_segments.size? #{segments.size == base_segments.size}"
154
- return [ base ] if segments.size == base_segments.size
143
+ return [ base ] if segments.size == base_segments.size && File.exists?( base )
155
144
 
156
145
  matcher_segments = segments - base_segments
157
146
  matcher = matcher_segments.join( '/' )
@@ -79,6 +79,11 @@ describe "Dir extensions for VFS" do
79
79
  items.should include( "#{prefix}/dotfiles/.four" )
80
80
  end
81
81
 
82
+ it "should not find non-existent files" do
83
+ items = Dir.glob( "#{prefix}/home/larry/not-there.txt" )
84
+ items.should be_empty
85
+ end
86
+
82
87
  it "should allow globbing without any special globbing characters on normal files" do
83
88
  items = Dir.glob( "#{prefix}/home/larry" )
84
89
  items.should_not be_empty
@@ -20,6 +20,10 @@ describe "File extensions for VFS" do
20
20
  File.exists?(vfs_path("/nothingtoseehere")).should be_false
21
21
  end
22
22
 
23
+ it "should not report a file is there when it's not" do
24
+ File.exists?(".rspec").should be_false
25
+ end
26
+
23
27
  describe "expand_path" do
24
28
  it "should handle relative non-vfs path" do
25
29
  File.expand_path("../foo", "/tmp/bar").should == "#{absolute_prefix}/tmp/foo"
metadata CHANGED
@@ -2,15 +2,15 @@
2
2
  name: torquebox-vfs
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.1
5
+ version: "1.1"
6
6
  platform: java
7
- authors: []
7
+ authors: ["The TorqueBox Team"]
8
8
 
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-25 00:00:00 -04:00
13
+ date: 2011-07-13 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency