six-rsync 0.6.6 → 0.6.7
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 +1 -1
- data/lib/six/rsync/base.rb +19 -0
- data/lib/six/rsync/lib.rb +23 -7
- data/lib/six/rsync/options.rb +4 -0
- data/lib/six/rsync-app.rb +8 -0
- data/lib/six/rsync.rb +6 -1
- metadata +2 -2
data/Rakefile
CHANGED
data/lib/six/rsync/base.rb
CHANGED
@@ -37,6 +37,25 @@ module Six
|
|
37
37
|
self.new(opts)
|
38
38
|
end
|
39
39
|
|
40
|
+
def self.convert(working_dir, opts = {})
|
41
|
+
opts = {
|
42
|
+
:working_directory => working_dir,
|
43
|
+
:repository => File.join(working_dir, '.rsync')
|
44
|
+
}.merge(opts)
|
45
|
+
|
46
|
+
#FileUtils.mkdir_p(opts[:working_directory]) if opts[:working_directory] && !File.directory?(opts[:working_directory])
|
47
|
+
|
48
|
+
# run rsync_convert there
|
49
|
+
logger = if opts[:log]
|
50
|
+
opts[:log]
|
51
|
+
else
|
52
|
+
nil
|
53
|
+
end
|
54
|
+
Rsync::Lib.new(opts, logger).convert
|
55
|
+
|
56
|
+
self.new(opts)
|
57
|
+
end
|
58
|
+
|
40
59
|
# clones a rsync repository locally
|
41
60
|
#
|
42
61
|
# repository - http://repo.or.cz/w/sinatra.git
|
data/lib/six/rsync/lib.rb
CHANGED
@@ -97,19 +97,25 @@ module Six
|
|
97
97
|
@logger.info "Removed: #{key}"
|
98
98
|
end
|
99
99
|
end
|
100
|
+
end
|
100
101
|
|
102
|
+
def convert
|
103
|
+
init({:force => true})
|
104
|
+
bla(".")
|
101
105
|
end
|
102
106
|
|
103
|
-
def init
|
107
|
+
def init(opts = {})
|
104
108
|
@logger.info "Processing: #{rsync_path}"
|
105
109
|
if File.exists? rsync_path
|
106
110
|
@logger.error "Seems to already be an Rsync repository, Aborting!"
|
107
111
|
raise RsyncError
|
108
112
|
end
|
109
|
-
|
110
|
-
|
111
|
-
@
|
112
|
-
|
113
|
+
unless opts[:force]
|
114
|
+
if File.exists? @rsync_work_dir
|
115
|
+
unless Dir[File.join(@rsync_work_dir, '*')].empty?
|
116
|
+
@logger.error "Folder not empty, Aborting!"
|
117
|
+
raise RsyncError
|
118
|
+
end
|
113
119
|
end
|
114
120
|
end
|
115
121
|
FileUtils.mkdir_p pack_path
|
@@ -133,6 +139,9 @@ module Six
|
|
133
139
|
def add(file)
|
134
140
|
@logger.error "Please use commit instead!"
|
135
141
|
return
|
142
|
+
end
|
143
|
+
|
144
|
+
def bla(file)
|
136
145
|
@logger.info "Adding #{file}"
|
137
146
|
if (file == ".")
|
138
147
|
load_repos(:remote)
|
@@ -151,13 +160,20 @@ module Six
|
|
151
160
|
change = true
|
152
161
|
@logger.info "Packing #{i + 1}/#{ar.size}: #{file}"
|
153
162
|
gzip(file)
|
163
|
+
FileUtils.mkdir_p(File.dirname(pack_path(relative))) unless File.exists?(File.dirname(pack_path(relative)))
|
164
|
+
checksum2 = md5("#{file}.gz")
|
154
165
|
@repos_remote[:wd][relative] = checksum
|
155
|
-
@repos_remote[:pack]["#{relative}.gz"] =
|
166
|
+
@repos_remote[:pack]["#{relative}.gz"] = checksum2
|
167
|
+
@repos_local[:wd][relative] = checksum
|
168
|
+
@repos_local[:pack]["#{relative}.gz"] = checksum2
|
156
169
|
FileUtils.mv("#{file}.gz", pack_path("#{relative}.gz"))
|
157
170
|
end
|
158
171
|
end
|
159
172
|
end
|
160
|
-
|
173
|
+
if change
|
174
|
+
save_repos
|
175
|
+
save_repos(:remote)
|
176
|
+
end
|
161
177
|
else
|
162
178
|
|
163
179
|
end
|
data/lib/six/rsync/options.rb
CHANGED
data/lib/six/rsync-app.rb
CHANGED
@@ -72,6 +72,14 @@ module Six
|
|
72
72
|
# end
|
73
73
|
Six::Repositories::Rsync.init(folder, :log => Six::Repositories::Rsync.logger)
|
74
74
|
end
|
75
|
+
|
76
|
+
def self.convert(folder)
|
77
|
+
# if File.exists?(folder)
|
78
|
+
# logger.error "#{folder} already exists!"
|
79
|
+
# Process.exit
|
80
|
+
# end
|
81
|
+
Six::Repositories::Rsync.convert(folder, :log => Six::Repositories::Rsync.logger)
|
82
|
+
end
|
75
83
|
end
|
76
84
|
|
77
85
|
unless defined?(Ocra)
|
data/lib/six/rsync.rb
CHANGED
@@ -27,7 +27,7 @@ module Six
|
|
27
27
|
|
28
28
|
module Rsync
|
29
29
|
COMPONENT = 'six-rsync'
|
30
|
-
VERSION = '0.6.
|
30
|
+
VERSION = '0.6.7'
|
31
31
|
BASE_PATH = Dir.pwd
|
32
32
|
|
33
33
|
case RUBY_PLATFORM
|
@@ -86,6 +86,11 @@ module Six
|
|
86
86
|
Base.open(working_dir, options)
|
87
87
|
end
|
88
88
|
|
89
|
+
# Converts into repository
|
90
|
+
def self.convert(working_dir = '.', options = {})
|
91
|
+
Base.convert(working_dir, options)
|
92
|
+
end
|
93
|
+
|
89
94
|
# initialize a new rsync repository, defaults to the current working directory
|
90
95
|
#
|
91
96
|
# options
|