dply 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,58 +0,0 @@
1
- require 'fileutils'
2
- require 'dply/helper'
3
-
4
- module Dply
5
- class Setup
6
-
7
- include Helper
8
-
9
- attr_reader :config
10
-
11
- def initialize(config)
12
- @config = config
13
- end
14
-
15
- def run
16
- method = "#{config.mode}_mode".to_sym
17
- send method
18
- end
19
-
20
- def git_mode
21
- Dir.chdir deploy_dir do
22
- git.clone config.repo, "repo"
23
- FileUtils.mkdir_p "config"
24
- symlink "repo", "current"
25
- end
26
- end
27
-
28
- def release_mode
29
- Dir.chdir deploy_dir do
30
- git.clone "repo_cache"
31
- FileUtils.mkdir_p "shared", "releases", "config"
32
- create_tmp_dirs "shared"
33
- create_extra_shared_dirs "shared"
34
- end
35
- end
36
-
37
- def default_mode
38
- create_tmp_dirs deploy_dir
39
- end
40
-
41
- private
42
-
43
- def create_tmp_dirs(dir)
44
- dirs = "tmp/sockets", "tmp/pids", "log"
45
- Dir.chdir(dir) { FileUtils.mkdir_p dirs }
46
- end
47
-
48
- def create_extra_shared_dirs(dir)
49
- dirs = config.shared_dirs
50
- Dir.chdir dir { FileUtils.mkdir_p dirs }
51
- end
52
-
53
- def deploy_dir
54
- config.deploy_dir
55
- end
56
-
57
- end
58
- end
@@ -1,57 +0,0 @@
1
- require 'dply/helper'
2
- require 'dply/setup'
3
- require 'dply/linker'
4
-
5
-
6
- module Dply
7
- module Strategy
8
- class Default
9
-
10
- include Helper
11
- attr_reader :config, :options
12
-
13
- def initialize(config, options)
14
- @config = config
15
- @options = options
16
- end
17
-
18
- def deploy
19
- Dir.chdir deploy_dir do
20
- git_step
21
- tasks.deploy config.target
22
- end
23
- end
24
-
25
- def switch
26
-
27
- end
28
-
29
- def reload
30
- Dir.chdir deploy_dir do
31
- git_step
32
- tasks.reload config.target
33
- end
34
- end
35
-
36
- private
37
-
38
- def deploy_dir
39
- config.deploy_dir
40
- end
41
-
42
- def branch
43
- config.branch
44
- end
45
-
46
- def git_step
47
- return if options[:skip_git]
48
- if options[:no_pull]
49
- git.checkout branch
50
- else
51
- git.pull branch
52
- end
53
- end
54
-
55
- end
56
- end
57
- end