distributed_cache 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bae74c33b8445bc66d391fedd024530242ed2bcd
4
- data.tar.gz: 2c3e0c5bfbceb79feb61d11e4e499c64b3c56683
3
+ metadata.gz: 7382c24dcc40aa19414365e37ea69639fca1ea84
4
+ data.tar.gz: 947064b4a2e9d5274681d7334103246526db4cbc
5
5
  SHA512:
6
- metadata.gz: 923dcf7aeadaa1a6abeaa641b5291cae63387c4123a1d3e79158979ad9cf08667dac1075d46f83929977ca5dee7bccc4b050423735b6f5d4641b2c7334f83a53
7
- data.tar.gz: 3a407ee819ddf9807510077e772763a5d10200e863681e943a43fb6f6e0daccf8e2219381cead738be88d1624177bc02506aec37adfd9cff7a61d744c643b075
6
+ metadata.gz: 8aa7d6afcb2402e27afb37d56f099a1952fc111de15445f05bb51be21cdfc907eb7a5a00990bea435c162079a2b84b0423369bdc959e5884cf5872bb43d9f171
7
+ data.tar.gz: 1e9292321315f66a1e3109a4e82f388b601a5cd005314f40c3b436b438b50e8ffc8d363650f8d5639369323e5dd090f54955083127e219bccb8592d32db3161e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "distributed_cache"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Doug Youch"]
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "lib/distributed_cache/config.rb",
33
33
  "lib/distributed_cache/manifest.rb",
34
34
  "lib/distributed_cache/utils.rb",
35
+ "script/console.rb",
35
36
  "spec/distributed_cache_spec.rb",
36
37
  "spec/helper.rb"
37
38
  ]
@@ -3,7 +3,9 @@ module DistributedCache
3
3
  :bundle_dir,
4
4
  :file_servers,
5
5
  :file_server_port,
6
- :remote_bundle_dir
6
+ :remote_bundle_dir,
7
+ :file_server_user,
8
+ :file_server_bundle_dir
7
9
  )
8
10
 
9
11
  def initialize
@@ -100,7 +100,10 @@ module DistributedCache
100
100
 
101
101
  def update_latest_bundle_dir
102
102
  File.unlink(latest_bundle_dir) if File.exists?(latest_bundle_dir)
103
- FileUtils.symlink bundle_dir, latest_bundle_dir
103
+ dir = File.dirname latest_bundle_dir
104
+ Dir.chdir(dir) do
105
+ FileUtils.symlink "#{date}/#{cache_version}", File.basename(latest_bundle_dir)
106
+ end
104
107
  end
105
108
 
106
109
  def self.load(config, manifest_file)
@@ -41,5 +41,13 @@ module DistributedCache
41
41
  raise "failed to (#{cmd}), status #{status}" unless status == 0
42
42
  end
43
43
  end
44
+
45
+ def self.rsync(server)
46
+ cmd = "rsync -alrz #{DistributedCache.config.bundle_dir}/ #{DistributedCache.config.file_server_user}@#{server}:#{DistributedCache.config.file_server_bundle_dir}/"
47
+ `#{cmd}`.tap do
48
+ status = $?
49
+ raise "failed to (#{cmd}), status #{status}" unless status == 0
50
+ end
51
+ end
44
52
  end
45
53
  end
@@ -48,7 +48,7 @@ module DistributedCache
48
48
 
49
49
  def self.sync
50
50
  self.config.file_servers.each do |server|
51
- DistributedCache::Utils.rsync config.bundle_dir, server
51
+ DistributedCache::Utils.rsync server
52
52
  end
53
53
  end
54
54
  end
data/script/console.rb ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__))
4
+
5
+ require 'distributed_cache'
6
+ require "irb"
7
+
8
+ if __FILE__ == $0
9
+ IRB.start(__FILE__)
10
+ else
11
+ # check -e option
12
+ if /^-e$/ =~ $0
13
+ IRB.start(__FILE__)
14
+ else
15
+ IRB.setup(__FILE__)
16
+ end
17
+ end
18
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distributed_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
@@ -89,6 +89,7 @@ files:
89
89
  - lib/distributed_cache/config.rb
90
90
  - lib/distributed_cache/manifest.rb
91
91
  - lib/distributed_cache/utils.rb
92
+ - script/console.rb
92
93
  - spec/distributed_cache_spec.rb
93
94
  - spec/helper.rb
94
95
  homepage: http://github.com/sessionm/distributed_cache