sbfaulkner-astrovan 0.5.0 → 0.5.2

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/README.rdoc CHANGED
@@ -35,10 +35,8 @@ This is my attempt.
35
35
  - stdin handling for exec
36
36
  - stdout/stderr handling for exec
37
37
  - other commands (all using exec)
38
- - share (smart wrapper arouncd symlink?)
39
38
  - cp ?
40
39
  - mv ?
41
- - documentation
42
40
 
43
41
  == Legal
44
42
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 5
4
- :patch: 0
4
+ :patch: 2
@@ -28,19 +28,13 @@ module Astrovan
28
28
  self.release_path = release_path = File.join(releases_path, release_name)
29
29
  self.env = options[:env] || self.env
30
30
  self.rakefile = options[:rakefile] || self.rakefile
31
+ self.current_path = current_path = File.join(deploy_to, 'current')
31
32
 
32
33
  if block_given?
33
34
  yield
34
35
  else
35
- # TODO: consider moving directory setup outside of update
36
- dirs = [deploy_to, releases_path, shared_path]
37
- # TODO: these shared children are rails specific... come up with another plan
38
- # shared_children = %w(system log pids)
39
- # dirs += shared_children.map { |d| File.join(shared_path, d) }
40
- mkdir(dirs, options)
41
-
36
+ mkdir deploy_to, releases_path, shared_path, options
42
37
  update options
43
-
44
38
  end
45
39
  rescue => e
46
40
  # TODO: rollback
@@ -49,5 +43,10 @@ module Astrovan
49
43
  ensure
50
44
  self.environment.replace original_environment
51
45
  end
46
+
47
+ # Create a symlink from a file or directory in the shared folder into the current release.
48
+ def share(path, options = {})
49
+ symlink "#{shared_path}/#{path}", options.merge(:to => "#{release_path}/#{path}")
50
+ end
52
51
  end
53
52
  end
@@ -6,6 +6,7 @@ module Astrovan
6
6
  shared_repository = self.shared_repository
7
7
  repository = self.repository
8
8
  release_path = self.release_path
9
+ current_path = self.current_path
9
10
 
10
11
  # TODO: do we need branch support, submodule config, etc?
11
12
  exec <<-END, options
@@ -19,6 +20,8 @@ module Astrovan
19
20
  git clone #{shared_repository} #{release_path}
20
21
  END
21
22
 
23
+ symlink release_path, options.merge(:to => current_path)
24
+
22
25
  yield if block_given?
23
26
  rescue => e
24
27
  # TODO: rollback
data/lib/astrovan/util.rb CHANGED
@@ -34,7 +34,7 @@ module Astrovan
34
34
  # flatten, so that arrays of paths can be passed as arguments
35
35
  paths = paths.flatten.join(' ')
36
36
  # TODO: consider using sudo?
37
- exec "ln -sf #{path} #{to}", options
37
+ exec "ln -sf #{paths} #{to}", options
38
38
  end
39
39
  end
40
40
  end
data/test/util_test.rb CHANGED
@@ -58,6 +58,8 @@ class UtilTest < Test::Unit::TestCase
58
58
  using 'astrovan.local', :password => ENV['PASSWORD'], :path => @path, :target => target do
59
59
  symlink path, :to => target
60
60
  end
61
+ assert File.exist?(target)
62
+ assert File.symlink?(target)
61
63
  assert_equal data, File.open(target) { |f| f.gets.chomp }
62
64
  end
63
65
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbfaulkner-astrovan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - S. Brent Faulkner