ssync 0.2.0 → 0.3.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.
@@ -34,20 +34,24 @@ module Ssync
34
34
  File.exist?(path)
35
35
  end
36
36
 
37
+ def ssync_homedir
38
+ "#{ENV['HOME']}/.ssync"
39
+ end
40
+
37
41
  def ssync_filename
38
- ".ssync-#{read_default_config[:last_used_bucket]}"
42
+ "#{read_default_config[:last_used_bucket]}"
39
43
  end
40
44
 
41
45
  def default_config_path
42
- "#{ENV['HOME']}/.ssync.defaults.yml"
46
+ "#{ssync_homedir}/defaults.yml"
43
47
  end
44
48
 
45
49
  def config_path
46
- "#{ENV['HOME']}/#{ssync_filename}.yml"
50
+ "#{ssync_homedir}/#{ssync_filename}.yml"
47
51
  end
48
52
 
49
53
  def lock_path
50
- "#{ENV['HOME']}/#{ssync_filename}.lock"
54
+ "#{ssync_homedir}/#{ssync_filename}.lock"
51
55
  end
52
56
 
53
57
  def aquire_lock!
@@ -83,9 +87,14 @@ module Ssync
83
87
  end
84
88
 
85
89
  def write_default_config!(config)
90
+ create_homedir!
86
91
  open(default_config_path, "w") { |f| YAML::dump(config, f) }
87
92
  end
88
93
 
94
+ def create_homedir!
95
+ `mkdir #{ssync_homedir}` unless File.exists?(ssync_homedir)
96
+ end
97
+
89
98
  def options_set?(*options)
90
99
  false
91
100
  [options].flatten.each do |option|
@@ -45,11 +45,11 @@ module Ssync
45
45
  end
46
46
 
47
47
  def last_sync_started
48
- ENV['HOME'] + "/#{ssync_filename}.last-sync.started"
48
+ "#{ssync_homedir}/#{ssync_filename}.last-sync.started"
49
49
  end
50
50
 
51
51
  def last_sync_completed
52
- ENV['HOME'] + "/#{ssync_filename}.last-sync.completed"
52
+ "#{ssync_homedir}/#{ssync_filename}.last-sync.completed"
53
53
  end
54
54
 
55
55
  def last_sync_recorded?
@@ -1,3 +1,3 @@
1
1
  module Ssync
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Fred Wu
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-12 00:00:00 +11:00
18
+ date: 2010-11-15 00:00:00 +11:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency