mina 0.1.3.pre1 → 0.2.0.pre2
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/.travis.yml +0 -1
- data/HISTORY.md +26 -2
- data/data/deploy.rb +25 -6
- data/lib/mina/bundler.rb +8 -15
- data/lib/mina/default.rb +5 -4
- data/lib/mina/deploy.rb +25 -10
- data/lib/mina/git.rb +34 -11
- data/lib/mina/helpers.rb +58 -21
- data/lib/mina/output_helpers.rb +9 -2
- data/lib/mina/rails.rb +58 -42
- data/lib/mina/version.rb +1 -1
- data/test_env/config/deploy.rb +0 -1
- metadata +2 -3
- data/spec/commands/git_spec.rb +0 -22
data/.travis.yml
CHANGED
data/HISTORY.md
CHANGED
@@ -1,16 +1,40 @@
|
|
1
|
-
v0.
|
2
|
-
|
1
|
+
v0.2.0 - Unreleased
|
2
|
+
-------------------
|
3
|
+
|
4
|
+
This release had two pre releases:
|
5
|
+
|
6
|
+
* v0.2.0.pre2 (Aug 2, 2012)
|
7
|
+
* v0.1.3.pre1 (Jul 13, 2012)
|
3
8
|
|
4
9
|
### Fixed:
|
10
|
+
* [pre2] Call ssh with no double use `-t` parameter.
|
11
|
+
* [pre2] Fix Ruby 1.8 compatibility.
|
12
|
+
* [pre2] Fix the "undefined method > for Process::Status" error.
|
13
|
+
* [pre2] Using `force_migrate=1` and `force_assets=1` to `rails:db_migrate`
|
14
|
+
and `rails:assets_precompile` now works well.
|
5
15
|
* [pre1] Respect the `bundle_bin` setting when doing `bundle exec` in Rails commands. (#29)
|
6
16
|
* [pre1] Doing `rails:assets_precompile` now properly skips asset compilation if not needed. (#25)
|
7
17
|
|
8
18
|
### Added:
|
19
|
+
* [pre2] __Optimize git:clone by caching the repository.__ This way, updates are
|
20
|
+
faster because not the entire repo is cloned everytime. (#10)
|
21
|
+
* [pre2] __Show elapsed time that a deploy takes.__
|
22
|
+
* [pre2] __Display the git commit nicely when deploying.__
|
23
|
+
* [pre2] __Force quit when 2 `^C`s are pressed.__
|
24
|
+
* [pre2] New `die` helper.
|
25
|
+
* [pre2] New `report_time` helper.
|
26
|
+
* [pre2] New `to_directory` helper. (#35)
|
27
|
+
* [pre2] Put optional optimizations for Rails 3.2 asset pipeline. (#32)
|
28
|
+
* Update sample deploy script:
|
29
|
+
- [pre2] Update default deploy.rb to note :branch.
|
30
|
+
- [pre2] Add `link_shared_paths` to the sample deploy script.
|
9
31
|
* [pre1] Doing `rails:db_migrate` now skips doing migrations if they're not needed. (#18)
|
10
32
|
* [pre1] Added the `mina console` command for Rails.
|
11
33
|
* [pre1] Make asset paths configurable using the `asset_paths` setting.
|
12
34
|
|
13
35
|
### Changed:
|
36
|
+
* [pre2] __Improve output of `mina init`.__
|
37
|
+
* [pre2] Prettier output for `mina setup`. Also, show a better error message for it.
|
14
38
|
* [pre1] Refactor pretty printing to be simpler, cleaner, and extensible.
|
15
39
|
* [pre1] Show prettier abort messages when ^C'd.
|
16
40
|
|
data/data/deploy.rb
CHANGED
@@ -1,25 +1,44 @@
|
|
1
|
+
# For help in making your deploy script, see the Mina documentation:
|
2
|
+
#
|
3
|
+
# - http://nadarei.co/mina
|
4
|
+
# - http://nadarei.co/mina/tasks
|
5
|
+
# - http://nadarei.co/mina/settings
|
6
|
+
# - http://nadarei.co/mina/helpers
|
7
|
+
|
1
8
|
require 'mina/bundler'
|
2
9
|
require 'mina/rails'
|
3
10
|
require 'mina/git'
|
4
11
|
|
5
12
|
# Basic settings:
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
13
|
+
# domain - The hostname to SSH to.
|
14
|
+
# deploy_to - Path to deploy into.
|
15
|
+
# repository - Git repo to clone from. (needed by mina/git)
|
16
|
+
# branch - Branch name to deploy. (needed by mina/git)
|
10
17
|
|
11
18
|
set :domain, 'foobar.com'
|
12
19
|
set :deploy_to, '/var/www/foobar.com'
|
13
20
|
set :repository, 'git://...'
|
14
|
-
|
15
|
-
|
21
|
+
set :branch, 'master'
|
22
|
+
|
23
|
+
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
|
24
|
+
# They will be linked in the 'deploy:link_shared_paths' step.
|
25
|
+
set :shared_paths, ['config/database.yml']
|
26
|
+
|
27
|
+
# Optional settings:
|
28
|
+
# set :user, 'foobar' # Username in the server to SSH to.
|
29
|
+
# set :port, '30000' # SSH port number.
|
16
30
|
|
17
31
|
desc "Deploys the current version to the server."
|
18
32
|
task :deploy do
|
19
33
|
deploy do
|
34
|
+
# This makes asset compilation faster in Rails 3.2 -- remove this for other
|
35
|
+
# Rails versions.
|
36
|
+
invoke :'rails:optimize_for_3.2'
|
37
|
+
|
20
38
|
# Put things that will set up an empty directory into a fully set-up
|
21
39
|
# instance of your project.
|
22
40
|
invoke :'git:clone'
|
41
|
+
invoke :'deploy:link_shared_paths'
|
23
42
|
invoke :'bundle:install'
|
24
43
|
invoke :'rails:db_migrate'
|
25
44
|
invoke :'rails:assets_precompile'
|
data/lib/mina/bundler.rb
CHANGED
@@ -6,19 +6,12 @@ settings.bundle_options ||= lambda { %{--without development:test --path "#{bund
|
|
6
6
|
namespace :bundle do
|
7
7
|
desc "Install gem dependencies using Bundler."
|
8
8
|
task :install do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
echo "-----> Installing gem dependencies using Bundler"
|
17
|
-
#{echo_cmd %[mkdir -p "#{deploy_to}/#{shared_path}/bundle"]}
|
18
|
-
#{echo_cmd %[mkdir -p "#{File.dirname bundle_path}"]}
|
19
|
-
#{echo_cmd %[ln -s "#{deploy_to}/#{shared_path}/bundle" "#{bundle_path}"]}
|
20
|
-
#{echo_cmd %[#{bundle_bin} install #{bundle_options}]}
|
21
|
-
}
|
22
|
-
end
|
9
|
+
queue %{
|
10
|
+
echo "-----> Installing gem dependencies using Bundler"
|
11
|
+
#{echo_cmd %[mkdir -p "#{deploy_to}/#{shared_path}/bundle"]}
|
12
|
+
#{echo_cmd %[mkdir -p "#{File.dirname bundle_path}"]}
|
13
|
+
#{echo_cmd %[ln -s "#{deploy_to}/#{shared_path}/bundle" "#{bundle_path}"]}
|
14
|
+
#{echo_cmd %[#{bundle_bin} install #{bundle_options}]}
|
15
|
+
}
|
23
16
|
end
|
24
|
-
end
|
17
|
+
end
|
data/lib/mina/default.rb
CHANGED
@@ -7,16 +7,17 @@ task :init do
|
|
7
7
|
config_file = Rake.application.rakefile
|
8
8
|
|
9
9
|
unless config_file.to_s.empty?
|
10
|
-
|
10
|
+
print_str "! You already have #{config_file}."
|
11
11
|
exit 8
|
12
12
|
end
|
13
13
|
|
14
|
+
outfile = './config/deploy.rb'
|
14
15
|
require 'fileutils'
|
15
16
|
FileUtils.mkdir_p './config'
|
16
|
-
FileUtils.cp Mina.root_path('data/deploy.rb'),
|
17
|
+
FileUtils.cp Mina.root_path('data/deploy.rb'), outfile
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
print_str "-----> Created #{outfile}"
|
20
|
+
print_str "Edit this file, then run `#{name} setup` after."
|
20
21
|
end
|
21
22
|
|
22
23
|
task :default => :help
|
data/lib/mina/deploy.rb
CHANGED
@@ -44,18 +44,33 @@ end
|
|
44
44
|
|
45
45
|
desc "Sets up a site."
|
46
46
|
task :setup do
|
47
|
+
set :term_mode, :pretty
|
48
|
+
|
47
49
|
settings.deploy_to!
|
48
50
|
|
49
|
-
|
50
|
-
|
51
|
-
queue
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
51
|
+
user = settings.user? ? "#{settings.user}" : "username"
|
52
|
+
|
53
|
+
queue %{
|
54
|
+
echo "-----> Setting up #{deploy_to}" && (
|
55
|
+
#{echo_cmd %{mkdir -p "#{deploy_to}"}} &&
|
56
|
+
#{echo_cmd %{chown -R `whoami` "#{deploy_to}"}} &&
|
57
|
+
#{echo_cmd %{chmod g+rx,u+rwx "#{deploy_to}"}} &&
|
58
|
+
#{echo_cmd %{cd "#{deploy_to}"}} &&
|
59
|
+
#{echo_cmd %{mkdir -p "#{releases_path}"}} &&
|
60
|
+
#{echo_cmd %{chmod g+rx,u+rwx "#{releases_path}"}} &&
|
61
|
+
#{echo_cmd %{mkdir -p "#{shared_path}"}} &&
|
62
|
+
#{echo_cmd %{chmod g+rx,u+rwx "#{shared_path}"}} &&
|
63
|
+
echo "" &&
|
64
|
+
#{echo_cmd %{ls -la "#{deploy_to}"}} &&
|
65
|
+
echo "" &&
|
66
|
+
echo "-----> Done."
|
67
|
+
) || (
|
68
|
+
echo "! ERROR: Setup failed."
|
69
|
+
echo "! Ensure that the path '#{deploy_to}' is accessible to the SSH user."
|
70
|
+
echo "! Try doing:"
|
71
|
+
echo "! sudo mkdir -p \\"#{deploy_to}\\" && sudo chown -R #{user} \\"#{deploy_to}\\""
|
72
|
+
)
|
73
|
+
}
|
59
74
|
end
|
60
75
|
|
61
76
|
desc "Runs a command in the server."
|
data/lib/mina/git.rb
CHANGED
@@ -1,19 +1,42 @@
|
|
1
|
+
settings.branch ||= "master"
|
2
|
+
|
1
3
|
namespace :git do
|
2
4
|
desc "Clones the Git repository to the release path."
|
3
5
|
task :clone do
|
4
|
-
|
6
|
+
if revision?
|
7
|
+
error "The Git option `:revision` has now been deprecated."
|
8
|
+
error "Please use `:commit` or `:branch` instead."
|
9
|
+
exit
|
10
|
+
end
|
5
11
|
|
6
|
-
if
|
7
|
-
|
8
|
-
|
12
|
+
clone = if commit?
|
13
|
+
%[
|
14
|
+
echo "-----> Using git commit '#{commit}'" &&
|
15
|
+
#{echo_cmd %[git clone "#{repository!}" . --recursive]} &&
|
16
|
+
#{echo_cmd %[git checkout -b current_release "#{commit}" --force]} &&
|
17
|
+
]
|
18
|
+
else
|
19
|
+
%{
|
20
|
+
if [ ! -d "#{deploy_to}/scm/objects" ]; then
|
21
|
+
echo "-----> Cloning the Git repository"
|
22
|
+
#{echo_cmd %[git clone "#{repository!}" "#{deploy_to}/scm" --bare]}
|
23
|
+
else
|
24
|
+
echo "-----> Fetching new git commits"
|
25
|
+
#{echo_cmd %[(cd "#{deploy_to}/scm" && git fetch "#{repository!}" "#{branch}:#{branch}" --force)]}
|
26
|
+
fi &&
|
27
|
+
echo "-----> Using git branch '#{branch}'" &&
|
28
|
+
#{echo_cmd %[git clone "#{deploy_to}/scm" . --depth 1 --recursive --branch "#{branch}"]} &&
|
29
|
+
}
|
9
30
|
end
|
10
31
|
|
11
|
-
|
12
|
-
echo "----->
|
13
|
-
|
14
|
-
|
15
|
-
#{echo_cmd %[
|
16
|
-
|
17
|
-
|
32
|
+
status = %[
|
33
|
+
echo "-----> Using this git commit" &&
|
34
|
+
echo &&
|
35
|
+
#{echo_cmd %[git log --format="%aN (%h):%n> %s" -n 1]} &&
|
36
|
+
#{echo_cmd %[rm -rf .git]} &&
|
37
|
+
echo
|
38
|
+
]
|
39
|
+
|
40
|
+
queue clone + status
|
18
41
|
end
|
19
42
|
end
|
data/lib/mina/helpers.rb
CHANGED
@@ -42,7 +42,23 @@ module Mina
|
|
42
42
|
# Returns nothing.
|
43
43
|
#
|
44
44
|
def run!
|
45
|
-
ssh commands(:default)
|
45
|
+
report_time { ssh commands(:default) }
|
46
|
+
end
|
47
|
+
|
48
|
+
# Report time elapsed in the block.
|
49
|
+
# Returns the output of the block.
|
50
|
+
def report_time(&blk)
|
51
|
+
time, output = measure &blk
|
52
|
+
print_str "Elapsed time: %.2f seconds" % [time]
|
53
|
+
output
|
54
|
+
end
|
55
|
+
|
56
|
+
# Measures the time (in ms) a block takes.
|
57
|
+
# Returns a [time, output] tuple.
|
58
|
+
def measure(&blk)
|
59
|
+
t = Time.now
|
60
|
+
output = yield
|
61
|
+
[(Time.now - t).to_i, output]
|
46
62
|
end
|
47
63
|
|
48
64
|
# Executes a command via SSH.
|
@@ -73,34 +89,40 @@ module Mina
|
|
73
89
|
str = "Executing the following via '#{ssh_command}':"
|
74
90
|
puts "#!/usr/bin/env bash"
|
75
91
|
puts "# #{str}"
|
76
|
-
puts "# " + ("-" * str.size)
|
77
92
|
puts "#"
|
78
93
|
|
79
94
|
puts cmd
|
80
95
|
|
81
|
-
elsif settings.term_mode == :pretty
|
82
|
-
code = "#{ssh_command} -- bash #{bash_options} -c #{script}"
|
83
|
-
result = pretty_system(code)
|
84
|
-
|
85
|
-
elsif settings.term_mode == :exec
|
86
|
-
code = "#{ssh_command} -t -- bash #{bash_options} -c #{script}"
|
87
|
-
exec code
|
88
|
-
|
89
96
|
else
|
90
|
-
code = "#{ssh_command}
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
97
|
+
code = "#{ssh_command} -- bash #{bash_options} -c #{script}"
|
98
|
+
if settings.term_mode == :pretty
|
99
|
+
result = pretty_system(code)
|
100
|
+
elsif settings.term_mode == :exec
|
101
|
+
exec code
|
102
|
+
else
|
103
|
+
system code
|
104
|
+
result = $?.to_i
|
105
|
+
end
|
99
106
|
end
|
100
107
|
|
108
|
+
die result if result > 0
|
101
109
|
result
|
102
110
|
end
|
103
111
|
|
112
|
+
# Exits with a nice looking message.
|
113
|
+
# Returns nothing.
|
114
|
+
#
|
115
|
+
# die 2
|
116
|
+
# die 2, "Tests failed"
|
117
|
+
#
|
118
|
+
def die(code, msg=null)
|
119
|
+
str = "Failed with status #{code}"
|
120
|
+
str += " (#{msg})" if msg
|
121
|
+
err = Failed.new(str)
|
122
|
+
err.exitstatus = code
|
123
|
+
raise err
|
124
|
+
end
|
125
|
+
|
104
126
|
# Returns the SSH command to be executed.
|
105
127
|
#
|
106
128
|
# set :domain, 'foo.com'
|
@@ -204,6 +226,21 @@ module Mina
|
|
204
226
|
result
|
205
227
|
end
|
206
228
|
|
229
|
+
# Starts a new block where #commands are collected, to be executed inside `path`.
|
230
|
+
#
|
231
|
+
# Returns nothing.
|
232
|
+
#
|
233
|
+
# in_directory './webapp' do
|
234
|
+
# queue "./reload"
|
235
|
+
# end
|
236
|
+
#
|
237
|
+
# commands.should == ['cd ./webapp && (./reload && true)']
|
238
|
+
#
|
239
|
+
def in_directory(path, &blk)
|
240
|
+
isolated_commands = isolate { yield; commands }
|
241
|
+
isolated_commands.each { |cmd| queue "(cd #{path} && (#{cmd}))" }
|
242
|
+
end
|
243
|
+
|
207
244
|
# Defines instructions on how to do a certain thing.
|
208
245
|
# This makes the commands that are `queue`d go into a different bucket in commands.
|
209
246
|
#
|
@@ -221,9 +258,9 @@ module Mina
|
|
221
258
|
#
|
222
259
|
def to(name, &blk)
|
223
260
|
old, @to = @to, name
|
224
|
-
|
261
|
+
yield
|
262
|
+
ensure
|
225
263
|
@to = old
|
226
|
-
result
|
227
264
|
end
|
228
265
|
|
229
266
|
# Sets settings.
|
data/lib/mina/output_helpers.rb
CHANGED
@@ -62,13 +62,20 @@ module Mina
|
|
62
62
|
def pretty_system(code)
|
63
63
|
require 'shellwords'
|
64
64
|
cmds = Shellwords.shellsplit(code)
|
65
|
+
interrupted = false
|
65
66
|
|
66
67
|
status =
|
67
68
|
Tools.popen4(*cmds) do |pid, i, o, e|
|
68
69
|
trap "INT" do
|
69
70
|
puts ""
|
70
|
-
|
71
|
-
|
71
|
+
unless interrupted
|
72
|
+
print_status "Mina: SIGINT received."
|
73
|
+
Process.kill "TERM", pid
|
74
|
+
interrupted = true
|
75
|
+
else
|
76
|
+
print_status "Mina: SIGINT received again. Force quitting..."
|
77
|
+
Process.kill "KILL", pid
|
78
|
+
end
|
72
79
|
end
|
73
80
|
|
74
81
|
# Read stderr in the background.
|
data/lib/mina/rails.rb
CHANGED
@@ -6,6 +6,24 @@ settings.bundle_prefix ||= lambda { %{RAILS_ENV="#{rails_env}" #{bundle_bin} exe
|
|
6
6
|
settings.rake ||= lambda { %{#{bundle_prefix} rake} }
|
7
7
|
settings.rails ||= lambda { %{#{bundle_prefix} rails} }
|
8
8
|
settings.asset_paths ||= ['vendor/assets/', 'app/assets/']
|
9
|
+
settings.rake_assets_precompile ||= lambda { "#{rake} assets:precompile" }
|
10
|
+
|
11
|
+
desc "Makes Rails 3.2 deploys faster."
|
12
|
+
task :'rails:optimize_for_3.2' do
|
13
|
+
# This is 100% faster in Rails 3.2 because it skips re-invoking the
|
14
|
+
# Rake+Rails environment twice, and reuses the compilation cache for
|
15
|
+
# generating digest and non-digest assets. See:
|
16
|
+
# https://github.com/rails/rails/blob/3-2-stable/actionpack/lib/sprockets/assets.rake
|
17
|
+
settings.rake_assets_precompile = lambda {
|
18
|
+
"#{rake} assets:precompile:primary assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets"
|
19
|
+
}
|
20
|
+
|
21
|
+
# A safer, but slower (and still faster than default) version would be the
|
22
|
+
# one below. This will respect your config.assets.digest setting.
|
23
|
+
# settings.rake_assets_precompile = lambda {
|
24
|
+
# "#{rake} assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets"
|
25
|
+
# }
|
26
|
+
end
|
9
27
|
|
10
28
|
# Macro used later by :rails, :rake, etc
|
11
29
|
make_run_task = lambda { |name, sample_args|
|
@@ -59,27 +77,26 @@ namespace :rails do
|
|
59
77
|
task :db_migrate do
|
60
78
|
if ENV['force_migrate']
|
61
79
|
invoke :'rails:db_migrate:force'
|
62
|
-
|
80
|
+
else
|
81
|
+
message = verbose_mode? ?
|
82
|
+
'$((count)) changes found, migrating database' :
|
83
|
+
'Migrating database'
|
84
|
+
|
85
|
+
queue check_for_changes_script \
|
86
|
+
:check => 'db/schema.rb',
|
87
|
+
:at => ['db/schema.rb'],
|
88
|
+
:skip => %[
|
89
|
+
echo "-----> DB schema unchanged; skipping DB migration"
|
90
|
+
],
|
91
|
+
:changed => %[
|
92
|
+
echo "-----> #{message}"
|
93
|
+
#{echo_cmd %[#{rake} db:migrate]}
|
94
|
+
],
|
95
|
+
:default => %[
|
96
|
+
echo "-----> Migrating database"
|
97
|
+
#{echo_cmd %[#{rake} db:migrate]}
|
98
|
+
]
|
63
99
|
end
|
64
|
-
|
65
|
-
message = verbose_mode? ?
|
66
|
-
'$((count)) changes found, migrating database' :
|
67
|
-
'Migrating database'
|
68
|
-
|
69
|
-
queue check_for_changes_script \
|
70
|
-
check: 'db/schema.rb',
|
71
|
-
at: ['db/schema.rb'],
|
72
|
-
skip: %[
|
73
|
-
echo "-----> DB schema unchanged; skipping DB migration"
|
74
|
-
],
|
75
|
-
changed: %[
|
76
|
-
echo "-----> #{message}"
|
77
|
-
#{echo_cmd %[#{rake} db:migrate]}
|
78
|
-
],
|
79
|
-
default: %[
|
80
|
-
echo "-----> Migrating database"
|
81
|
-
#{echo_cmd %[#{rake} db:migrate]}
|
82
|
-
]
|
83
100
|
end
|
84
101
|
|
85
102
|
desc "Migrates the Rails database."
|
@@ -94,7 +111,7 @@ namespace :rails do
|
|
94
111
|
task :'assets_precompile:force' do
|
95
112
|
queue %{
|
96
113
|
echo "-----> Precompiling asset files"
|
97
|
-
#{echo_cmd %[#{
|
114
|
+
#{echo_cmd %[#{rake_assets_precompile}]}
|
98
115
|
}
|
99
116
|
end
|
100
117
|
|
@@ -102,28 +119,27 @@ namespace :rails do
|
|
102
119
|
task :'assets_precompile' do
|
103
120
|
if ENV['force_assets']
|
104
121
|
invoke :'rails:assets_precompile:force'
|
105
|
-
|
122
|
+
else
|
123
|
+
message = verbose_mode? ?
|
124
|
+
'$((count)) changes found, precompiling asset files' :
|
125
|
+
'Precompiling asset files'
|
126
|
+
|
127
|
+
queue check_for_changes_script \
|
128
|
+
:check => 'public/assets/',
|
129
|
+
:at => [*asset_paths],
|
130
|
+
:skip => %[
|
131
|
+
echo "-----> Skipping asset precompilation"
|
132
|
+
#{echo_cmd %[cp -R "#{deploy_to}/#{current_path}/public/assets" "./public/assets"]}
|
133
|
+
],
|
134
|
+
:changed => %[
|
135
|
+
echo "-----> #{message}"
|
136
|
+
#{echo_cmd %[#{rake_assets_precompile}]}
|
137
|
+
],
|
138
|
+
:default => %[
|
139
|
+
echo "-----> Precompiling asset files"
|
140
|
+
#{echo_cmd %[#{rake_assets_precompile}]}
|
141
|
+
]
|
106
142
|
end
|
107
|
-
|
108
|
-
message = verbose_mode? ?
|
109
|
-
'$((count)) changes found, precompiling asset files' :
|
110
|
-
'Precompiling asset files'
|
111
|
-
|
112
|
-
queue check_for_changes_script \
|
113
|
-
check: 'public/assets/',
|
114
|
-
at: [*asset_paths],
|
115
|
-
skip: %[
|
116
|
-
echo "-----> Skipping asset precompilation"
|
117
|
-
#{echo_cmd %[cp -R "#{deploy_to}/#{current_path}/public/assets" "./public/assets"]}
|
118
|
-
],
|
119
|
-
changed: %[
|
120
|
-
echo "-----> #{message}"
|
121
|
-
#{echo_cmd %[#{rake} assets:precompile]}
|
122
|
-
],
|
123
|
-
default: %[
|
124
|
-
echo "-----> Precompiling asset files"
|
125
|
-
#{echo_cmd %[#{rake} assets:precompile]}
|
126
|
-
]
|
127
143
|
end
|
128
144
|
|
129
145
|
end
|
data/lib/mina/version.rb
CHANGED
data/test_env/config/deploy.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0.pre2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-08-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -98,7 +98,6 @@ files:
|
|
98
98
|
- spec/commands/command_spec.rb
|
99
99
|
- spec/commands/custom_config_spec.rb
|
100
100
|
- spec/commands/deploy_spec.rb
|
101
|
-
- spec/commands/git_spec.rb
|
102
101
|
- spec/commands/outside_project_spec.rb
|
103
102
|
- spec/commands/real_deploy_spec.rb
|
104
103
|
- spec/commands/verbose_spec.rb
|
data/spec/commands/git_spec.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'command_helper'
|
3
|
-
|
4
|
-
describe "Invoking the 'mina deploy' command outside of git tree" do
|
5
|
-
before do
|
6
|
-
temp_path = "/tmp/mina-spec"
|
7
|
-
FileUtils.mkdir_p("#{temp_path}/config")
|
8
|
-
FileUtils.cp root('spec/fixtures/empty_env/config/deploy.rb'), "#{temp_path}/config/deploy.rb"
|
9
|
-
Dir.chdir temp_path
|
10
|
-
end
|
11
|
-
|
12
|
-
after do
|
13
|
-
FileUtils.rm_rf "/tmp/mina-spec"
|
14
|
-
Dir.chdir root
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should prompt empty revision error message' do
|
18
|
-
run_command 'deploy', 'simulate=1'
|
19
|
-
exitstatus.should_not eq(0)
|
20
|
-
stderr.should match(/git revision is empty/i)
|
21
|
-
end
|
22
|
-
end
|