RAliasFile 0.0.2 → 0.0.3
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/README +1 -1
- data/README.html +1 -1
- data/ext/extconf.rb +7 -9
- data/ext/raliasfile.c +3 -3
- data/raliasfile.gemspec +3 -27
- data/sample/sample_raliasfile.rb +30 -27
- metadata +4 -4
data/README
CHANGED
@@ -12,7 +12,7 @@ RubyGems repository.
|
|
12
12
|
gem install raliasfile --remote
|
13
13
|
gem check raliasfile --test
|
14
14
|
|
15
|
-
If the tests all pass, you're ready to start using
|
15
|
+
If the tests all pass, you're ready to start using RAliasFile.
|
16
16
|
|
17
17
|
Or, if you don't have rubygems installed, you can install by
|
18
18
|
hand by downloading the tarball:
|
data/README.html
CHANGED
@@ -16,7 +16,7 @@ Currently, that includes alias file resolution.</p>
|
|
16
16
|
RubyGems repository.</p>
|
17
17
|
<pre>gem install raliasfile --remote
|
18
18
|
gem check raliasfile --test</pre>
|
19
|
-
<p>If the tests all pass, you're ready to start using
|
19
|
+
<p>If the tests all pass, you're ready to start using RAliasFile.</p>
|
20
20
|
<p>Or, if you don't have rubygems installed, you can install by
|
21
21
|
hand by downloading the tarball:</p>
|
22
22
|
<pre>tar xzvf raliasfile-<latest>.tar.gz
|
data/ext/extconf.rb
CHANGED
@@ -1,24 +1,22 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
2
|
+
#
|
3
|
+
# extconf.rb
|
4
|
+
#
|
5
|
+
|
3
6
|
require 'mkmf'
|
4
7
|
|
5
8
|
case RUBY_PLATFORM
|
6
|
-
when
|
9
|
+
when /.*darwin.*/
|
7
10
|
$CFLAGS << " -I /System/Library/Frameworks/Carbon.framework/Headers "
|
8
11
|
$CFLAGS << " -I /System/Library/Frameworks/CoreFoundation.framework/Headers "
|
9
|
-
$CFLAGS <<
|
12
|
+
$CFLAGS << " -fnested-functions "
|
10
13
|
|
11
14
|
$LDFLAGS << " -framework CoreFoundation "
|
12
15
|
$LDFLAGS << " -framework Carbon "
|
13
16
|
|
14
|
-
# Give it a name
|
15
17
|
extension_name = 'raliasfile'
|
16
|
-
|
17
|
-
# The destination
|
18
18
|
dir_config(extension_name)
|
19
|
-
|
20
|
-
# Do the work
|
21
19
|
create_makefile(extension_name)
|
22
20
|
else
|
23
|
-
puts "This Ruby extension needs MacOS X 10
|
21
|
+
puts "This Ruby extension needs MacOS X 10.+"
|
24
22
|
end
|
data/ext/raliasfile.c
CHANGED
@@ -36,7 +36,7 @@ VALUE cRAliasFile;
|
|
36
36
|
*/
|
37
37
|
VALUE m_raliasfile_init(VALUE self, VALUE alias_path)
|
38
38
|
{
|
39
|
-
char resolved_path[
|
39
|
+
char resolved_path[512] = "";
|
40
40
|
VALUE is_alias_file=Qfalse;
|
41
41
|
VALUE path_exists=Qfalse;
|
42
42
|
VALUE was_aliased=Qfalse;
|
@@ -62,7 +62,7 @@ VALUE m_raliasfile_init(VALUE self, VALUE alias_path)
|
|
62
62
|
CFURLRef resolvedUrl = CFURLCreateFromFSRef(NULL, &theRef);
|
63
63
|
if (resolvedUrl != NULL) {
|
64
64
|
CFStringRef theResolvedAliasPath = CFURLCopyFileSystemPath(resolvedUrl, kCFURLPOSIXPathStyle);
|
65
|
-
Boolean success = CFStringGetCString(theResolvedAliasPath, resolved_path,
|
65
|
+
Boolean success = CFStringGetCString(theResolvedAliasPath, resolved_path, 512, kCFStringEncodingUTF8);
|
66
66
|
if(wasAliased) {
|
67
67
|
was_aliased=Qtrue;
|
68
68
|
} else {
|
@@ -172,7 +172,7 @@ VALUE m_is_file(VALUE self) {
|
|
172
172
|
* returns the version of this class
|
173
173
|
*/
|
174
174
|
VALUE m_version(VALUE self) {
|
175
|
-
char *version = "0.0.
|
175
|
+
char *version = "0.0.3";
|
176
176
|
return rb_str_new2(version);
|
177
177
|
}
|
178
178
|
|
data/raliasfile.gemspec
CHANGED
@@ -6,11 +6,11 @@ require 'rubygems'
|
|
6
6
|
|
7
7
|
spec = Gem::Specification.new do |s|
|
8
8
|
s.name = 'RAliasFile'
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.3"
|
10
10
|
# s.platform = Gem::Platform::RUBY::OSX
|
11
11
|
# s.platform = Gem::Platform::OSX
|
12
12
|
s.summary = "C ext to Ruby aimed to resolve alias file on Mac OS X 10.4+"
|
13
|
-
s.requirements << 'MacOS X 10
|
13
|
+
s.requirements << 'MacOS X 10.+'
|
14
14
|
s.files = File.read( 'FILES').split( $/)
|
15
15
|
s.test_files = Dir.glob('test/test_*.rb') + Dir.glob('test/*.scpt')
|
16
16
|
s.extensions << 'ext/extconf.rb'
|
@@ -20,7 +20,7 @@ spec = Gem::Specification.new do |s|
|
|
20
20
|
s.rubyforge_project = "RAliasFile"
|
21
21
|
s.homepage = "http://rubyforge.org/projects/raliasfile/"
|
22
22
|
s.description = <<-EOF
|
23
|
-
RAliasFile is a C extension to Ruby aimed to resolve alias file on Mac OS X 10
|
23
|
+
RAliasFile is a C extension to Ruby aimed to resolve alias file on Mac OS X 10.+.
|
24
24
|
It also provides means to check if the alias file is broken,
|
25
25
|
it's target is a folder or file, the given path does exists.
|
26
26
|
EOF
|
@@ -31,27 +31,3 @@ if $0==__FILE__
|
|
31
31
|
Gem.manage_gems
|
32
32
|
Gem::Builder.new(spec).build
|
33
33
|
end
|
34
|
-
|
35
|
-
=begin
|
36
|
-
.../raliasfile%> ruby raliasfile.gemspec
|
37
|
-
Successfully built RubyGem
|
38
|
-
Name: RAliasFile
|
39
|
-
Version: 0.0.1
|
40
|
-
File: RAliasFile-0.0.1.gem
|
41
|
-
|
42
|
-
.../raliasfile%> sudo gem install RAliasFile-0.0.1.gem
|
43
|
-
Password:
|
44
|
-
Building native extensions. This could take a while...
|
45
|
-
ruby extconf.rb install RAliasFile-0.0.1.gem
|
46
|
-
creating Makefile
|
47
|
-
|
48
|
-
make
|
49
|
-
gcc -fno-common -O -pipe -I/opt/local/include -fno-common -pipe -fno-common -I /System/Library/Frameworks/Carbon.framework/Headers -I /System/Library/Frameworks/CoreFoundation.framework/Headers -I /System/Library/Frameworks/CoreServices.framework/Headers -I /System/Library/Frameworks/Foundation.framework/Headers -I /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers -fnested-functions -I. -I/opt/local/lib/ruby/1.8/powerpc-darwin8.7.0 -I/opt/local/lib/ruby/1.8/powerpc-darwin8.7.0 -I. -O -pipe -I/opt/local/include -c raliasfile.c
|
50
|
-
cc -dynamic -bundle -undefined suppress -flat_namespace -L/opt/local/lib -framework CoreFoundation -framework Carbon -framework CoreServices -framework Foundation -L"/opt/local/lib" -o raliasfile.bundle raliasfile.o -lruby -lpthread -ldl -lobjc
|
51
|
-
|
52
|
-
make install
|
53
|
-
/usr/bin/install -c -m 0755 raliasfile.bundle /opt/local/lib/ruby/gems/1.8/gems/RAliasFile-0.0.1/lib
|
54
|
-
|
55
|
-
make clean
|
56
|
-
Successfully installed RAliasFile, version 0.0.1
|
57
|
-
=end
|
data/sample/sample_raliasfile.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
# sample.rb
|
4
4
|
#
|
5
5
|
|
6
|
-
#require File.dirname(Dir.pwd)+"/osx/raliasfile/raliasfile"
|
7
6
|
require 'raliasfile'
|
8
7
|
|
9
8
|
DESKTOP=ENV['HOME']+"/Desktop"
|
@@ -12,42 +11,46 @@ ORG_DIR="#{TEST_DIR}/alias/orig"
|
|
12
11
|
BRK_DIR="#{TEST_DIR}/alias/orig/broken"
|
13
12
|
ALS_DIR="#{TEST_DIR}/alias"
|
14
13
|
|
15
|
-
|
16
|
-
`
|
14
|
+
if(!FileTest.exists?("#{ORG_DIR}/good.txt"))
|
15
|
+
`mkdir -p "#{BRK_DIR}/broken"`
|
16
|
+
`touch "#{BRK_DIR}/broken.txt"`
|
17
17
|
|
18
|
-
`mkdir -p "#{ORG_DIR}/good"`
|
19
|
-
`touch "#{ORG_DIR}/good.txt"`
|
18
|
+
`mkdir -p "#{ORG_DIR}/good"`
|
19
|
+
`touch "#{ORG_DIR}/good.txt"`
|
20
20
|
|
21
|
-
# build array of "true" aliases
|
22
|
-
to_alias=[]
|
23
|
-
to_alias << "#{BRK_DIR}/broken"
|
24
|
-
to_alias << "#{BRK_DIR}/broken.txt"
|
25
|
-
to_alias << "#{ORG_DIR}/good"
|
26
|
-
to_alias << "#{ORG_DIR}/good.txt"
|
21
|
+
# build array of "true" aliases
|
22
|
+
to_alias=[]
|
23
|
+
to_alias << "#{BRK_DIR}/broken"
|
24
|
+
to_alias << "#{BRK_DIR}/broken.txt"
|
25
|
+
to_alias << "#{ORG_DIR}/good"
|
26
|
+
to_alias << "#{ORG_DIR}/good.txt"
|
27
27
|
|
28
|
-
# build "true" aliases using Finder
|
29
|
-
to_alias.each {|a| `osascript make_alias.scpt "#{a}" "#{File.basename(a)}" "#{ALS_DIR}"`}
|
28
|
+
# build "true" aliases using Finder
|
29
|
+
to_alias.each {|a| `osascript make_alias.scpt "#{a}" "#{File.basename(a)}" "#{ALS_DIR}"`}
|
30
30
|
|
31
|
-
# remove "broken" dir to simulate broken aliases
|
32
|
-
`rm -rf "#{BRK_DIR}"`
|
33
|
-
# if you comment out the above line the aliases of "broken" dir won't be broken
|
31
|
+
# remove "broken" dir to simulate broken aliases
|
32
|
+
`rm -rf "#{BRK_DIR}"`
|
33
|
+
# if you comment out the above line the aliases of "broken" dir won't be broken
|
34
|
+
end
|
34
35
|
|
35
36
|
# array of sample pathes
|
36
|
-
aliases=[]
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
aliases=[["#{ALS_DIR}/broken" , "*broken* alias file from target folder"],
|
38
|
+
["#{ALS_DIR}/broken.txt" , "*broken* alias file from target file"],
|
39
|
+
["#{ALS_DIR}/good" , "alias file from target folder"],
|
40
|
+
["#{ALS_DIR}/good.txt" , "alias file from target file"],
|
41
|
+
["#{ORG_DIR}/good" , "*wrong* alias file being a folder"],
|
42
|
+
["#{ORG_DIR}/good.txt" , "*wrong* alias file being a file"],
|
43
|
+
["#{ALS_DIR}/bid/good" , "*wrong* path to alias file being a *non-existing* folder"],
|
44
|
+
["#{ALS_DIR}/bid/good.txt", "*wrong* path to alias file being a *non-existing* file"]
|
45
|
+
]
|
45
46
|
|
46
47
|
# "resolve" every sample pathes exploring all the methods
|
47
48
|
puts "RAliasFile.version="+RAliasFile.version.to_s
|
48
|
-
aliases.each {|
|
49
|
-
|
49
|
+
aliases.each {|as|
|
50
|
+
al,txt=as[0],as[1]
|
50
51
|
puts "\n"
|
52
|
+
puts "#{txt} : #{al}"
|
53
|
+
a=RAliasFile.new(al)
|
51
54
|
puts "a.alias_path="+a.alias_path
|
52
55
|
puts "a.path_exists?="+a.path_exists?.to_s
|
53
56
|
puts "a.is_alias_file?="+a.is_alias_file?.to_s
|
metadata
CHANGED
@@ -3,15 +3,15 @@ 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-
|
6
|
+
version: 0.0.3
|
7
|
+
date: 2006-09-01 00:00:00 +02:00
|
8
8
|
summary: C ext to Ruby aimed to resolve alias file on Mac OS X 10.4+
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: yvon_thoraval@mac.com
|
12
12
|
homepage: http://rubyforge.org/projects/raliasfile/
|
13
13
|
rubyforge_project: RAliasFile
|
14
|
-
description: RAliasFile is a C extension to Ruby aimed to resolve alias file on Mac OS X 10
|
14
|
+
description: RAliasFile is a C extension to Ruby aimed to resolve alias file on Mac OS X 10.+. It also provides means to check if the alias file is broken, it's target is a folder or file, the given path does exists.
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
@@ -53,6 +53,6 @@ executables: []
|
|
53
53
|
extensions:
|
54
54
|
- ext/extconf.rb
|
55
55
|
requirements:
|
56
|
-
- MacOS X 10
|
56
|
+
- MacOS X 10.+
|
57
57
|
dependencies: []
|
58
58
|
|