-
Notifications
You must be signed in to change notification settings - Fork 492
/
deploy.rb
110 lines (95 loc) · 2.13 KB
/
deploy.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# frozen_string_literal: true
# # NOTE:
# # Yes, you can deploy this project. It will deploy into the ./deploy/
# # directory. The commands have been stubbed, so it's harmless. No rails or
# # bundler magic will happen.
#
# # ASSUMPTIONS:
# # - You have git installed. (of course you do)
# # - You have SSH enabled. In OS X, this is "Remote Login" under the Sharing pref pane.
# # - You have your own SSH key added to your own user so you can SSH to your own machine.
#
# # In fact, let's make that folder right now.
# require 'fileutils'
# FileUtils.mkdir_p "#{Dir.pwd}/deploy"
# FileUtils.mkdir_p "#{Dir.pwd}/deploy/config"
# File.open("#{Dir.pwd}/deploy/config/database.yml", 'w') { |f| f.write "Hello" }
#
# # -- Stubs end, deploy script begins! --------------
#
require 'mina/git'
require 'mina/rails'
require 'mina/rvm'
require 'mina/rbenv'
require 'mina/chruby'
require 'pry'
set :domain, 'localhost'
set :deploy_to, "#{Dir.pwd}/deploy"
set :repository, Mina.root_path.to_s
set :shared_paths, ['config/database.yml', 'log']
set :keep_releases, 2
task :environment do
invoke :'rbenv:load'
end
#
# desc "Deploys."
task :deploy do
run :local do
puts 'buja'
end
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'deploy:cleanup'
on :launch do
comment %(in launch)
end
end
end
desc 'Task description'
task :test do
run :remote do
comment %(PWD)
in_path('/Users') do
command %(ls -al)
end
on :after do
command %(pwd)
end
end
run :local do
command %(ls -al)
end
end
desc 'Fails test'
task :fail do
run :remote do
run :local do
command 'pwd'
end
end
end
task :local_environment do
comment 'local environment run'
command 'export HERE=local'
end
task :remote_environment do
comment 'remote environment run'
command 'export HERE=remote'
end
task test_envs: :environment do
run(:local) do
command 'echo $HERE'
end
run(:remote) do
command 'echo $HERE'
end
run(:local) do
command 'echo $HERE'
end
run(:remote) do
command 'echo $HERE'
end
end