spaarti 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.
- checksums.yaml +4 -4
- data/lib/spaarti/site.rb +8 -8
- data/lib/spaarti/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9501ed9a2cb2142fbc89cc429c135e5a0dbf218d
|
4
|
+
data.tar.gz: da13d0c46525dcad7c81f0138a58b6440cc9ab90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ee8ca0b26a6225daa53564d9343dabe76a2e9d650068c8e46ce7b14ad26eb489b3479371708252eb5e32ee214af2567172f8b44f3ea16d48d2f36ad95d6e6f9
|
7
|
+
data.tar.gz: 7e1b2dacd94a671a469365bbbc0067eaa91839969c29a3b9727dd98cd0600959ed463d5f78b3a5c546b02067935344c88782ce3eeefed23a42fead6ebed0af9c
|
data/lib/spaarti/site.rb
CHANGED
@@ -21,16 +21,12 @@ module Spaarti
|
|
21
21
|
# Site object, represents a group of repos
|
22
22
|
class Site
|
23
23
|
def initialize(params = {})
|
24
|
-
if params[:config_file]
|
25
|
-
params[:config_file] = File.expand_path params[:config_file]
|
26
|
-
fail 'Conf file does not exist' unless File.exist? params[:config_file]
|
27
|
-
end
|
28
24
|
@options = DEFAULT_OPTIONS.dup.merge params
|
29
|
-
load_config
|
25
|
+
load_config(params.include? :config_file)
|
30
26
|
end
|
31
27
|
|
32
28
|
def sync!
|
33
|
-
Dir.chdir(@options[:base_path]) do
|
29
|
+
Dir.chdir(File.expand_path @options[:base_path]) do
|
34
30
|
repos.each(&:sync!)
|
35
31
|
purge! if @options[:purge]
|
36
32
|
end
|
@@ -46,8 +42,12 @@ module Spaarti
|
|
46
42
|
|
47
43
|
private
|
48
44
|
|
49
|
-
def load_config
|
50
|
-
|
45
|
+
def load_config(required = false)
|
46
|
+
@options[:config_file] = File.expand_path @options[:config_file]
|
47
|
+
unless File.exist?(@options[:config_file])
|
48
|
+
fail 'Conf file does not exist' if required
|
49
|
+
return
|
50
|
+
end
|
51
51
|
config = File.open(@options[:config_file]) { |fh| YAML.load fh.read }
|
52
52
|
@options.merge! Cymbal.symbolize(config)
|
53
53
|
end
|
data/lib/spaarti/version.rb
CHANGED