dvm 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/bin/dvm +1 -1
- data/dvm.gemspec +1 -1
- data/lib/dvm/cli.rb +61 -18
- data/lib/dvm/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71e70bdb65f78d2c520342c19dec08eef4b83b3c
|
4
|
+
data.tar.gz: 02867445b40a77984ed89dfa36e4ff79eb3afe99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32afefa28d7fcad21a0dedae9795f840ebdfb96798eed83005ec3217838bc2635d4aeee3a954f1f5c1a7361d192f23905e3a77440a31755294673d8bf3a5592f
|
7
|
+
data.tar.gz: 0287e292392bffe58cc5d2af64eef8b28660545e01ff1890924ab9f6b02cea0c17b6c6740aaa7b122a4d71cd0fa51c91becb78a1444e20a2a330ee0cc7f8ca55
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
2
|
|
data/bin/dvm
CHANGED
data/dvm.gemspec
CHANGED
data/lib/dvm/cli.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
|
+
require 'colorize'
|
2
3
|
|
3
|
-
module
|
4
|
+
module Dvm
|
4
5
|
class CLI
|
5
6
|
|
6
7
|
def initialize(root, repo)
|
@@ -64,7 +65,7 @@ module DVM
|
|
64
65
|
|
65
66
|
|
66
67
|
def clone
|
67
|
-
|
68
|
+
run_cmd "git clone --bare #{@repo} #{scm}"
|
68
69
|
end
|
69
70
|
|
70
71
|
|
@@ -72,8 +73,8 @@ module DVM
|
|
72
73
|
version = `cd #{scm};git rev-parse --short HEAD`.strip
|
73
74
|
vd = release version
|
74
75
|
FileUtils.makedirs vd
|
75
|
-
|
76
|
-
|
76
|
+
run_cmd "cd #{scm};git archive master | tar -x -f - -C #{vd}"
|
77
|
+
run_cmd "echo #{version} > #{vd}/REVISION"
|
77
78
|
new_version version
|
78
79
|
version
|
79
80
|
end
|
@@ -88,52 +89,94 @@ module DVM
|
|
88
89
|
|
89
90
|
|
90
91
|
def link_current(v)
|
91
|
-
|
92
|
-
|
92
|
+
run_cmd "unlink #{current}" if File.directory? current
|
93
|
+
run_cmd "ln -s #{release(v)} #{current}"
|
93
94
|
end
|
94
95
|
|
95
96
|
|
96
97
|
def link_shared
|
97
98
|
shared_dirs.each do |e|
|
98
|
-
|
99
|
+
run_cmd "rm -rf #{current_path(e)};ln -s #{share_path(e)} #{File.dirname(current_path(e))}"
|
99
100
|
end
|
100
101
|
|
101
102
|
shared_files.each do |e|
|
102
|
-
|
103
|
+
run_cmd "rm -f #{current_path(e)};ln -s #{share_path(e)} #{current_path(e)}"
|
103
104
|
end
|
104
105
|
end
|
105
106
|
|
106
107
|
|
108
|
+
def vam_install
|
109
|
+
log_action 'Vam install'
|
110
|
+
run_cmd "cd #{current};vam install" if File.exist? File.join(current, 'Vamfile')
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
def assets_precompile
|
115
|
+
log_action 'Rails assets precompile'
|
116
|
+
run_cmd "cd #{current};RAILS_ENV=production bundle exec rake assets:precompile"
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
def db_setup
|
121
|
+
log_action 'Rails db setup'
|
122
|
+
run_cmd "cd #{current};RAILS_ENV=production bundle exec rake db:setup"
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
def bundle_install
|
127
|
+
log_action 'Rails bundle install'
|
128
|
+
run_cmd "cd #{current};RAILS_ENV=production bundle install"
|
129
|
+
end
|
130
|
+
|
131
|
+
|
107
132
|
def init_install
|
133
|
+
log_action 'Git clone'
|
108
134
|
clone
|
109
135
|
link_current checkout
|
136
|
+
|
137
|
+
log_action 'Copy & Link config files'
|
110
138
|
shared_dirs.each { |e| FileUtils.makedirs share_path(e) }
|
111
139
|
shared_files.each { |e| FileUtils.makedirs File.dirname(share_path(e)) }
|
112
140
|
copy_config
|
113
141
|
link_shared
|
114
|
-
`cd #{current};RAILS_ENV=production bundle install`
|
115
|
-
`cd #{current};vam install`
|
116
|
-
`cd #{current};RAILS_ENV=production rake assets:precompile`
|
117
|
-
`cd #{current};RAILS_ENV=production rake db:setup`
|
118
142
|
|
119
|
-
|
143
|
+
bundle_install
|
144
|
+
vam_install
|
145
|
+
assets_precompile
|
146
|
+
|
147
|
+
puts '======= Deploy success ======'.colorize :green
|
120
148
|
end
|
121
149
|
|
122
150
|
|
123
151
|
def pull
|
124
|
-
|
152
|
+
run_cmd "cd #{scm};git fetch origin master:master"
|
125
153
|
end
|
126
154
|
|
127
155
|
|
128
156
|
def update
|
157
|
+
log_action 'Git pull'
|
129
158
|
pull
|
130
159
|
link_current checkout
|
160
|
+
|
161
|
+
log_action 'Link config files'
|
131
162
|
link_shared
|
132
|
-
`cd #{current};RAILS_ENV=production bundle install`
|
133
|
-
`cd #{current};vam install`
|
134
|
-
`cd #{current};RAILS_ENV=production rake assets:precompile`
|
135
163
|
|
136
|
-
|
164
|
+
bundle_install
|
165
|
+
vam_install
|
166
|
+
assets_precompile
|
167
|
+
|
168
|
+
puts '======= Deploy success ======'.colorize :green
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
def log_action(action)
|
173
|
+
puts "\n======= #{action} =======".colorize :blue
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
def run_cmd(cmd)
|
178
|
+
puts "#RUN[ #{cmd} ]"
|
179
|
+
system cmd
|
137
180
|
end
|
138
181
|
|
139
182
|
|
data/lib/dvm/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = '0.0.
|
1
|
+
module Dvm
|
2
|
+
VERSION = '0.0.4'
|
3
3
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dvm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xingjian Xu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|