Giter Site home page Giter Site logo

rails-sh's Introduction

rails-sh

rails-sh is a mini shell for rails3 that provides a uniform and quick access to commands.

Install

$ gem install rails-sh

Usage

$ cd your-rails3-app
$ rails-sh

You can specify an environment as follows:

$ rails-sh test

Examples

Execute rake task:

rails> rake db:migrate

Generate a controller:

rails> rails generate controller foo bar
$ rails g controller foo bar
      create  app/controllers/foo_controller.rb
       route  get "foo/bar"
      invoke  erb
      create    app/views/foo
      create    app/views/foo/bar.html.erb
      invoke  test_unit
      create    test/functional/foo_controller_test.rb
      invoke  helper
      create    app/helpers/foo_helper.rb
      invoke    test_unit
      create      test/unit/helpers/foo_helper_test.rb

Run console:

rails> console

Commands

please type help

Configuration

rails-sh will try to load ‘~/railsshrc’ as configuration.

Example:

# ~/railsshrc
Rails::Sh::Command.define 'my_command' do |arg|
  puts "Execute my_command with arg(`#{arg}`)!"
end

TODO

Contributing to rails-sh

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 jugyo. See LICENSE.txt for further details.

rails-sh's People

Contributors

hasimo avatar milk1000cc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rails-sh's Issues

rails runner

rails-sh(yuvil.io)> rails runner "puts 1"
$ rails runner "puts 1"
/home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/railties-3.2.6/lib/rails/commands/runner.rb:53:in `eval': (eval):1: unterminated stri\
ng meets end of file (SyntaxError)
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/railties-3.2.6/lib/rails/commands/runner.rb:53:in `<top (required)>'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in \
require'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_depe\
ndency'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/railties-3.2.6/lib/rails/commands.rb:64:in `<top (required)>'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in \
require'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_depe\
ndency'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/rails-sh-1.5.2/lib/rails/sh/rails.rb:21:in `_invoke'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/rails-sh-1.5.2/lib/rails/sh/forkable.rb:23:in `block in invoke'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/rails-sh-1.5.2/lib/rails/sh/forkable.rb:10:in `fork'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/rails-sh-1.5.2/lib/rails/sh/forkable.rb:10:in `invoke'
  from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/rails-sh-1.5.2/lib/rails/sh/commands.rb:21:in `block in <top (required)>\
'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/rails-sh-1.5.2/lib/rails/sh.rb:51:in `call'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/rails-sh-1.5.2/lib/rails/sh.rb:51:in `execute'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/rails-sh-1.5.2/lib/rails/sh.rb:28:in `start'
        from /home/yuvilio/.rvm/gems/ruby-1.9.3-p194@yuviliosite/gems/rails-sh-1.5.2/bin/rails-sh:28:in `<top (required)>'
        from ./bin/rails-sh:16:in `load'
        from ./bin/rails-sh:16:in `<main>'
0.20694679sec
rails-sh(yuvil.io)> 

Using rails-sh 1.5.2

rake -T fails

Running rake -T from within rails-sh fails for me with:
/Users/arthur/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:1728:in []': Don't know how to build task '-T' (RuntimeError) from /Users/arthur/.rvm/gems/ruby-1.9.2-p0/gems/rails-sh-1.4.0/lib/rails/sh/rake.rb:36:in_invoke'
from /Users/arthur/.rvm/gems/ruby-1.9.2-p0/gems/rails-sh-1.4.0/lib/rails/sh/forkable.rb:8:in block in invoke' from /Users/arthur/.rvm/gems/ruby-1.9.2-p0/gems/rails-sh-1.4.0/lib/rails/sh/forkable.rb:6:infork'
from /Users/arthur/.rvm/gems/ruby-1.9.2-p0/gems/rails-sh-1.4.0/lib/rails/sh/forkable.rb:6:in invoke' from /Users/arthur/.rvm/gems/ruby-1.9.2-p0/gems/rails-sh-1.4.0/lib/rails/sh/commands.rb:29:inblock in <top (required)>'
from /Users/arthur/.rvm/gems/ruby-1.9.2-p0/gems/rails-sh-1.4.0/lib/rails/sh.rb:44:in call' from /Users/arthur/.rvm/gems/ruby-1.9.2-p0/gems/rails-sh-1.4.0/lib/rails/sh.rb:44:inexecute'
from /Users/arthur/.rvm/gems/ruby-1.9.2-p0/gems/rails-sh-1.4.0/lib/rails/sh.rb:25:in start' from /Users/arthur/.rvm/gems/ruby-1.9.2-p0/gems/rails-sh-1.4.0/bin/rails-sh:28:in<top (required)>'
from /Users/arthur/.rvm/gems/ruby-1.9.2-p0/bin/rails-sh:19:in load' from /Users/arthur/.rvm/gems/ruby-1.9.2-p0/bin/rails-sh:19:in

'

Completely beautiful project by the way. Thank you!

thor support

Would be lovely to use thor from the shell without having to pay the startup cost with each invocation.

"tasks" isn't working

I'm not sure why this is happening:

rails-sh(railsview)> tasks
Unknown show task mode: ''
/usr/lib/ruby/1.9.1/rake/application.rb:237:in `display_tasks_and_comments'
/home/epi/.gem/gems/rails-sh-1.5.2/lib/rails/sh/commands.rb:43:in `block in <top (required)>'
/home/epi/.gem/gems/rails-sh-1.5.2/lib/rails/sh.rb:51:in `call'
/home/epi/.gem/gems/rails-sh-1.5.2/lib/rails/sh.rb:51:in `execute'
/home/epi/.gem/gems/rails-sh-1.5.2/lib/rails/sh.rb:28:in `start'
/home/epi/.gem/gems/rails-sh-1.5.2/bin/rails-sh:28:in `<top (required)>'
/home/epi/.gem/bin/rails-sh:23:in `load'
/home/epi/.gem/bin/rails-sh:23:in `<main>'
rails-sh(railsview)> 

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.