Skip to content

NoMethodError: undefined method `to' for main:Object #522

Description

@wonderer007

Last time I deployed my code with this deploy.rb it worked fine but at the moment but not its giving me error

mina aborted!
NoMethodError: undefined method `to' for main:Object
/Users/haiderali/Development/SalonApp/config/deploy.rb:104:in `block (2 levels) in <top (required)>'
/Users/haiderali/.rvm/gems/ruby-2.3.0/gems/mina-1.0.6/lib/mina/helpers/internal.rb:7:in `deploy_script'
/Users/haiderali/.rvm/gems/ruby-2.3.0/gems/mina-1.0.6/lib/mina/dsl.rb:50:in `block in deploy'
/Users/haiderali/.rvm/gems/ruby-2.3.0/gems/mina-1.0.6/lib/mina/dsl.rb:29:in `run'
/Users/haiderali/.rvm/gems/ruby-2.3.0/gems/mina-1.0.6/lib/mina/dsl.rb:49:in `deploy'
/Users/haiderali/Development/SalonApp/config/deploy.rb:94:in `block in <top (required)>'
/Users/haiderali/.rvm/gems/ruby-2.3.0/gems/mina-1.0.6/lib/mina/application.rb:16:in `run'
/Users/haiderali/.rvm/gems/ruby-2.3.0/gems/mina-1.0.6/bin/mina:4:in `<top (required)>'
/Users/haiderali/.rvm/gems/ruby-2.3.0/bin/mina:23:in `load'
/Users/haiderali/.rvm/gems/ruby-2.3.0/bin/mina:23:in `<main>'
/Users/haiderali/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/Users/haiderali/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => deploy
(See full trace by running task with --trace

deploy.rb is

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/puma'
require 'mina/nginx'
# require 'mina/rbenv'  # for rbenv support. (http://rbenv.org)
require 'mina/rvm'    # for rvm support. (http://rvm.io)

# Basic settings:
#   domain       - The hostname to SSH to.
#   deploy_to    - Path to deploy into.
#   repository   - Git repo to clone from. (needed by mina/git)
#   branch       - Branch name to deploy. (needed by mina/git)

#set :rails_env, 'production'
set :domain, 'xx.xxx.xxx.xxx'
set :deploy_to, '/var/www/SalonApp'
set :repository, 'git@bitbucket.org:jalapenoapps/salonweb.git'
set :branch, 'deploy'

# For system-wide RVM install.
set :rvm_path, '/home/ubuntu/.rvm/bin/rvm'

# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, ['config/database.yml', 'config/secrets.yml', 'log', "tmp/sockets", "tmp/pids"]

set :user, 'ubuntu'
# set :port, '22'
set :ssh_options, '-A'

# Optional settings:
#   set :user, 'foobar'    # Username in the server to SSH to.
#   set :port, '30000'     # SSH port number.
#   set :forward_agent, true     # SSH forward_agent.

# This task is the environment that is loaded for most commands, such as
# `mina deploy` or `mina rake`.
task :environment do
  # If you're using rbenv, use this to load the rbenv environment.
  # Be sure to commit your .ruby-version or .rbenv-version to your repository.
  # invoke :'rbenv:load'

  # For those using RVM, use this to load an RVM version@gemset.
  invoke :'rvm:use', 'ruby-2.3.0@default'
end

# Put any custom mkdir's in here for when `mina setup` is ran.
# For Rails apps, we'll make some of the shared paths that are shared between
# all releases.
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}/tmp"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp"]

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

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

  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! %[touch "#{deploy_to}/#{shared_path}/config/nginx.conf"]


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

  # Puma needs a place to store its pid file and socket file.
  queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/sockets")
  queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/sockets")
  queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/pids")
  queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/pids")

  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
  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
#      invoke :'puma:restart'
      invoke :'puma:restart'
      invoke :'nginx:restart'
    end
  end
end

can anyone please spot the issue, I have google enough but no help
Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions