svn_command_helper 0.9.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
- data/lib/svn_command_helper/version.rb +1 -1
- data/lib/svn_command_helper.rb +18 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bd488641380cfe1d865592138ab3b4a3ec3ed5f
|
4
|
+
data.tar.gz: def3e7693fabd85377e0a35dc060df7a9b117e57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b2f374ade28eab78bf98678c7ff189a2a926a802b16ad688b56dd78b7f2230ec6403232b52173dce525a80af8191899cbd225553c3409994ffb624a7e6f8897
|
7
|
+
data.tar.gz: 1319216bde21b959d49ff296904b44abc1b270229585dc5b699d6c7b5de185b11d813191bf261c2dca98ff53c678950198dffdb6d21540ed47448cce074badda
|
data/lib/svn_command_helper.rb
CHANGED
@@ -36,8 +36,17 @@ module SvnCommandHelper
|
|
36
36
|
if @list_cache && @list_cache[uri]
|
37
37
|
@list_cache[uri]
|
38
38
|
else
|
39
|
-
|
40
|
-
|
39
|
+
list_str = cap("svn list --xml #{recursive ? '-R' : ''} #{uri}")
|
40
|
+
list = REXML::Document.new(list_str).elements.collect("/lists/list/entry") do |entry|
|
41
|
+
commit = entry.elements["commit"]
|
42
|
+
OpenStruct.new({
|
43
|
+
kind: entry.attribute("kind").value,
|
44
|
+
path: entry.elements["name"].text,
|
45
|
+
revision: commit.attribute("revision").value.to_i,
|
46
|
+
author: commit.elements["author"].text,
|
47
|
+
date: Time.iso8601(commit.elements["date"].text),
|
48
|
+
})
|
49
|
+
end
|
41
50
|
@list_cache[uri] = list if @list_cache
|
42
51
|
list
|
43
52
|
end
|
@@ -55,7 +64,7 @@ module SvnCommandHelper
|
|
55
64
|
# @param [Boolean] recursive --recursive
|
56
65
|
# @return [Array<String>] file paths
|
57
66
|
def list_files(uri, recursive = false)
|
58
|
-
list(uri, recursive).
|
67
|
+
list(uri, recursive).select {|entry| entry.kind == "file"}
|
59
68
|
end
|
60
69
|
|
61
70
|
# svn list --recursive -> grep only files
|
@@ -77,7 +86,7 @@ module SvnCommandHelper
|
|
77
86
|
# @return [Boolean] true if exists
|
78
87
|
def exist?(uri)
|
79
88
|
basename = File.basename(uri)
|
80
|
-
list(File.dirname(uri)).find{|
|
89
|
+
!list(File.dirname(uri)).find{|entry| File.fnmatch(basename, entry.path)}.nil?
|
81
90
|
end
|
82
91
|
|
83
92
|
# check svn uri file exists or not
|
@@ -85,7 +94,7 @@ module SvnCommandHelper
|
|
85
94
|
# @return [Boolean] true if exists
|
86
95
|
def exist_file?(uri)
|
87
96
|
file = File.basename(uri)
|
88
|
-
list_files(File.dirname(uri)).find{|
|
97
|
+
!list_files(File.dirname(uri)).find{|entry| File.fnmatch(file, entry.path)}.nil?
|
89
98
|
end
|
90
99
|
|
91
100
|
# svn update
|
@@ -276,8 +285,8 @@ module SvnCommandHelper
|
|
276
285
|
def copy_single(transaction, message, recursive = false)
|
277
286
|
transactions = transaction.glob_transactions(recursive)
|
278
287
|
raise "copy_single: #{transaction.from} not exists" if transactions.empty?
|
279
|
-
to_exist_transactions = Svn.list_files(transaction.to_base).map do |
|
280
|
-
transactions.find {|_transaction| _transaction.file ==
|
288
|
+
to_exist_transactions = Svn.list_files(transaction.to_base).map do |entry|
|
289
|
+
transactions.find {|_transaction| _transaction.file == entry.path}
|
281
290
|
end.compact
|
282
291
|
only_from_transactions = transactions - to_exist_transactions
|
283
292
|
if to_exist_transactions.empty? # toにファイルがない
|
@@ -384,8 +393,8 @@ module SvnCommandHelper
|
|
384
393
|
# @return [Array<SvnFileCopyTransaction>] transactions
|
385
394
|
def glob_transactions(recursive = false)
|
386
395
|
Svn.list_files(@from_base, recursive)
|
387
|
-
.select{|
|
388
|
-
.map{|
|
396
|
+
.select{|entry| File.fnmatch(@file, entry.path)}
|
397
|
+
.map{|entry| SvnFileCopyTransaction.new(from_base: @from_base, to_base: @to_base, file: entry.path)}
|
389
398
|
end
|
390
399
|
|
391
400
|
# from uri exists?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svn_command_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Narazaka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: system_command_helper
|