p4_web_api_client 2014.2.0.pre4 → 2014.2.0.pre5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/p4_web_api_client/client/files.rb +17 -1
- data/lib/p4_web_api_client/version.rb +1 -1
- data/spec/files_spec.rb +8 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1865649522c3cf982419f28b23982f2e6ab36e95
|
4
|
+
data.tar.gz: 88478edd7842b51d2ab40aaea81ff79f6b7d88d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f462dcbea12ec953b90ae2ecf55b5cbbc02ef3fa6ac0226f2a7ef8d58ad08bb65353d3a0a6610993d12d277df9588db810901ceee3e83b139ee4f9ede5f3120b
|
7
|
+
data.tar.gz: 26985bda44cec092bb4032e7136c8a21f803d412ca1169ec291c00e87802168d2c542dd4d240f777b15f4366e4fd0a6a0e19027d8670088b4a8035733f27b658
|
@@ -14,11 +14,22 @@ module P4WebApiClient
|
|
14
14
|
#
|
15
15
|
# Note: if path happens to be a file, instead of a directory, this is
|
16
16
|
# a synonym with the file() method.
|
17
|
+
#
|
18
|
+
# If the path contains wildcards, the return will only be the list of
|
19
|
+
# P4WebApiClient::Models::File instances.
|
20
|
+
#
|
21
|
+
# See also the P4WebApiClient::Models::File, P4WebApiClient::Models::Dir,
|
22
|
+
# and P4WebApiClient::Models::Depot for the output types.
|
17
23
|
def files(path = '')
|
18
24
|
unless path.empty?
|
19
25
|
path = path.split('/').map { |p| URI.encode(p) }.join('/')
|
20
26
|
end
|
21
|
-
arr =
|
27
|
+
arr = nil
|
28
|
+
if wildcards?(path)
|
29
|
+
arr = execute_method_no_body(:get, '/files', path: path)
|
30
|
+
else
|
31
|
+
arr = execute_method_no_body(:get, "/files/#{path}")
|
32
|
+
end
|
22
33
|
if arr.is_a?(Array)
|
23
34
|
arr.map do |obj|
|
24
35
|
if obj.key?('DepotFile')
|
@@ -91,5 +102,10 @@ module P4WebApiClient
|
|
91
102
|
def encode_path(path)
|
92
103
|
path.split('/').map { |p| URI.encode(p) }.join('/')
|
93
104
|
end
|
105
|
+
|
106
|
+
def wildcards?(path)
|
107
|
+
return !(path =~ /\.\.\./ || path =~ /\*/).nil? if path
|
108
|
+
false
|
109
|
+
end
|
94
110
|
end
|
95
111
|
end
|
data/spec/files_spec.rb
CHANGED
@@ -31,6 +31,14 @@ RSpec.describe P4WebApiClient::Client, '#files' do
|
|
31
31
|
expect(names).to include('README')
|
32
32
|
end
|
33
33
|
end
|
34
|
+
|
35
|
+
it "should list 'README' at the depot/dev/.../README path" do
|
36
|
+
client_as_jdoe do |c|
|
37
|
+
paths = c.files('depot/dev/.../README')
|
38
|
+
names = paths.map(&:name)
|
39
|
+
expect(names).to include('README')
|
40
|
+
end
|
41
|
+
end
|
34
42
|
end
|
35
43
|
|
36
44
|
RSpec.describe P4WebApiClient::Client, '#upload_file' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: p4_web_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2014.2.0.
|
4
|
+
version: 2014.2.0.pre5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tristan Juricek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2014.2.0.
|
75
|
+
version: 2014.2.0.pre5
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 2014.2.0.
|
82
|
+
version: 2014.2.0.pre5
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: puma
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|