Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined local variable or method current_path #483

Closed
folivi opened this issue Nov 18, 2016 · 1 comment
Closed

undefined local variable or method current_path #483

folivi opened this issue Nov 18, 2016 · 1 comment

Comments

@folivi
Copy link

folivi commented Nov 18, 2016

Hi,
I'm having this issue with on ruby 2.3.0
and not on ruby 2.2.3

NameError: undefined local variable or method `current_path' for main:Object

Any idea how to fix it?

Cheers

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'

set :term_mode, nil
set :domain, 'mydomain.com'
set :rails_env, 'production'
set :deploy_to, "/home/user/rails/myapp/#{rails_env}"
set :repository, 'mygit'
set :app_path,   "#{deploy_to}/#{current_path}"

set :branch, 'master'
set :user, 'myuser'

# For system-wide RVM install.
set :rvm_path, '/usr/local/rvm/scripts/rvm'

set :shared_paths, ['config/database.yml', 'config/secrets.yml', 'log']

set :port, '2242'     # SSH port number.
set :forward_agent, true     # SSH forward_agent.
task :environment do

  invoke :'rvm:use[ruby-2.3.0]'
end

task :setup => :environment do
  queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]

  queue! %[mkdir -p "#{deploy_to}/#{shared_path}/config"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/config"]

  queue! %[touch "#{deploy_to}/#{shared_path}/config/database.yml"]
  queue! %[touch "#{deploy_to}/#{shared_path}/config/secrets.yml"]
  queue  %[echo "-----> Be sure to edit '#{deploy_to}/#{shared_path}/config/database.yml' and 'secrets.yml'."]

  if repository
    repo_host = repository.split(%r{@|://}).last.split(%r{:|\/}).first
    repo_port = /:([0-9]+)/.match(repository) && /:([0-9]+)/.match(repository)[1] || '22'

    queue %[
      if ! ssh-keygen -H  -F #{repo_host} &>/dev/null; then
        ssh-keyscan -t rsa -p #{repo_port} -H #{repo_host} >> ~/.ssh/known_hosts
      fi
    ]
  end
end

desc "Deploys the current version to the server."
task :deploy => :environment do
  to :before_hook do
    # Put things to run locally before ssh
  end
  deploy do
    # Put things that will set up an empty directory into a fully set-up
    # instance of your project.
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'
    invoke :'deploy:cleanup'

    to :launch do      
      queue "mkdir -p #{deploy_to}/#{current_path}/tmp/"
      queue "touch #{deploy_to}/#{current_path}/tmp/restart.txt"
    end
  end
end


@d4be4st
Copy link
Member

d4be4st commented Nov 18, 2016

On ruby 2.3.0 you installed newest version of mina (1.0.x) which is not backwards compitable.

https://github.com/mina-deploy/mina/blob/master/docs/migrating.md

@d4be4st d4be4st closed this as completed Nov 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants