mina 1.0.0.beta5 → 1.0.0.rc2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a55b508f379f4aff1ca87b31e1e9658310b75761
4
- data.tar.gz: 5e3be159ca26d32c88598d0b15cd88d7a0cb66c9
3
+ metadata.gz: 2a7c410dc64508ec92e7da848bb91e20a0babf27
4
+ data.tar.gz: ba50cfea30e84ea35ef63a73ec56d333b7337017
5
5
  SHA512:
6
- metadata.gz: df18e9077b62571bd50f9ae2373bbccb3fefa77a244026ecd0bbc0614946116eadf72f069d70a7fbfadecc4d70653c255aed659c99d9aba9bdd8262c97ec6b22
7
- data.tar.gz: dcc10aa591f297505edf701e152398977c3a63e4379f3e1493f6283d4f24fa0c8ea9818ce62c1d043926e3d8310b53e28178e851196879e2072569d56225f9ab
6
+ metadata.gz: e980ae3ca911da9856e7cb0bb91601fb2a92f040a2b9238af5b8374df59d6189c06f56d1a8c32278caaeb78a8204610bd6351dbb68070b10f9e8471d4d8e3427
7
+ data.tar.gz: b34b69d72b963c00779e976b3d8711d51977f1e333b506c66dda63ed395260dbda17d46a747a4813b291e11cc53a649f1c4441b90adc4e81041743b14ba67f2d
data/data/deploy.rb CHANGED
@@ -23,7 +23,7 @@ set :branch, 'master'
23
23
  # set :shared_dirs, fetch(:shared_dirs, []).push('config')
24
24
  # set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml')
25
25
 
26
- # This task is the environment that is loaded for most commands, such as
26
+ # This task is the environment that is loaded all remote run commands, such as
27
27
  # `mina deploy` or `mina rake`.
28
28
  task :environment do
29
29
  # If you're using rbenv, use this to load the rbenv environment.
@@ -36,12 +36,12 @@ end
36
36
 
37
37
  # Put any custom commands you need to run at setup
38
38
  # All paths in `shared_dirs` and `shared_paths` will be created on their own.
39
- task setup: :environment do
39
+ task :setup do
40
40
  # command %{rbenv install 2.3.0}
41
41
  end
42
42
 
43
43
  desc "Deploys the current version to the server."
44
- task deploy: :environment do
44
+ task :deploy do
45
45
  # uncomment this line to make sure you pushed your local branch to the remote origin
46
46
  # invoke :'git:ensure_pushed'
47
47
  deploy do
@@ -61,6 +61,9 @@ task deploy: :environment do
61
61
  end
62
62
  end
63
63
  end
64
+
65
+ # you can use `run :local` to run tasks on local machine before of after the deploy scripts
66
+ # run :local { say 'done' }
64
67
  end
65
68
 
66
69
  # For help in making your deploy script, see the Mina documentation:
data/docs/faq.md CHANGED
@@ -1,12 +1,24 @@
1
1
  Frequently Asked Questions
2
2
  --------------------
3
3
 
4
- * `command not found: bundle`
4
+ ## - `command not found: bundle`
5
5
 
