RAliasFile 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/FILES +3 -3
- data/ext/raliasfile.c +63 -44
- data/raliasfile.gemspec +5 -4
- data/sample/make_alias.scpt +0 -0
- data/sample/sample_raliasfile.rb +40 -13
- data/test/make_alias.scpt +0 -0
- data/test/test_raliasfile.rb +31 -17
- metadata +7 -7
data/FILES
CHANGED
data/ext/raliasfile.c
CHANGED
@@ -13,14 +13,14 @@
|
|
13
13
|
* Typical use from Ruby :
|
14
14
|
* raf=RAliasFile.new("/absolute/path/to/alias/file")
|
15
15
|
*
|
16
|
-
* raf.alias_path
|
17
|
-
* raf.path_exists?
|
18
|
-
* raf.is_alias_file?
|
19
|
-
* raf.is_alias_broken?
|
20
|
-
* raf.resolved_path
|
21
|
-
* raf.was_aliased?
|
22
|
-
* raf.is_folder_alias?
|
23
|
-
* raf.is_file_alias?
|
16
|
+
* raf.alias_path # => returns the given input alias path
|
17
|
+
* raf.path_exists? # => returns true if the alias path does exists on the file system, false otherwise
|
18
|
+
* raf.is_alias_file? # => returns true if the alias is truly an alias file one, false otherwise
|
19
|
+
* raf.is_alias_broken? # => returns true if alias is broken, false otherwise
|
20
|
+
* raf.resolved_path # => returns the path of the alias target
|
21
|
+
* raf.was_aliased? # => returns true if the alias is a correct alias file, false otherwise
|
22
|
+
* raf.is_folder_alias? # => returns true if the target of the alias is a folder, false otherwise
|
23
|
+
* raf.is_file_alias? # => returns true if the target of the alias is a file, false otherwise
|
24
24
|
*/
|
25
25
|
|
26
26
|
#include <CoreFoundation/CoreFoundation.h>
|
@@ -31,11 +31,17 @@
|
|
31
31
|
VALUE cRAliasFile;
|
32
32
|
|
33
33
|
/*
|
34
|
-
*
|
35
|
-
* Initialize all internal variables
|
34
|
+
* Initialize all internal variables
|
36
35
|
*/
|
37
|
-
VALUE m_raliasfile_init(VALUE
|
36
|
+
VALUE m_raliasfile_init(int argc, VALUE* argv, VALUE self)
|
38
37
|
{
|
38
|
+
VALUE alias_path, resolve_alias_chains;
|
39
|
+
Boolean resolveAliasChains;
|
40
|
+
resolveAliasChains = true;
|
41
|
+
rb_scan_args(argc, argv, "11", &alias_path, &resolve_alias_chains);
|
42
|
+
if (argc == 1) resolve_alias_chains=Qtrue;
|
43
|
+
if ((argc == 2) && (resolve_alias_chains == 0)) resolveAliasChains = false;
|
44
|
+
|
39
45
|
char resolved_path[512] = "";
|
40
46
|
VALUE is_alias_file=Qfalse;
|
41
47
|
VALUE path_exists=Qfalse;
|
@@ -58,7 +64,8 @@ VALUE m_raliasfile_init(VALUE self, VALUE alias_path)
|
|
58
64
|
if(aliasFileFlag) {
|
59
65
|
is_alias_file=Qtrue;
|
60
66
|
}
|
61
|
-
|
67
|
+
|
68
|
+
FSResolveAliasFile(&theRef, resolveAliasChains, &targetIsFolder, &wasAliased);
|
62
69
|
CFURLRef resolvedUrl = CFURLCreateFromFSRef(NULL, &theRef);
|
63
70
|
if (resolvedUrl != NULL) {
|
64
71
|
CFStringRef theResolvedAliasPath = CFURLCopyFileSystemPath(resolvedUrl, kCFURLPOSIXPathStyle);
|
@@ -86,6 +93,7 @@ VALUE m_raliasfile_init(VALUE self, VALUE alias_path)
|
|
86
93
|
rb_iv_set(self, "@path_exists", path_exists);
|
87
94
|
rb_iv_set(self, "@is_alias_file", is_alias_file);
|
88
95
|
rb_iv_set(self, "@is_alias_broken", broken);
|
96
|
+
rb_iv_set(self, "@is_resolve_alias_chains", resolve_alias_chains);
|
89
97
|
rb_iv_set(self, "@was_aliased", was_aliased);
|
90
98
|
rb_iv_set(self, "@resolved_path", rb_str_new2(resolved_path));
|
91
99
|
rb_iv_set(self, "@folder", folder);
|
@@ -96,83 +104,92 @@ VALUE m_raliasfile_init(VALUE self, VALUE alias_path)
|
|
96
104
|
}
|
97
105
|
|
98
106
|
/*
|
99
|
-
*
|
100
|
-
* set alias path to _alias_path
|
107
|
+
* Sets alias path to alias_path
|
101
108
|
*/
|
102
109
|
VALUE m_set_alias_path(VALUE self, VALUE alias_path) {
|
103
110
|
rb_iv_set(self, "@alias_path", alias_path);
|
104
111
|
}
|
105
112
|
|
106
113
|
/*
|
107
|
-
*
|
108
|
-
* returns true if the path given for the alias file is on the file system, false otherwise
|
114
|
+
* returns true if the path given for the alias file is on the file system, false otherwise
|
109
115
|
*/
|
110
116
|
VALUE m_path_exists(VALUE self) {
|
111
117
|
return rb_iv_get(self, "@path_exists");
|
112
118
|
}
|
113
119
|
|
114
120
|
/*
|
115
|
-
*
|
116
|
-
* returns the input path given for the alias file
|
121
|
+
* returns the input path given for the alias file
|
117
122
|
*/
|
118
123
|
VALUE m_alias_path(VALUE self) {
|
119
124
|
return rb_iv_get(self, "@alias_path");
|
120
125
|
}
|
121
126
|
|
122
127
|
/*
|
123
|
-
*
|
124
|
-
* returns true if the alias file is truly an alias file, false otherwise
|
128
|
+
* returns true if the alias file is truly an alias file, false otherwise
|
125
129
|
*/
|
126
130
|
VALUE m_alias_file(VALUE self) {
|
127
131
|
return rb_iv_get(self, "@is_alias_file");
|
128
132
|
}
|
129
133
|
|
130
134
|
/*
|
131
|
-
*
|
132
|
-
* returns true if the alias file is broken (dead target), false otherwise
|
135
|
+
* returns true if the alias file is broken (dead target), false otherwise
|
133
136
|
*/
|
134
137
|
VALUE m_alias_broken(VALUE self) {
|
135
138
|
return rb_iv_get(self, "@is_alias_broken");
|
136
139
|
}
|
137
140
|
|
138
141
|
/*
|
139
|
-
*
|
140
|
-
|
142
|
+
* returns true by default or return the value passed as "resolve_alias_chains" arg
|
143
|
+
*/
|
144
|
+
VALUE m_resolve_alias_chains(VALUE self) {
|
145
|
+
return rb_iv_get(self, "@is_resolve_alias_chains");
|
146
|
+
}
|
147
|
+
|
148
|
+
/*
|
149
|
+
* Sets resolve_alias_chains to the given parameter.
|
150
|
+
* NOTICE :
|
151
|
+
* - this parameter is set to true by default when using :
|
152
|
+
* -- raf=RAliasFile.new(mypath)
|
153
|
+
* - this parameter is set to the given parameter "resolve_alias_chains" when using :
|
154
|
+
* -- raf=RAliasFile.new(mypath, resolve_alias_chains)
|
155
|
+
*/
|
156
|
+
VALUE m_set_resolve_alias_chains(VALUE self) {
|
157
|
+
return rb_iv_get(self, "@is_resolve_alias_chains");
|
158
|
+
}
|
159
|
+
|
160
|
+
/*
|
161
|
+
* returns the path of the alias target
|
141
162
|
*/
|
142
163
|
VALUE m_resolved_path(VALUE self) {
|
143
164
|
return rb_iv_get(self, "@resolved_path");
|
144
165
|
}
|
145
166
|
|
146
167
|
/*
|
147
|
-
*
|
148
|
-
* returns true if the alias file was aliased, false otherwise
|
168
|
+
* returns true if the alias file was aliased, false otherwise
|
149
169
|
*/
|
150
170
|
VALUE m_was_aliased(VALUE self) {
|
151
171
|
return rb_iv_get(self, "@was_aliased");
|
152
172
|
}
|
153
173
|
|
154
174
|
/*
|
155
|
-
*
|
156
|
-
* returns true if the alias file points to a folder target, false otherwise
|
175
|
+
* returns true if the alias file points to a folder target, false otherwise
|
157
176
|
*/
|
158
177
|
VALUE m_is_folder(VALUE self) {
|
159
178
|
return rb_iv_get(self, "@folder");
|
160
179
|
}
|
161
180
|
|
162
181
|
/*
|
163
|
-
*
|
164
|
-
* returns true if the alias file points to a file target, false otherwise
|
182
|
+
* returns true if the alias file points to a file target, false otherwise
|
165
183
|
*/
|
166
184
|
VALUE m_is_file(VALUE self) {
|
167
185
|
return rb_iv_get(self, "@data_file");
|
168
186
|
}
|
169
187
|
|
170
188
|
/*
|
171
|
-
*
|
172
|
-
* returns the version of this class
|
189
|
+
* returns the version of this class
|
173
190
|
*/
|
174
191
|
VALUE m_version(VALUE self) {
|
175
|
-
char *version = "0.0
|
192
|
+
char *version = "0.1.0";
|
176
193
|
return rb_str_new2(version);
|
177
194
|
}
|
178
195
|
|
@@ -182,15 +199,17 @@ VALUE m_version(VALUE self) {
|
|
182
199
|
*/
|
183
200
|
void Init_raliasfile() {
|
184
201
|
cRAliasFile = rb_define_class("RAliasFile", rb_cObject);
|
185
|
-
rb_define_method(cRAliasFile, "initialize",
|
186
|
-
rb_define_method(cRAliasFile, "path_exists?",
|
187
|
-
rb_define_method(cRAliasFile, "is_alias_file?",
|
188
|
-
rb_define_method(cRAliasFile, "is_alias_broken?",
|
189
|
-
rb_define_method(cRAliasFile, "
|
190
|
-
rb_define_method(cRAliasFile, "
|
191
|
-
rb_define_method(cRAliasFile, "
|
192
|
-
rb_define_method(cRAliasFile, "
|
193
|
-
rb_define_method(cRAliasFile, "
|
194
|
-
rb_define_method(cRAliasFile, "
|
195
|
-
|
202
|
+
rb_define_method(cRAliasFile, "initialize", m_raliasfile_init, -1);
|
203
|
+
rb_define_method(cRAliasFile, "path_exists?", m_path_exists, 0);
|
204
|
+
rb_define_method(cRAliasFile, "is_alias_file?", m_alias_file, 0);
|
205
|
+
rb_define_method(cRAliasFile, "is_alias_broken?", m_alias_broken, 0);
|
206
|
+
rb_define_method(cRAliasFile, "is_resolve_alias_chains?", m_resolve_alias_chains, 0);
|
207
|
+
rb_define_method(cRAliasFile, "resolve_alias_chains=", m_set_resolve_alias_chains, 0);
|
208
|
+
rb_define_method(cRAliasFile, "alias_path=", m_set_alias_path, 1);
|
209
|
+
rb_define_method(cRAliasFile, "alias_path", m_alias_path, 0);
|
210
|
+
rb_define_method(cRAliasFile, "resolved_path", m_resolved_path, 0);
|
211
|
+
rb_define_method(cRAliasFile, "was_aliased?", m_was_aliased, 0);
|
212
|
+
rb_define_method(cRAliasFile, "is_folder_alias?", m_is_folder, 0);
|
213
|
+
rb_define_method(cRAliasFile, "is_file_alias?", m_is_file, 0);
|
214
|
+
rb_define_singleton_method(cRAliasFile, "version", m_version, 0);
|
196
215
|
}
|
data/raliasfile.gemspec
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
#
|
2
3
|
# raliasfile.gemspec
|
3
4
|
#
|
@@ -6,15 +7,15 @@ require 'rubygems'
|
|
6
7
|
|
7
8
|
spec = Gem::Specification.new do |s|
|
8
9
|
s.name = 'RAliasFile'
|
9
|
-
s.version = "0.0
|
10
|
+
s.version = "0.1.0"
|
10
11
|
# s.platform = Gem::Platform::RUBY::OSX
|
11
12
|
# s.platform = Gem::Platform::OSX
|
12
|
-
s.summary = "C ext to Ruby aimed to resolve alias file on Mac OS X 10
|
13
|
+
s.summary = "C ext to Ruby aimed to resolve alias file on Mac OS X 10.+"
|
13
14
|
s.requirements << 'MacOS X 10.+'
|
14
|
-
s.files = File.read(
|
15
|
+
s.files = File.read('FILES').split( $/)
|
15
16
|
s.test_files = Dir.glob('test/test_*.rb') + Dir.glob('test/*.scpt')
|
16
17
|
s.extensions << 'ext/extconf.rb'
|
17
|
-
s.has_rdoc =
|
18
|
+
s.has_rdoc = true
|
18
19
|
s.author = "Yvon Thoraval"
|
19
20
|
s.email = "yvon_thoraval@mac.com"
|
20
21
|
s.rubyforge_project = "RAliasFile"
|
data/sample/make_alias.scpt
CHANGED
Binary file
|
data/sample/sample_raliasfile.rb
CHANGED
@@ -5,18 +5,39 @@
|
|
5
5
|
|
6
6
|
require 'raliasfile'
|
7
7
|
|
8
|
+
=begin
|
9
|
+
HOW TO create an alias of alias :
|
10
|
+
from Patrick Stadelmann <Patrick.Stadelmann-98E312.09302204092006@individual.net>
|
11
|
+
Create a file "test" (e.g. with the "touch" command). Create an alias
|
12
|
+
"test alias" pointing to "test" then delete "test". Create an alias to
|
13
|
+
"my file alias" pointing to "my file". Rename "my file alias" to "test".
|
14
|
+
|
15
|
+
You now have "test alias" pointing to "test", which is an alias pointing
|
16
|
+
to "my file". Indeed, if you delete "test" then "test alias" cannot be
|
17
|
+
resolved anymore".
|
18
|
+
=end
|
19
|
+
|
8
20
|
DESKTOP=ENV['HOME']+"/Desktop"
|
9
21
|
TEST_DIR="#{DESKTOP}/raliasfile_tests"
|
10
|
-
ORG_DIR="#{TEST_DIR}/
|
11
|
-
BRK_DIR="#{TEST_DIR}/
|
12
|
-
ALS_DIR="#{TEST_DIR}/alias"
|
22
|
+
ORG_DIR="#{TEST_DIR}/orig"
|
23
|
+
BRK_DIR="#{TEST_DIR}/orig/broken"
|
13
24
|
|
14
25
|
if(!FileTest.exists?("#{ORG_DIR}/good.txt"))
|
26
|
+
|
27
|
+
# build folders and files
|
15
28
|
`mkdir -p "#{BRK_DIR}/broken"`
|
16
29
|
`touch "#{BRK_DIR}/broken.txt"`
|
17
30
|
|
18
31
|
`mkdir -p "#{ORG_DIR}/good"`
|
19
32
|
`touch "#{ORG_DIR}/good.txt"`
|
33
|
+
`touch "#{ORG_DIR}/good/target"`
|
34
|
+
|
35
|
+
# build "true" alias of alias using Finder
|
36
|
+
`touch "#{ORG_DIR}/alias_chains_test"`
|
37
|
+
`osascript make_alias.scpt "#{ORG_DIR}/alias_chains_test" "alias_of_alias" "#{TEST_DIR}"`
|
38
|
+
`rm -f "#{ORG_DIR}/alias_chains_test"`
|
39
|
+
`touch "#{ORG_DIR}/a_target_file"`
|
40
|
+
`osascript make_alias.scpt "#{ORG_DIR}/a_target_file" "alias_chains_test" "#{ORG_DIR}"`
|
20
41
|
|
21
42
|
# build array of "true" aliases
|
22
43
|
to_alias=[]
|
@@ -26,7 +47,7 @@ if(!FileTest.exists?("#{ORG_DIR}/good.txt"))
|
|
26
47
|
to_alias << "#{ORG_DIR}/good.txt"
|
27
48
|
|
28
49
|
# build "true" aliases using Finder
|
29
|
-
to_alias.each {|a| `osascript make_alias.scpt "#{a}" "#{File.basename(a)}" "#{
|
50
|
+
to_alias.each {|a| `osascript make_alias.scpt "#{a}" "#{File.basename(a)}" "#{TEST_DIR}"`}
|
30
51
|
|
31
52
|
# remove "broken" dir to simulate broken aliases
|
32
53
|
`rm -rf "#{BRK_DIR}"`
|
@@ -34,31 +55,37 @@ if(!FileTest.exists?("#{ORG_DIR}/good.txt"))
|
|
34
55
|
end
|
35
56
|
|
36
57
|
# array of sample pathes
|
37
|
-
aliases=[["#{
|
38
|
-
["#{
|
39
|
-
["#{
|
40
|
-
["#{
|
41
|
-
["#{
|
42
|
-
["#{
|
43
|
-
["#{
|
44
|
-
["#{
|
58
|
+
aliases=[["#{TEST_DIR}/good" , "path to alias file (from target folder)"],
|
59
|
+
["#{TEST_DIR}/good.txt" , "path to alias file (from target file)"],
|
60
|
+
["#{TEST_DIR}/alias_of_alias" , "path to alias file (from target alias file) resolve_alias_chains=true (by default)"],
|
61
|
+
["#{TEST_DIR}/alias_of_alias" , "path to alias file (from target alias file) resolve_alias_chains=false"],
|
62
|
+
["#{TEST_DIR}/broken" , "path to *broken* alias file (from target folder)"],
|
63
|
+
["#{TEST_DIR}/broken.txt" , "path to *broken* alias file (from target file)"],
|
64
|
+
["#{ORG_DIR}/good" , "path to *wrong* alias file being a folder"],
|
65
|
+
["#{ORG_DIR}/good.txt" , "path to *wrong* alias file being a file"],
|
66
|
+
["#{TEST_DIR}/bid/good" , "path to *wrong* alias file being a *non-existing* folder"],
|
67
|
+
["#{TEST_DIR}/bid/good.txt" , "path to *wrong* alias file being a *non-existing* file"]
|
45
68
|
]
|
46
69
|
|
47
70
|
# "resolve" every sample pathes exploring all the methods
|
48
71
|
puts "RAliasFile.version="+RAliasFile.version.to_s
|
72
|
+
i=0
|
49
73
|
aliases.each {|as|
|
50
74
|
al,txt=as[0],as[1]
|
51
75
|
puts "\n"
|
52
76
|
puts "#{txt} : #{al}"
|
53
|
-
a=RAliasFile.new(al)
|
77
|
+
a=RAliasFile.new(al) if (i != 3)
|
78
|
+
a=RAliasFile.new(al, false) if (i == 3)
|
54
79
|
puts "a.alias_path="+a.alias_path
|
55
80
|
puts "a.path_exists?="+a.path_exists?.to_s
|
56
81
|
puts "a.is_alias_file?="+a.is_alias_file?.to_s
|
57
82
|
puts "a.is_alias_broken?="+a.is_alias_broken?.to_s
|
83
|
+
puts "a.is_resolve_alias_chains?="+a.is_resolve_alias_chains?.to_s
|
58
84
|
puts "a.resolved_path="+a.resolved_path
|
59
85
|
puts "a.was_aliased?="+a.was_aliased?.to_s
|
60
86
|
puts "a.is_folder_alias?="+a.is_folder_alias?.to_s
|
61
87
|
puts "a.is_file_alias?="+a.is_file_alias?.to_s
|
88
|
+
i+=1
|
62
89
|
}
|
63
90
|
|
64
91
|
# uncomment following line if you won't leave anything on your Desktop
|
data/test/make_alias.scpt
CHANGED
Binary file
|
data/test/test_raliasfile.rb
CHANGED
@@ -4,16 +4,15 @@
|
|
4
4
|
#
|
5
5
|
|
6
6
|
require 'rubyunit'
|
7
|
-
require
|
7
|
+
require "raliasfile"
|
8
8
|
|
9
9
|
class RAliasFileTest < RUNIT::TestCase
|
10
10
|
|
11
11
|
def setup
|
12
12
|
# setup used dirs
|
13
13
|
@test_dir="/private/tmp/raliasfile_tests"
|
14
|
-
@org_dir="#{@test_dir}/
|
15
|
-
@brk_dir="#{@test_dir}/
|
16
|
-
@als_dir="#{@test_dir}/alias"
|
14
|
+
@org_dir="#{@test_dir}/orig"
|
15
|
+
@brk_dir="#{@test_dir}/orig/broken"
|
17
16
|
|
18
17
|
# buid folder ans files to alias
|
19
18
|
`mkdir -p "#{@brk_dir}/broken"`
|
@@ -21,6 +20,13 @@ class RAliasFileTest < RUNIT::TestCase
|
|
21
20
|
`mkdir -p "#{@org_dir}/good"`
|
22
21
|
`touch "#{@org_dir}/good.txt"`
|
23
22
|
|
23
|
+
# build "true" alias of alias using Finder
|
24
|
+
`touch "#{@org_dir}/alias_chains_test"`
|
25
|
+
`osascript make_alias.scpt "#{@org_dir}/alias_chains_test" "alias_of_alias" "#{@test_dir}"`
|
26
|
+
`rm -f "#{@org_dir}/alias_chains_test"`
|
27
|
+
`touch "#{@org_dir}/a_target_file"`
|
28
|
+
`osascript make_alias.scpt "#{@org_dir}/a_target_file" "alias_chains_test" "#{@org_dir}"`
|
29
|
+
|
24
30
|
# build array of "true" aliases
|
25
31
|
to_alias=[]
|
26
32
|
to_alias << "#{@brk_dir}/broken"
|
@@ -29,53 +35,61 @@ class RAliasFileTest < RUNIT::TestCase
|
|
29
35
|
to_alias << "#{@org_dir}/good.txt"
|
30
36
|
|
31
37
|
# build "true" aliases using Finder
|
32
|
-
to_alias.each {|a| `osascript make_alias.scpt "#{a}" "#{File.basename(a)}" "#{@
|
38
|
+
to_alias.each {|a| `osascript make_alias.scpt "#{a}" "#{File.basename(a)}" "#{@test_dir}"`}
|
33
39
|
|
34
40
|
# remove "broken" dir to simulate broken aliases
|
35
41
|
`rm -rf "#{@brk_dir}"`
|
36
42
|
|
37
43
|
# array of sample aliases path
|
38
44
|
@aliases=[]
|
39
|
-
@aliases << "#{@
|
40
|
-
@aliases << "#{@
|
41
|
-
@aliases << "#{@
|
42
|
-
@aliases << "#{@
|
45
|
+
@aliases << "#{@test_dir}/good"
|
46
|
+
@aliases << "#{@test_dir}/good.txt"
|
47
|
+
@aliases << "#{@test_dir}/alias_of_alias"
|
48
|
+
@aliases << "#{@test_dir}/alias_of_alias"
|
49
|
+
@aliases << "#{@test_dir}/broken"
|
50
|
+
@aliases << "#{@test_dir}/broken.txt"
|
43
51
|
@aliases << "#{@org_dir}/good"
|
44
52
|
@aliases << "#{@org_dir}/good.txt"
|
45
|
-
@aliases << "#{@
|
46
|
-
@aliases << "#{@
|
53
|
+
@aliases << "#{@test_dir}/bid/good"
|
54
|
+
@aliases << "#{@test_dir}/bid/good.txt"
|
47
55
|
end
|
48
56
|
|
49
57
|
def test_alias
|
50
58
|
# "resolve" every sample aliases path exploring all the methods
|
59
|
+
found=false
|
51
60
|
@aliases.each {|al|
|
52
|
-
|
61
|
+
i=1 if found
|
62
|
+
i=0 if !found
|
63
|
+
found=(/.*alias_of_alias$/ === al)
|
64
|
+
a=RAliasFile.new(al) if (i == 0)
|
65
|
+
a=RAliasFile.new(al, false) if (i == 1)
|
66
|
+
stest=(i == 1)
|
53
67
|
fil=(/.*\.txt$/ === al)
|
54
68
|
brk=(/.*broken.*/ === al)
|
55
69
|
org=(/.*\/orig\/.*/ === al)
|
56
70
|
bid=(/.*\/bid\/.*/ === al)
|
57
|
-
orig=(brk)? "#{@brk_dir}/broken" : ((org)? "#{@org_dir}/good" : ((bid)? "#{@
|
71
|
+
orig=(brk)? "#{@brk_dir}/broken" : ((org)? "#{@org_dir}/good" : ((bid)? "#{@test_dir}/bid/good" : ((found && !stest)? "#{@org_dir}/a_target_file" : ((found && stest)? "#{@org_dir}/alias_chains_test" : "#{@org_dir}/good"))))
|
58
72
|
orig=orig+((fil)? ".txt" : "")
|
59
73
|
path_exists=(bid)? false : true
|
60
74
|
alias_file=(org || bid)? false : true
|
61
75
|
broken=(brk || org || bid)? true : false
|
62
76
|
was_aliased=(brk || org || bid)? false : true
|
63
|
-
file_alias=(fil && was_aliased)? true : false
|
64
|
-
folder_alias=(!fil && was_aliased)? true : false
|
77
|
+
file_alias=((fil && was_aliased) || found)? true : false
|
78
|
+
folder_alias=((!fil && was_aliased) && !found)? true : false
|
65
79
|
assert al === a.alias_path
|
66
80
|
assert path_exists === a.path_exists?
|
67
81
|
assert alias_file === a.is_alias_file?
|
68
82
|
assert broken === a.is_alias_broken?
|
69
83
|
assert (orig === a.resolved_path) || (brk || org || bid)
|
70
84
|
assert was_aliased === a.was_aliased?
|
71
|
-
assert folder_alias === a.is_folder_alias?
|
72
85
|
assert file_alias === a.is_file_alias?
|
86
|
+
assert folder_alias === a.is_folder_alias?
|
73
87
|
}
|
74
88
|
end
|
75
89
|
|
76
90
|
def teardown
|
77
91
|
# clean up temp dir
|
78
|
-
|
92
|
+
#`rm -rf "#{@test_dir}"`
|
79
93
|
STDERR.puts "\n"
|
80
94
|
STDERR.puts "----- Now Finish RAliasFileTest -----"
|
81
95
|
end
|
metadata
CHANGED
@@ -3,9 +3,9 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: RAliasFile
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0
|
7
|
-
date: 2006-09-
|
8
|
-
summary: C ext to Ruby aimed to resolve alias file on Mac OS X 10
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2006-09-04 00:00:00 +02:00
|
8
|
+
summary: C ext to Ruby aimed to resolve alias file on Mac OS X 10.+
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: yvon_thoraval@mac.com
|
@@ -15,7 +15,7 @@ description: RAliasFile is a C extension to Ruby aimed to resolve alias file on
|
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
18
|
-
has_rdoc:
|
18
|
+
has_rdoc: true
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
@@ -36,11 +36,11 @@ files:
|
|
36
36
|
- ChangeLog
|
37
37
|
- ext/extconf.rb
|
38
38
|
- ext/raliasfile.c
|
39
|
-
-
|
40
|
-
- test/test_raliasfile.rb
|
39
|
+
- raliasfile.gemspec
|
41
40
|
- sample/make_alias.scpt
|
42
41
|
- sample/sample_raliasfile.rb
|
43
|
-
-
|
42
|
+
- test/make_alias.scpt
|
43
|
+
- test/test_raliasfile.rb
|
44
44
|
test_files:
|
45
45
|
- test/test_raliasfile.rb
|
46
46
|
- test/make_alias.scpt
|