rubypath 0.3.2 → 1.0.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.
- checksums.yaml +4 -4
- metadata +5 -55
- data/CHANGELOG.md +0 -24
- data/LICENSE.txt +0 -165
- data/README.md +0 -102
- data/doc/file.README.html +0 -175
- data/lib/rubypath.rb +0 -29
- data/lib/rubypath/backend.rb +0 -92
- data/lib/rubypath/backend/mock.rb +0 -356
- data/lib/rubypath/backend/sys.rb +0 -161
- data/lib/rubypath/comparison.rb +0 -19
- data/lib/rubypath/construction.rb +0 -109
- data/lib/rubypath/dir_operations.rb +0 -160
- data/lib/rubypath/extensions.rb +0 -157
- data/lib/rubypath/file_operations.rb +0 -192
- data/lib/rubypath/file_predicates.rb +0 -32
- data/lib/rubypath/identity.rb +0 -59
- data/lib/rubypath/io_operations.rb +0 -82
- data/lib/rubypath/mock.rb +0 -42
- data/lib/rubypath/path_operations.rb +0 -311
- data/lib/rubypath/path_predicates.rb +0 -61
- data/lib/rubypath/version.rb +0 -11
- data/rubypath.gemspec +0 -22
- data/spec/README_spec.rb +0 -27
- data/spec/rubypath/comparison_spec.rb +0 -77
- data/spec/rubypath/construction_spec.rb +0 -101
- data/spec/rubypath/dir_operations_spec.rb +0 -225
- data/spec/rubypath/extensions_spec.rb +0 -270
- data/spec/rubypath/file_operations_spec.rb +0 -428
- data/spec/rubypath/file_predicates_spec.rb +0 -66
- data/spec/rubypath/identity_spec.rb +0 -21
- data/spec/rubypath/io_operations_spec.rb +0 -128
- data/spec/rubypath/path_operations_spec.rb +0 -483
- data/spec/rubypath/path_predicates_spec.rb +0 -75
- data/spec/spec_helper.rb +0 -42
- data/spec/support/describe_method.rb +0 -18
- data/spec/support/with_backend.rb +0 -37
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Path do
|
4
|
-
describe 'Path Predicates' do
|
5
|
-
describe '#absolute?' do
|
6
|
-
subject { Path(path).absolute? }
|
7
|
-
|
8
|
-
context 'with absolute path' do
|
9
|
-
let(:path) { '/abs/path/to/file' }
|
10
|
-
it { should be true }
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'with relative path' do
|
14
|
-
let(:path) { 'path/to/file' }
|
15
|
-
it { should be false }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#relative?' do
|
20
|
-
subject { Path(path).relative? }
|
21
|
-
|
22
|
-
context 'with absolute path' do
|
23
|
-
let(:path) { '/abs/path/to/file' }
|
24
|
-
it { should be false }
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'with relative path' do
|
28
|
-
let(:path) { 'path/to/file' }
|
29
|
-
it { should be true }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#mountpoint?' do
|
34
|
-
let(:path) { Path('/tmp') }
|
35
|
-
|
36
|
-
context 'without args' do
|
37
|
-
it 'should invoke backend with current path' do
|
38
|
-
expect(Path::Backend.instance).to receive(:mountpoint?).with('/tmp').and_return(false)
|
39
|
-
path.mountpoint?
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'with args' do
|
44
|
-
it 'should invoke backend with joined path' do
|
45
|
-
expect(Path::Backend.instance).to receive(:mountpoint?).with('/tmp/fuu').and_return(false)
|
46
|
-
path.mountpoint?('fuu')
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe_method :dotfile? do
|
52
|
-
subject { path.dotfile? }
|
53
|
-
|
54
|
-
context 'with dotfile' do
|
55
|
-
let(:path) { Path '.abc' }
|
56
|
-
it { should be true }
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'with path to dotfile' do
|
60
|
-
let(:path) { Path '/apth/to/.abc' }
|
61
|
-
it { should be true }
|
62
|
-
end
|
63
|
-
|
64
|
-
context 'with normal file' do
|
65
|
-
let(:path) { Path '/path/to/file' }
|
66
|
-
it { should be false }
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'with path to file within a dotdir' do
|
70
|
-
let(:path) { Path '/home/user/.local/file' }
|
71
|
-
it { should be false }
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
|
3
|
-
if ENV['CI'] || (defined?(:RUBY_ENGINE) && RUBY_ENGINE != 'rbx')
|
4
|
-
require 'coveralls'
|
5
|
-
Coveralls.wear! do
|
6
|
-
add_filter 'spec'
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
require 'bundler'
|
11
|
-
Bundler.require :default, :test
|
12
|
-
|
13
|
-
require 'rubypath'
|
14
|
-
|
15
|
-
Dir[File.expand_path('spec/support/**/*.rb')].each {|f| require f}
|
16
|
-
|
17
|
-
RSpec.configure do |config|
|
18
|
-
# ## Mock Framework
|
19
|
-
#
|
20
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
21
|
-
#
|
22
|
-
# config.mock_with :mocha
|
23
|
-
# config.mock_with :flexmock
|
24
|
-
# config.mock_with :rr
|
25
|
-
|
26
|
-
# Run specs in random order to surface order dependencies. If you find an
|
27
|
-
# order dependency and want to debug it, you can fix the order by providing
|
28
|
-
# the seed, which is printed after each run.
|
29
|
-
# --seed 1234
|
30
|
-
config.order = 'random'
|
31
|
-
|
32
|
-
# Raise error when using old :should expectation syntax.
|
33
|
-
config.raise_errors_for_deprecations!
|
34
|
-
|
35
|
-
config.around(:each) do |example|
|
36
|
-
Path::Backend.mock root: :tmp, &example
|
37
|
-
end
|
38
|
-
|
39
|
-
config.after do
|
40
|
-
Timecop.return
|
41
|
-
end
|
42
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module DescribeMethod
|
2
|
-
def describe_aliases(*args, &block)
|
3
|
-
args.each do |mth|
|
4
|
-
name = (mth == args.first ? "##{mth}" : "##{mth} (alias of #{args.first})")
|
5
|
-
|
6
|
-
describe(name) do
|
7
|
-
let(:described_method) { mth }
|
8
|
-
module_eval &block
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def describe_method(mth, opts = {}, &block)
|
14
|
-
describe_aliases *([mth] + (opts[:aliases] || []).to_ary), &block
|
15
|
-
end
|
16
|
-
|
17
|
-
RSpec.configure{|c| c.extend DescribeMethod }
|
18
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
#
|
2
|
-
module WithBackend
|
3
|
-
def with_backends(*args, &block)
|
4
|
-
args.each do |backend|
|
5
|
-
be = case backend
|
6
|
-
when :mock
|
7
|
-
->(ex){ Path::Backend.mock(&ex) }
|
8
|
-
when :sys
|
9
|
-
->(ex){ Path::Backend.mock(root: :tmp, &ex) }
|
10
|
-
else
|
11
|
-
raise ArgumentError.new 'Unknown backend.'
|
12
|
-
end
|
13
|
-
|
14
|
-
next if ENV["FS_#{backend.upcase}"] == '0'
|
15
|
-
|
16
|
-
describe "with #{backend.upcase} FS" do
|
17
|
-
let(:backend_type) { backend }
|
18
|
-
around do |example|
|
19
|
-
be.call(example)
|
20
|
-
end
|
21
|
-
|
22
|
-
module_eval(&block)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
alias_method :with_backend, :with_backends
|
27
|
-
|
28
|
-
def pending_backend(*args)
|
29
|
-
before do
|
30
|
-
if args.include? backend_type
|
31
|
-
pending "Pending on #{backend_type} backend."
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
RSpec.configure{ |c| c.extend WithBackend }
|
37
|
-
end
|