6
- You need to setup your server correctly [getting_started.md#step-0-configure-server], then install bundler.
6
+ You need to setup your server correctly [getting started](getting_started.md#step-0-configure-server), then install bundler.
7
7
 
8
8
  gem install bundler
9
9
 
10
+ ## - ruby version not found, but is already installed
10
11
 
12
+ Mina is running in a non-interactive ssh mode. That means that your full profile will not be loaded: ![ssh](http://capistranorb.com/images/BashStartupFiles1.png)
13
+
14
+ if you setup your server correctly and you are using a ruby environment manager please ensure that:
15
+ - you are using a mina plugin for that manager or
16
+ - the lines that load up your manager are at the top of your .bashrc file: http://stackoverflow.com/a/216204/1339894
17
+
18
+ ## - Mina hangs after i type my password in
19
+
20
+ Mina assumes that you have set up the communication with your server though public/private keys, not password. If you want to use password you will have to change execution mode:
21
+
22
+ set :execution_mode, :system
11
23
 
12
24
  # WIP
@@ -46,6 +46,8 @@ Adds a command to the command queue.
46
46
 
47
47
  This queues code to be run on the current queue name (defaults to `:default`).
48
48
 
49
+ By default, whitespace is stripped from the beginning and end of the command.
50
+
49
51
  ``` ruby
50
52
  command 'ls -al' # => [ls -al]
51
53
  ```
data/lib/mina/commands.rb CHANGED
@@ -12,7 +12,8 @@ module Mina
12
12
  @queue = Hash.new { |hash, key| hash[key] = [] }
13
13
  end
14
14
 
15
- def command(code, quiet: false, indent: nil)
15
+ def command(code, strip: true, quiet: false, indent: nil)
16
+ code = unindent(code) if strip
16
17
  code = indent(indent, code) if indent
17
18
  queue[stage] << (quiet ? code : echo_cmd(code))
18
19
  end
@@ -39,6 +40,7 @@ module Mina
39
40
  end
40
41
 
41
42
  def run(backend)
43
+ return if queue.empty?
42
44
  report_time do
43
45
  status = Mina::Runner.new(process, backend).run
44
46
  error! 'Run Error' unless status
data/lib/mina/dsl.rb CHANGED
@@ -24,7 +24,8 @@ module Mina
24
24
  end
25
25
 
26
26
  def run(backend)
27
- @commands = Commands.new
27
+ # @commands = Commands.new
28
+ invoke :environment if backend == :remote
28
29
  yield
29
30
  commands.run(backend)
30
31
  @commands = Commands.new
@@ -26,6 +26,14 @@ module Mina
26
26
  str.gsub(/^/, ' ' * count)
27
27
  end
28
28
 
29
+ def unindent(code)
30
+ if code =~ /^\n([ \t]+)/
31
+ code = code.gsub(/^#{$1}/, '')
32
+ end
33
+
34
+ code.strip
35
+ end
36
+
29
37
  def report_time
30
38
  time_start = Time.now
31
39
  output = yield
@@ -23,7 +23,11 @@ module Mina
23
23
  end
24
24
 
25
25
  def print_stderr(msg)
26
- puts " #{color(msg, 31)}"
26
+ if msg =~ /I, \[/ # fix for asset precompile
27
+ print_stdout msg
28
+ else
29
+ puts " #{color(msg, 31)}"
30
+ end
27
31
  end
28
32
 
29
33
  def print_command(msg)
data/lib/mina/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mina
2
- VERSION = '1.0.0.beta5'.freeze
2
+ VERSION = '1.0.0.rc2'.freeze
3
3
  end
@@ -7,12 +7,12 @@ describe Mina::Backend::Remote do
7
7
 
8
8
  describe '#prepare' do
9
9
  it 'escpaces shellwords' do
10
- expect(backend.prepare).to eq("ssh localhost -tt -- \\[\\\"ls\\ -al\\\"\\]")
10
+ expect(backend.prepare).to eq("ssh localhost -p 22 -tt -- \\[\\\"ls\\ -al\\\"\\]")
11
11
  end
12
12
 
13
13
  it 'adds debug if simualte' do
14
14
  Mina::Configuration.instance.set(:simulate, true)
15
- expect(backend.prepare).to eq("#!/usr/bin/env bash\n# Executing the following via 'ssh localhost -tt':\n#\nls -al\n ")
15
+ expect(backend.prepare).to eq("#!/usr/bin/env bash\n# Executing the following via 'ssh localhost -p 22 -tt':\n#\nls -al\n ")
16
16
  Mina::Configuration.instance.remove(:simulate)
17
17
  end
18
18
  end
@@ -83,6 +83,7 @@ describe Mina::Commands do
83
83
 
84
84
  describe '#run' do
85
85
  it 'calls run on a backend' do
86
+ commands.command('ls -al')
86
87
  runner = double(:runner)
87
88
  allow(Mina::Runner).to receive(:new).and_return(runner)
88
89
  expect(runner).to receive(:run).and_return(true)
@@ -1 +1 @@
1
- echo\ "\-\-\-\-\->\ Using\ RVM\ environment\ \\\"123\\\"\"\s*if\ \[\[\ !\ \-s\ "\$HOME/\.rvm/scripts/rvm"\ \]\];\ then\s*echo\ "!\ Ruby\ Version\ Manager\ not\ found"\s*echo\ "!\ If\ RVM\ is\ installed,\ check\ your\ :rvm_path\ setting\."\s*exit 1\s*fi\s*source\ \$HOME/\.rvm/scripts/rvm\n\s*echo\ \"\-\-\-\-\-\>\ rvm\ use\ \\\"123\\\"\ \-\-create\"
1
+ echo\ "\-\-\-\-\->\ Using\ RVM\ environment\ \\\"123\\\"\"\s*if\ \[\[\ !\ \-s\ "\$HOME/\.rvm/scripts/rvm"\ \]\];\ then\s*echo\ "!\ Ruby\ Version\ Manager\ not\ found"\s*echo\ "!\ If\ RVM\ is\ installed,\ check\ your\ :rvm_use_path\ setting\."\s*exit 1\s*fi\s*source\ \$HOME/\.rvm/scripts/rvm\n\s*echo\ \"\-\-\-\-\-\>\ rvm\ use\ \\\"123\\\"\ \-\-create\"
@@ -0,0 +1,3 @@
1
+ if ! ssh-keygen -H -F &>/dev/null; then
2
+ ssh-keyscan -t rsa -p 22 -H >> ~/.ssh/known_hosts
3
+ fi
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe 'default', type: :rake do
4
- describe 'ssh_keyscan' do
4
+ describe 'ssh_keyscan_repo' do
5
5
  it 'scans ssh' do
6
- expect { invoke_all }.to output(output_file('ssh_keyscan')).to_stdout
6
+ expect { invoke_all }.to output(output_file('ssh_keyscan_repo')).to_stdout
7
7
  end
8
8
  end
9
9
 
@@ -8,7 +8,7 @@ set :shared_dirs, fetch(:shared_dirs, []).push(fetch(:bundle_path))
8
8
 
9
9
  namespace :bundle do
10
10
  desc 'Install gem dependencies using Bundler.'
11
- task install: :environment do
11
+ task :install do
12
12
  comment %{Installing gem dependencies using Bundler}
13
13
  command %{#{fetch(:bundle_bin)} install #{fetch(:bundle_options)}}
14
14
  end
data/tasks/mina/chruby.rb CHANGED
@@ -8,10 +8,12 @@ task :chruby, :env do |_, args|
8
8
  end
9
9
 
10
10
  comment %{chruby to version: \\"#{args[:env]}\\"}
11
- command %{if [[ ! -s "#{fetch(:chruby_path)}" ]]; then
11
+ command %{
12
+ if [[ ! -s "#{fetch(:chruby_path)}" ]]; then
12
13
  echo "! chruby.sh init file not found"
13
14
  exit 1
14
- fi}
15
+ fi
16
+ }
15
17
  command %{source #{fetch(:chruby_path)}}
16
18
  command %{chruby "#{args[:env]}" || exit 1}
17
19
  end
@@ -1,15 +1,17 @@
1
+ set :port, 22
2
+
1
3
  task :environment do
2
4
  end
3
5
 
4
- task run_commands: :environment do
5
- commands.run(:remote) unless commands.queue.empty?
6
+ task :run_commands do
7
+ commands.run(:remote)
6
8
  end
7
9
 
8
10
  task :reset! do
9
11
  reset!
10
12
  end
11
13
 
12
- task debug_configuration_variables: :environment do
14
+ task :debug_configuration_variables do
13
15
  if fetch(:debug_configuration_variables)
14
16
  puts
15
17
  puts '------- Printing current config variables -------'
@@ -20,20 +22,33 @@ task debug_configuration_variables: :environment do
20
22
  end
21
23
 
22
24
  desc 'Adds current repo host to the known hosts'
23
- task :ssh_keyscan do
25
+ task :ssh_keyscan_repo do
24
26
  ensure!(:repository)
25
27
  repo_host = fetch(:repository).split(%r{@|://}).last.split(%r{:|\/}).first
26
28
  repo_port = /:([0-9]+)/.match(fetch(:repository)) && /:([0-9]+)/.match(fetch(:repository))[1] || '22'
27
29
 
28
- command %[
29
- if ! ssh-keygen -H -F #{repo_host} &>/dev/null; then
30
+ command %{
31
+ if ! ssh-keygen -H -F #{repo_host} &>/dev/null; then
30
32
  ssh-keyscan -t rsa -p #{repo_port} -H #{repo_host} >> ~/.ssh/known_hosts
31
33
  fi
32
- ]
34
+ }
35
+ end
36
+
37
+ desc 'Adds domain known hosts'
38
+ task :ssh_keyscan_domain do
39
+ ensure!(:domain)
40
+ ensure!(:port)
41
+ run :local do
42
+ command %{
43
+ if ! ssh-keygen -H -F #{fetch(:domain)} &>/dev/null; then
44
+ ssh-keyscan -t rsa -p #{fetch(:port)} -H #{fetch(:domain)} >> ~/.ssh/known_hosts
45
+ fi
46
+ }
47
+ end
33
48
  end
34
49
 
35
50
  desc 'Runs a command in the server.'
36
- task :run, [:command] => [:environment] do |_, args|
51
+ task :run, [:command] do |_, args|
37
52
  ensure!(:deploy_to)
38
53
  command = args[:command]
39
54
 
@@ -48,6 +63,6 @@ task :run, [:command] => [:environment] do |_, args|
48
63
  end
49
64
 
50
65
  desc 'Open an ssh session to the server and cd to deploy_to folder'
51
- task ssh: :environment do
52
- exec Mina::Backend::Remote.new(nil).ssh + %{ 'cd #{fetch(:deploy_to)} && exec $SHELL'}
66
+ task :ssh do
67
+ exec %{#{Mina::Backend::Remote.new(nil).ssh} 'cd #{fetch(:deploy_to)} && exec $SHELL'}
53
68
  end
data/tasks/mina/deploy.rb CHANGED
@@ -11,13 +11,13 @@ set :execution_mode, :pretty
11
11
 
12
12
  namespace :deploy do
13
13
  desc 'Forces a deploy unlock.'
14
- task force_unlock: :environment do
14
+ task :force_unlock do
15
15
  comment %{Unlocking}
16
16
  command %{rm -f "#{fetch(:deploy_to)}/#{fetch(:lock_file)}"}
17
17
  end
18
18
 
19
19
  desc 'Links paths set in :shared_dirs and :shared_files.'
20
- task link_shared_paths: :environment do
20
+ task :link_shared_paths do
21
21
  comment %{Symlinking shared paths}
22
22
 
23
23
  fetch(:shared_dirs, []).each do |linked_dir|
@@ -32,7 +32,7 @@ namespace :deploy do
32
32
  end
33
33
 
34
34
  desc 'Clean up old releases.'
35
- task cleanup: :environment do
35
+ task :cleanup do
36
36
  ensure!(:keep_releases)
37
37
  ensure!(:deploy_to)
38
38
 
@@ -46,7 +46,7 @@ namespace :deploy do
46
46
  end
47
47
 
48
48
  desc 'Rollbacks the latest release'
49
- task rollback: :environment do
49
+ task :rollback do
50
50
  comment %{Rolling back to previous release}
51
51
 
52
52
  in_path "#{fetch(:releases_path)}" do
@@ -61,30 +61,24 @@ task rollback: :environment do
61
61
  end
62
62
 
63
63
  desc 'Sets up a site.'
64
- task setup: :environment do
64
+ task :setup do
65
65
  ensure!(:deploy_to)
66
66
 
67
67
  comment %{Setting up #{fetch(:deploy_to)}}
68
68
  command %{mkdir -p "#{fetch(:deploy_to)}"}
69
- command %{chown -R $(whoami) "#{fetch(:deploy_to)}"}
70
- command %{chmod g+rx,u+rwx "#{fetch(:deploy_to)}"}
71
69
  command %{mkdir -p "#{fetch(:releases_path)}"}
72
- command %{chmod g+rx,u+rwx "#{fetch(:releases_path)}"}
73
70
  command %{mkdir -p "#{fetch(:shared_path)}"}
74
- command %{chmod g+rx,u+rwx "#{fetch(:shared_path)}"}
75
71
 
76
72
  in_path "#{fetch(:shared_path)}" do
77
73
  fetch(:shared_dirs, []).each do |linked_dir|
78
74
  command %{mkdir -p "#{linked_dir}"}
79
- command %{chmod g+rx,u+rwx "#{linked_dir}"}
80
75
  end
81
76
  fetch(:shared_paths, []).each do |linked_path|
82
77
  command %{mkdir -p "#{File.dirname(linked_path)}"}
83
- command %{chmod g+rx,u+rwx "#{File.dirname(linked_path)}"}
84
78
  end
85
79
  end
86
80
 
87
- command %{tree "#{fetch(:deploy_to)}" || ls -al "#{fetch(:deploy_to)}"}
81
+ command %{if [ -x "$(command -v tree)" ]; then tree -d -L 2 "#{fetch(:deploy_to)}"; else ls -al "#{fetch(:deploy_to)}"; fi}
88
82
 
89
- invoke :ssh_keyscan
83
+ invoke :ssh_keyscan_repo
90
84
  end
data/tasks/mina/git.rb CHANGED
@@ -7,7 +7,7 @@ set :git_not_pushed_message, -> { "Your branch #{fetch(:branch)} needs to be pus
7
7
 
8
8
  namespace :git do
9
9
  desc 'Clones the Git repository to the release path.'
10
- task clone: :environment do
10
+ task :clone do
11
11
  ensure!(:repository)
12
12
  ensure!(:deploy_to)
13
13
  if set?(:commit)
@@ -15,7 +15,8 @@ namespace :git do
15
15
  command %{git clone "#{fetch(:repository)}" . --recursive}
16
16
  command %{git checkout -b current_release "#{fetch(:commit)}" --force}
17
17
  else
18
- command %{if [ ! -d "#{fetch(:deploy_to)}/scm/objects" ]; then
18
+ command %{
19
+ if [ ! -d "#{fetch(:deploy_to)}/scm/objects" ]; then
19
20
  echo "-----> Cloning the Git repository"
20
21
  #{echo_cmd %[git clone "#{fetch(:repository)}" "#{fetch(:deploy_to)}/scm" --bare]}
21
22
  else
@@ -23,7 +24,8 @@ namespace :git do
23
24
  #{echo_cmd %[(cd "#{fetch(:deploy_to)}/scm" && git fetch "#{fetch(:repository)}" "#{fetch(:branch)}:#{fetch(:branch)}" --force)]}
24
25
  fi &&
25
26
  echo "-----> Using git branch '#{fetch(:branch)}'" &&
26
- #{echo_cmd %[git clone "#{fetch(:deploy_to)}/scm" . --recursive --branch "#{fetch(:branch)}"]}}, quiet: true
27
+ #{echo_cmd %[git clone "#{fetch(:deploy_to)}/scm" . --recursive --branch "#{fetch(:branch)}"]}
28
+ }, quiet: true
27
29
  end
28
30
 
29
31
  comment %{Using this git commit}
@@ -34,18 +36,20 @@ namespace :git do
34
36
  end
35
37
  end
36
38
 
37
- task revision: :environment do
39
+ task :revision do
38
40
  ensure!(:deploy_to)
39
41
  command %{cat #{fetch(:current_path)}/.mina_git_revision}
40
42
  end
41
43
 
42
- task ensure_pushed: :environment do
44
+ task :ensure_pushed do
43
45
  run :local do
44
46
  comment %{Ensuring everyting is pushed to git}
45
- command %{if [ $(git log #{fetch(:remote)}/#{fetch(:branch)}..#{fetch(:branch)} | wc -l) -ne 0 ]; then
46
- echo "! #{fetch(:git_not_pushed_message)}"
47
- exit 1
48
- fi}
47
+ command %{
48
+ if [ $(git log #{fetch(:remote)}/#{fetch(:branch)}..#{fetch(:branch)} | wc -l) -ne 0 ]; then
49
+ echo "! #{fetch(:git_not_pushed_message)}"
50
+ exit 1
51
+ fi
52
+ }
49
53
  end
50
54
  end
51
55
  end
data/tasks/mina/rails.rb CHANGED
@@ -12,7 +12,7 @@ set :migration_dirs, ['db/migrate']
12
12
  set :shared_dirs, fetch(:shared_dirs, []).push('log', 'tmp/cache', fetch(:compiled_asset_path))
13
13
 
14
14
  desc 'Starts an interactive console.'
15
- task console: :environment do
15
+ task :console do
16
16
  set :execution_mode, :exec
17
17
  in_path "#{fetch(:current_path)}" do
18
18
  command %{#{fetch(:rails)} console}
@@ -20,7 +20,7 @@ task console: :environment do
20
20
  end
21
21
 
22
22
  desc 'Tail log from server'
23
- task log: :environment do
23
+ task :log do
24
24
  set :execution_mode, :exec
25
25
  in_path "#{fetch(:shared_path)}/log" do
26
26
  command %{tail -f #{fetch(:rails_env)}.log}
@@ -29,7 +29,7 @@ end
29
29
 
30
30
  namespace :rails do
31
31
  desc 'Migrate database'
32
- task db_migrate: :environment do
32
+ task :db_migrate do
33
33
  if fetch(:force_migrate)
34
34
  comment %{Migrating database}
35
35
  command %{#{fetch(:rake)} db:migrate}
@@ -44,19 +44,19 @@ namespace :rails do
44
44
  end
45
45
 
46
46
  desc 'Create database'
47
- task db_create: :environment do
47
+ task :db_create do
48
48
  comment %{Creating database}
49
49
  command %{#{fetch(:rake)} db:create}
50
50
  end
51
51
 
52
52
  desc 'Rollback database'
53
- task db_rollback: :environment do
53
+ task :db_rollback do
54
54
  comment %{Rollbacking database}
55
55
  command %{#{fetch(:rake)} db:rollback}
56
56
  end
57
57
 
58
58
  desc 'Precompiles assets (skips if nothing has changed since the last release).'
59
- task assets_precompile: :environment do
59
+ task :assets_precompile do
60
60
  if fetch(:force_asset_precompile)
61
61
  comment %{Precompiling asset files}
62
62
  command %{#{fetch(:rake)} assets:precompile}
@@ -76,17 +76,19 @@ def check_for_changes_script(options)
76
76
  %{diff -qrN "#{fetch(:current_path)}/#{path}" "./#{path}" 2>/dev/null}
77
77
  end.join(' && ')
78
78
 
79
- %{if #{diffs}
79
+ %{
80
+ if #{diffs}
80
81
  then
81
82
  #{options[:skip]}
82
83
  else
83
84
  #{options[:changed]}
84
- fi}
85
+ fi
86
+ }
85
87
  end
86
88
 
87
89
  # Macro used later by :rails, :rake, etc
88
90
  make_run_task = lambda { |name, example|
89
- task name, [:arguments] => :environment do |_, args|
91
+ task name, [:arguments] do |_, args|
90
92
  set :execution_mode, :exec
91
93
 
92
94
  arguments = args[:arguments]
@@ -94,7 +96,9 @@ make_run_task = lambda { |name, example|
94
96
  puts %{You need to provide arguments. Try: mina "#{name}[#{example}]"}
95
97
  exit 1
96
98
  end
97
- command %{cd "#{deploy_to!}/#{current_path!}" && #{fetch(name)} #{arguments}}
99
+ in_path "#{fetch(:current_path)}" do
100
+ command %(#{fetch(name)} #{arguments})
101
+ end
98
102
  end
99
103
  }
100
104
 
data/tasks/mina/rbenv.rb CHANGED
@@ -4,10 +4,12 @@ task :'rbenv:load' do
4
4
  comment %{Loading rbenv}
5
5
  command %{export RBENV_ROOT="#{fetch(:rbenv_path)}"}
6
6
  command %{export PATH="#{fetch(:rbenv_path)}/bin:$PATH"}
7
- command %{if ! which rbenv >/dev/null; then
7
+ command %{
8
+ if ! which rbenv >/dev/null; then
8
9
  echo "! rbenv not found"
9
10
  echo "! If rbenv is installed, check your :rbenv_path setting."
10
11
  exit 1
11
- fi}
12
+ fi
13
+ }
12
14
  command %{eval "$(rbenv init -)"}
13
15
  end
data/tasks/mina/rvm.rb CHANGED
@@ -1,4 +1,4 @@
1
- set :rvm_path, '$HOME/.rvm/scripts/rvm'
1
+ set :rvm_use_path, '$HOME/.rvm/scripts/rvm'
2
2
 
3
3
  task :'rvm:use', :env do |_, args|
4
4
  unless args[:env]
@@ -8,12 +8,14 @@ task :'rvm:use', :env do |_, args|
8
8
  end
9
9
 
10
10
  comment %{Using RVM environment \\\"#{args[:env]}\\\"}
11
- command %{if [[ ! -s "#{fetch(:rvm_path)}" ]]; then
11
+ command %{
12
+ if [[ ! -s "#{fetch(:rvm_use_path)}" ]]; then
12
13
  echo "! Ruby Version Manager not found"
13
- echo "! If RVM is installed, check your :rvm_path setting."
14
+ echo "! If RVM is installed, check your :rvm_use_path setting."
14
15
  exit 1
15
- fi}
16
- command %{source #{fetch(:rvm_path)}}
16
+ fi
17
+ }
18
+ command %{source #{fetch(:rvm_use_path)}}
17
19
  comment %{rvm use \\"#{args[:env]}\\" --create}
18
20
  end
19
21
 
@@ -25,11 +27,13 @@ task :'rvm:wrapper', :env, :name, :bin do |_, args|
25
27
  end
26
28
 
27
29
  comment %{creating RVM wrapper "#{args[:name]}_#{args[:bin]}" using \\"#{args[:env]}\\"}
28
- command %{if [[ ! -s "#{fetch(:rvm_path)}" ]]; then
30
+ command %{
31
+ if [[ ! -s "#{fetch(:rvm_use_path)}" ]]; then
29
32
  echo "! Ruby Version Manager not found"
30
- echo "! If RVM is installed, check your :rvm_path setting."
33
+ echo "! If RVM is installed, check your :rvm_use_path setting."
31
34
  exit 1
32
- fi}
33
- command %{source #{fetch(:rvm_path)}}
35
+ fi
36
+ }
37
+ command %{source #{fetch(:rvm_use_path)}}
34
38
  command %{rvm wrapper #{args[:env]} #{args[:name]} #{args[:bin]} || exit 1}
35
39
  end
data/tasks/mina/ry.rb CHANGED
@@ -8,15 +8,19 @@ task :ry, :env do |_, args|
8
8
  comment %{ry to version: \\"#{args[:env] || '**not specified**'}\\"}
9
9
  comment %{Loading ry}
10
10
 
11
- command %{if [[ ! -e "#{fetch(:ry_path)}/bin" ]]; then
11
+ command %{
12
+ if [[ ! -e "#{fetch(:ry_path)}/bin" ]]; then
12
13
  echo "! ry not found"
13
14
  echo "! If ry is installed, check your :ry_path setting."
14
15
  exit 1
15
- fi}
16
+ fi
17
+ }
16
18
  command %{export PATH="#{fetch(:ry_path)}/bin:$PATH"}
17
19
  command %{eval "$(ry setup)"}
18
20
  command %{RY_RUBY="#{args[:env]}"}
19
- command %{if [ -n "$RY_RUBY" ]; then
21
+ command %{
22
+ if [ -n "$RY_RUBY" ]; then
20
23
  #{echo_cmd 'ry use $RY_RUBY'} || exit 1
21
- fi}
24
+ fi
25
+ }
22
26
  end
@@ -19,7 +19,10 @@
19
19
 
20
20
  require 'mina/git'
21
21
  require 'mina/rails'
22
- # require 'pry'
22
+ require 'mina/rvm'
23
+ require 'mina/rbenv'
24
+ require 'mina/chruby'
25
+ require 'pry'
23
26
  #
24
27
 
25
28
  set :domain, 'localhost'
@@ -29,11 +32,16 @@ set :shared_paths, ['config/database.yml', 'log']
29
32
  set :keep_releases, 2
30
33
 
31
34
  task :environment do
32
- command %{eval "$(rbenv init -)"}
35
+ invoke :'rbenv:load'
36
+ invoke :'rvm:use', '123'
33
37
  end
34
38
  #
35
39
  # desc "Deploys."
36
- task deploy: :environment do
40
+ task :deploy do
41
+ run :local do
42
+ puts 'buja'
43
+ end
44
+
37
45
  deploy do
38
46
  invoke :'git:clone'
39
47
  invoke :'deploy:link_shared_paths'
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: 1.0.0.beta5
4
+ version: 1.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stjepan Hadjić
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-08-30 00:00:00.000000000 Z
14
+ date: 2016-09-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -177,7 +177,7 @@ files:
177
177
  - spec/support/outputs/rvm_use.txt
178
178
  - spec/support/outputs/ry.txt
179
179
  - spec/support/outputs/setup.txt
180
- - spec/support/outputs/ssh_keyscan.txt
180
+ - spec/support/outputs/ssh_keyscan_repo.txt
181
181
  - spec/support/rake_example_group.rb
182
182
  - spec/tasks/bundler_spec.rb
183
183
  - spec/tasks/default_spec.rb
@@ -1,3 +0,0 @@
1
- if ! ssh-keygen -H -F &>/dev/null; then
2
- ssh-keyscan -t rsa -p 22 -H >> ~/.ssh/known_hosts
3
- fi