chap 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/chap/hook.rb CHANGED
@@ -12,5 +12,20 @@ module Chap
12
12
  instance_eval(File.read(@path), @path)
13
13
  end
14
14
 
15
+ # hook helper methods
16
+ def symlink_configs
17
+ paths = Dir.glob("#{shared_path}/config/**/*").
18
+ select {|p| File.file?(p) }
19
+ paths.each do |src|
20
+ relative_path = src.gsub(%r{.*config/},'config/')
21
+ dest = "#{release_path}/#{relative_path}"
22
+ # make sure the directory exist for symlink creation
23
+ dirname = File.dirname(dest)
24
+ FileUtils.mkdir_p(dirname) unless File.exist?(dirname)
25
+ FileUtils.rm_rf(dest) if File.exist?(dest)
26
+ FileUtils.ln_s(src,dest)
27
+ end
28
+ end
29
+
15
30
  end
16
31
  end
data/lib/chap/runner.rb CHANGED
@@ -58,7 +58,7 @@ module Chap
58
58
  FileUtils.mkdir_p(dirname) unless File.exist?(dirname)
59
59
  if File.symlink?(dest)
60
60
  File.delete(dest)
61
- elsif File.directory?(dest)
61
+ elsif File.exist?(dest)
62
62
  FileUtils.rm_rf(dest)
63
63
  end
64
64
  FileUtils.ln_s(src,dest)
data/lib/chap/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Chap
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  log "cd #{release_path} && bundle"
4
- run "cd #{release_path} && echo bundle"
4
+ run "cd #{release_path} && echo bundle"
5
+
6
+ symlink_configs
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: