fspath 0.0.1 → 0.0.2
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/Rakefile +10 -6
- data/VERSION +1 -1
- data/fspath.gemspec +60 -0
- data/lib/fspath.rb +18 -2
- data/spec/fspath_spec.rb +22 -2
- metadata +5 -4
data/Rakefile
CHANGED
@@ -11,13 +11,17 @@ name = 'fspath'
|
|
11
11
|
summary = 'Better than Pathname'
|
12
12
|
|
13
13
|
require 'jeweler'
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
[nil].each do |platform|
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
gem.name = name
|
17
|
+
gem.homepage = "http://github.com/toy/fspath"
|
18
|
+
gem.summary = summary
|
19
|
+
gem.authors = ["Boba Fat"]
|
20
|
+
gem.platform = platform
|
21
|
+
gem.add_dependency 'rb-appscript' if platform == 'darwin'
|
22
|
+
end
|
23
|
+
Jeweler::RubygemsDotOrgTasks.new
|
19
24
|
end
|
20
|
-
Jeweler::RubygemsDotOrgTasks.new
|
21
25
|
|
22
26
|
desc "Replace system gem with symlink to this folder"
|
23
27
|
task 'ghost' do
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/fspath.gemspec
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{fspath}
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Boba Fat"]
|
12
|
+
s.date = %q{2010-12-03}
|
13
|
+
s.extra_rdoc_files = [
|
14
|
+
"LICENSE.txt",
|
15
|
+
"README.rdoc"
|
16
|
+
]
|
17
|
+
s.files = [
|
18
|
+
"Gemfile",
|
19
|
+
"Gemfile.lock",
|
20
|
+
"LICENSE.txt",
|
21
|
+
"README.rdoc",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"fspath.gemspec",
|
25
|
+
"lib/fspath.rb",
|
26
|
+
"spec/fspath_spec.rb",
|
27
|
+
"spec/spec_helper.rb"
|
28
|
+
]
|
29
|
+
s.homepage = %q{http://github.com/toy/fspath}
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
s.rubygems_version = %q{1.3.7}
|
32
|
+
s.summary = %q{Better than Pathname}
|
33
|
+
s.test_files = [
|
34
|
+
"spec/fspath_spec.rb",
|
35
|
+
"spec/spec_helper.rb"
|
36
|
+
]
|
37
|
+
|
38
|
+
if s.respond_to? :specification_version then
|
39
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
40
|
+
s.specification_version = 3
|
41
|
+
|
42
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
43
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.1.0"])
|
44
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
45
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
46
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<rspec>, ["~> 2.1.0"])
|
49
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
50
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
51
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
52
|
+
end
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<rspec>, ["~> 2.1.0"])
|
55
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
56
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
57
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
data/lib/fspath.rb
CHANGED
@@ -1,11 +1,27 @@
|
|
1
1
|
class FSPath < Pathname
|
2
2
|
class << self
|
3
|
-
# return current user home
|
4
|
-
# if called with argument return specified user home
|
3
|
+
# return current user home path if called without argument
|
4
|
+
# if called with argument return specified user home path
|
5
5
|
def ~(name = nil)
|
6
6
|
new(File.expand_path("~#{name}"))
|
7
7
|
end
|
8
8
|
end
|
9
|
+
|
10
|
+
# join paths using File.join
|
11
|
+
def /(other)
|
12
|
+
self.class.new(File.join(@path, other.to_s))
|
13
|
+
end
|
14
|
+
|
15
|
+
# fixing Pathname.+
|
16
|
+
def +(part)
|
17
|
+
self.class.new(super + part)
|
18
|
+
end
|
19
|
+
|
20
|
+
if RUBY_PLATFORM.downcase.include?('darwin')
|
21
|
+
def darwin!
|
22
|
+
p :darwin
|
23
|
+
end
|
24
|
+
end
|
9
25
|
end
|
10
26
|
|
11
27
|
module Kernel
|
data/spec/fspath_spec.rb
CHANGED
@@ -11,11 +11,31 @@ describe FSPath do
|
|
11
11
|
|
12
12
|
describe "~" do
|
13
13
|
it "should return current user home directory" do
|
14
|
-
FSPath.~.should == FSPath
|
14
|
+
FSPath.~.should == FSPath(File.expand_path('~'))
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should return other user home directory" do
|
18
|
-
FSPath.~('root').should == FSPath
|
18
|
+
FSPath.~('root').should == FSPath(File.expand_path('~root'))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "/" do
|
23
|
+
it "should join path with string" do
|
24
|
+
(FSPath('a') / 'b').should == FSPath('a/b')
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should join path with another FSPath" do
|
28
|
+
(FSPath('a') / FSPath('b')).should == FSPath('a/b')
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should join with path starting with slash" do
|
32
|
+
(FSPath('a') / '/b').should == FSPath('a/b')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "+" do
|
37
|
+
it "should return instance of FSPath" do
|
38
|
+
(FSPath('a') + 'b').should be_instance_of(FSPath)
|
19
39
|
end
|
20
40
|
end
|
21
41
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fspath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Boba Fat
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-03 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- README.rdoc
|
97
97
|
- Rakefile
|
98
98
|
- VERSION
|
99
|
+
- fspath.gemspec
|
99
100
|
- lib/fspath.rb
|
100
101
|
- spec/fspath_spec.rb
|
101
102
|
- spec/spec_helper.rb
|