fspath 0.0.2-darwin

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/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :development do
4
+ gem "rspec", "~> 2.1.0"
5
+ gem "bundler", "~> 1.0.0"
6
+ gem "jeweler", "~> 1.5.1"
7
+ gem "rcov", ">= 0"
8
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ git (1.2.5)
6
+ jeweler (1.5.1)
7
+ bundler (~> 1.0.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ rake (0.8.7)
11
+ rcov (0.9.9)
12
+ rspec (2.1.0)
13
+ rspec-core (~> 2.1.0)
14
+ rspec-expectations (~> 2.1.0)
15
+ rspec-mocks (~> 2.1.0)
16
+ rspec-core (2.1.0)
17
+ rspec-expectations (2.1.0)
18
+ diff-lcs (~> 1.1.2)
19
+ rspec-mocks (2.1.0)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ bundler (~> 1.0.0)
26
+ jeweler (~> 1.5.1)
27
+ rcov
28
+ rspec (~> 2.1.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Boba Fat
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,7 @@
1
+ = fspath
2
+
3
+ Better than Pathname
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) 2010 Boba Fat. See LICENSE.txt for further details.
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ require 'bundler'
2
+ begin
3
+ Bundler.setup(:default, :development)
4
+ rescue Bundler::BundlerError => e
5
+ $stderr.puts e.message
6
+ $stderr.puts "Run `bundle install` to install missing gems"
7
+ exit e.status_code
8
+ end
9
+
10
+ name = 'fspath'
11
+ summary = 'Better than Pathname'
12
+
13
+ require 'jeweler'
14
+ [nil, 'darwin'].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
+ end
24
+ Jeweler::RubygemsDotOrgTasks.new
25
+
26
+ desc "Replace system gem with symlink to this folder"
27
+ task 'ghost' do
28
+ gem_path = Gem.searcher.find(name).full_gem_path
29
+ current_path = File.expand_path('.')
30
+ system('rm', '-r', gem_path)
31
+ system('ln', '-s', current_path, gem_path)
32
+ end
33
+
34
+ require 'rspec/core'
35
+ require 'rspec/core/rake_task'
36
+ RSpec::Core::RakeTask.new(:spec) do |spec|
37
+ spec.rspec_opts = ['--colour --format progress']
38
+ spec.pattern = FileList['spec/**/*_spec.rb']
39
+ end
40
+
41
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
42
+ spec.rspec_opts = ['--colour --format progress']
43
+ spec.pattern = 'spec/**/*_spec.rb'
44
+ spec.rcov = true
45
+ spec.rcov_opts = ['--exclude', 'spec']
46
+ end
47
+
48
+ task :spec_with_rcov_and_open => :rcov do
49
+ `open coverage/index.html`
50
+ end
51
+
52
+ desc 'Default: run specs.'
53
+ task :default => :spec_with_rcov_and_open
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
data/fspath.gemspec ADDED
@@ -0,0 +1,67 @@
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
+ s.platform = %q{darwin}
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["Boba Fat"]
13
+ s.date = %q{2010-12-03}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE.txt",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ "Gemfile",
20
+ "Gemfile.lock",
21
+ "LICENSE.txt",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "fspath.gemspec",
26
+ "lib/fspath.rb",
27
+ "spec/fspath_spec.rb",
28
+ "spec/spec_helper.rb"
29
+ ]
30
+ s.homepage = %q{http://github.com/toy/fspath}
31
+ s.require_paths = ["lib"]
32
+ s.rubygems_version = %q{1.3.7}
33
+ s.summary = %q{Better than Pathname}
34
+ s.test_files = [
35
+ "spec/fspath_spec.rb",
36
+ "spec/spec_helper.rb"
37
+ ]
38
+
39
+ if s.respond_to? :specification_version then
40
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
41
+ s.specification_version = 3
42
+
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_runtime_dependency(%q<rb-appscript>, [">= 0"])
45
+ s.add_development_dependency(%q<rspec>, ["~> 2.1.0"])
46
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
48
+ s.add_development_dependency(%q<rcov>, [">= 0"])
49
+ s.add_runtime_dependency(%q<rb-appscript>, [">= 0"])
50
+ else
51
+ s.add_dependency(%q<rb-appscript>, [">= 0"])
52
+ s.add_dependency(%q<rspec>, ["~> 2.1.0"])
53
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
54
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
55
+ s.add_dependency(%q<rcov>, [">= 0"])
56
+ s.add_dependency(%q<rb-appscript>, [">= 0"])
57
+ end
58
+ else
59
+ s.add_dependency(%q<rb-appscript>, [">= 0"])
60
+ s.add_dependency(%q<rspec>, ["~> 2.1.0"])
61
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
62
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
63
+ s.add_dependency(%q<rcov>, [">= 0"])
64
+ s.add_dependency(%q<rb-appscript>, [">= 0"])
65
+ end
66
+ end
67
+
data/lib/fspath.rb ADDED
@@ -0,0 +1,33 @@
1
+ class FSPath < Pathname
2
+ class << self
3
+ # return current user home path if called without argument
4
+ # if called with argument return specified user home path
5
+ def ~(name = nil)
6
+ new(File.expand_path("~#{name}"))
7
+ end
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
25
+ end
26
+
27
+ module Kernel
28
+ # FSPath(path) method
29
+ def FSPath(path)
30
+ FSPath.new(path)
31
+ end
32
+ private :Pathname
33
+ end
@@ -0,0 +1,41 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe FSPath do
4
+ it "should inherit from Pathname" do
5
+ FSPath.new('.').should be_kind_of(Pathname)
6
+ end
7
+
8
+ it "should use shortcut" do
9
+ FSPath('.').should === FSPath.new('.')
10
+ end
11
+
12
+ describe "~" do
13
+ it "should return current user home directory" do
14
+ FSPath.~.should == FSPath(File.expand_path('~'))
15
+ end
16
+
17
+ it "should return other user home directory" do
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)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'fspath'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fspath
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: darwin
12
+ authors:
13
+ - Boba Fat
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-12-03 00:00:00 +03:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ name: rb-appscript
33
+ requirement: *id001
34
+ type: :runtime
35
+ - !ruby/object:Gem::Dependency
36
+ prerelease: false
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ hash: 11
43
+ segments:
44
+ - 2
45
+ - 1
46
+ - 0
47
+ version: 2.1.0
48
+ name: rspec
49
+ requirement: *id002
50
+ type: :development
51
+ - !ruby/object:Gem::Dependency
52
+ prerelease: false
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ hash: 23
59
+ segments:
60
+ - 1
61
+ - 0
62
+ - 0
63
+ version: 1.0.0
64
+ name: bundler
65
+ requirement: *id003
66
+ type: :development
67
+ - !ruby/object:Gem::Dependency
68
+ prerelease: false
69
+ version_requirements: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ hash: 1
75
+ segments:
76
+ - 1
77
+ - 5
78
+ - 1
79
+ version: 1.5.1
80
+ name: jeweler
81
+ requirement: *id004
82
+ type: :development
83
+ - !ruby/object:Gem::Dependency
84
+ prerelease: false
85
+ version_requirements: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 3
91
+ segments:
92
+ - 0
93
+ version: "0"
94
+ name: rcov
95
+ requirement: *id005
96
+ type: :development
97
+ - !ruby/object:Gem::Dependency
98
+ prerelease: false
99
+ version_requirements: &id006 !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ name: rb-appscript
109
+ requirement: *id006
110
+ type: :runtime
111
+ description:
112
+ email:
113
+ executables: []
114
+
115
+ extensions: []
116
+
117
+ extra_rdoc_files:
118
+ - LICENSE.txt
119
+ - README.rdoc
120
+ files:
121
+ - Gemfile
122
+ - Gemfile.lock
123
+ - LICENSE.txt
124
+ - README.rdoc
125
+ - Rakefile
126
+ - VERSION
127
+ - fspath.gemspec
128
+ - lib/fspath.rb
129
+ - spec/fspath_spec.rb
130
+ - spec/spec_helper.rb
131
+ has_rdoc: true
132
+ homepage: http://github.com/toy/fspath
133
+ licenses: []
134
+
135
+ post_install_message:
136
+ rdoc_options: []
137
+
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ hash: 3
146
+ segments:
147
+ - 0
148
+ version: "0"
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ hash: 3
155
+ segments:
156
+ - 0
157
+ version: "0"
158
+ requirements: []
159
+
160
+ rubyforge_project:
161
+ rubygems_version: 1.3.7
162
+ signing_key:
163
+ specification_version: 3
164
+ summary: Better than Pathname
165
+ test_files:
166
+ - spec/fspath_spec.rb
167
+ - spec/spec_helper.rb