yac 0.0.3 → 0.0.4
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/lib/yac.rb +14 -29
- data/yac.gemspec +1 -1
- metadata +1 -1
data/lib/yac.rb
CHANGED
@@ -199,37 +199,22 @@ module Yac
|
|
199
199
|
|
200
200
|
def init
|
201
201
|
FileUtils.mkdir_p(CONFIG['root'])
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
if CONFIG['private'] && CONFIG['private']['clone-from']
|
217
|
-
puts "Initialize private repository from #{CONFIG['private']['clone-from']} to #{CONFIG['root']}/private"
|
218
|
-
Git.clone(CONFIG['private']['clone-from'], 'private', :path => CONFIG['root'])
|
219
|
-
puts "Private repository initialized."
|
220
|
-
else
|
221
|
-
puts "Initialize private repository from scratch to #{CONFIG['root']}/private"
|
222
|
-
git = Git.init(@pri_path)
|
223
|
-
git.add
|
224
|
-
git.commit_all("init private repository")
|
225
|
-
puts "Private repository initialized."
|
202
|
+
{"main" => @main_path,"private" => @pri_path}.each do |name,path|
|
203
|
+
unless File.exist?(path)
|
204
|
+
if CONFIG["#{name}"] && CONFIG["#{name}"]['clone-from']
|
205
|
+
puts "Initialize #{name} repository from #{CONFIG[name]['clone-from']} to #{CONFIG['root']}/#{name}"
|
206
|
+
Git.clone(CONFIG["#{name}"]['clone-from'], name, :path => CONFIG['root'])
|
207
|
+
else
|
208
|
+
puts "Initialize #{name} repository from scratch to #{CONFIG['root']}/#{name}"
|
209
|
+
git = Git.init(path)
|
210
|
+
git.add
|
211
|
+
git.commit_all("init #{name} repository")
|
212
|
+
end
|
213
|
+
puts "#{name} repository initialized."
|
214
|
+
@main_git = Git.open(@main_path) if File.exist?(@main_path)
|
215
|
+
@pri_git = Git.open(@pri_path)if File.exist?(@pri_path)
|
226
216
|
end
|
227
|
-
else
|
228
|
-
puts "Private repository has already been initialized."
|
229
217
|
end
|
230
|
-
@main_git = Git.open(@main_path) if File.exist?(@main_path)
|
231
|
-
@pri_git = Git.open(@pri_path)if File.exist?(@pri_path)
|
232
|
-
puts "Repository init done."
|
233
218
|
end
|
234
219
|
|
235
220
|
def prepare_dir
|
data/yac.gemspec
CHANGED