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

run and in_root not working #32

Closed
jhancock opened this issue Mar 10, 2010 · 4 comments
Closed

run and in_root not working #32

jhancock opened this issue Mar 10, 2010 · 4 comments

Comments

@jhancock
Copy link

example: http://gist.github.com/328329
Thor gem v 0.13.4

I'm trying to write some simple tasks with thor with no luck. See the above gist which tries to start and stop nginx. When I execute shell commands like cat #{nginx_pid_path} it works but when I try to use thor actions like run or in_root, I get errors (below). Why does action say() work, but run() does not?

: thor nginx:stop
/Users/jhancock/mhd/mhd.thor:17:in `stop': undefined method `run' for #<Thor::Sandbox::Nginx:0x7e675c> (NoMethodError)
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/task.rb:33:in `run'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/invocation.rb:109:in `block in invoke'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/invocation.rb:116:in `call'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/invocation.rb:116:in `invoke'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor.rb:137:in `block in start'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/base.rb:378:in `start'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor.rb:124:in `start'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/runner.rb:34:in `method_missing'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/task.rb:33:in `run'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/task.rb:13:in `run'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/invocation.rb:109:in `block in invoke'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/invocation.rb:116:in `call'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/invocation.rb:116:in `invoke'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor.rb:137:in `block in start'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor/base.rb:378:in `start'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/lib/thor.rb:124:in `start'
from /usr/local/ruby-191-p243/lib/ruby/gems/1.9.1/gems/thor-0.13.4/bin/thor:6:in `<top (required)>'
from /usr/local/ruby/bin/thor:19:in `load'
from /usr/local/ruby/bin/thor:19:in `<main>'
@kristianmandrup
Copy link

run works fine for me with my recent fork

require 'thor/group'
require 'active_support/inflector'

class Thorcat < Thor::Group
  include Thor::Actions

  # Define arguments and options
  argument :name

  def run_cat
    run "cat #{name}"    
  end                                                
  
end 


$ thor thorcat main.thor
         run  cat main.thor from "."
$

@josevalim
Copy link
Contributor

Can you please add a failing test case in Thor test suite?

@andrehjr
Copy link
Contributor

Actually this is not a bug... you just forgot to add 'include Thor::Actions'..

@josevalim
Copy link
Contributor

Yeah... closing.

This issue was closed.
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

4 participants