Giter Club home page Giter Club logo

thor's Introduction

Welcome to Rails

What's Rails?

Rails is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.

Understanding the MVC pattern is key to understanding Rails. MVC divides your application into three layers: Model, View, and Controller, each with a specific responsibility.

Model layer

The Model layer represents the domain model (such as Account, Product, Person, Post, etc.) and encapsulates the business logic specific to your application. In Rails, database-backed model classes are derived from ActiveRecord::Base. Active Record allows you to present the data from database rows as objects and embellish these data objects with business logic methods. Although most Rails models are backed by a database, models can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as provided by the Active Model module.

View layer

The View layer is composed of "templates" that are responsible for providing appropriate representations of your application's resources. Templates can come in a variety of formats, but most view templates are HTML with embedded Ruby code (ERB files). Views are typically rendered to generate a controller response or to generate the body of an email. In Rails, View generation is handled by Action View.

Controller layer

The Controller layer is responsible for handling incoming HTTP requests and providing a suitable response. Usually, this means returning HTML, but Rails controllers can also generate XML, JSON, PDFs, mobile-specific views, and more. Controllers load and manipulate models, and render view templates in order to generate the appropriate HTTP response. In Rails, incoming requests are routed by Action Dispatch to an appropriate controller, and controller classes are derived from ActionController::Base. Action Dispatch and Action Controller are bundled together in Action Pack.

Frameworks and libraries

Active Record, Active Model, Action Pack, and Action View can each be used independently outside Rails.

In addition to that, Rails also comes with:

  • Action Mailer, a library to generate and send emails
  • Action Mailbox, a library to receive emails within a Rails application
  • Active Job, a framework for declaring jobs and making them run on a variety of queuing backends
  • Action Cable, a framework to integrate WebSockets with a Rails application
  • Active Storage, a library to attach cloud and local files to Rails applications
  • Action Text, a library to handle rich text content
  • Active Support, a collection of utility classes and standard library extensions that are useful for Rails, and may also be used independently outside Rails

Getting Started

  1. Install Rails at the command prompt if you haven't yet:

    $ gem install rails
  2. At the command prompt, create a new Rails application:

    $ rails new myapp

    where "myapp" is the application name.

  3. Change directory to myapp and start the web server:

    $ cd myapp
    $ bin/rails server

    Run with --help or -h for options.

  4. Go to http://localhost:3000 and you'll see the Rails bootscreen with your Rails and Ruby versions.

  5. Follow the guidelines to start developing your application. You may find the following resources handy:

Contributing

We encourage you to contribute to Ruby on Rails! Please check out the Contributing to Ruby on Rails guide for guidelines about how to proceed. Join us!

Trying to report a possible security vulnerability in Rails? Please check out our security policy for guidelines about how to proceed.

Everyone interacting in Rails and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Rails code of conduct.

License

Ruby on Rails is released under the MIT License.

thor's People

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  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

thor's Issues

thor has a zero return code when task isn't found

(I hope this is the right place to submit issues. If it's not I'd be happy to resubmit in the appropriate place)

$ thor task doesnt exist
The thor:runner namespace doesn't have a `task' task
$ echo $?
0

This is an unsuccessful case, and the return code ought to be nonzero.

Add parameter dependency chain

It would be great to define dependencies between options, such as:

class_option :generate_migration, :type => :boolean
class_option :table, :type => :string :desc => 'Database table in which to operate', :depends => [:generate_migration]
class_option :add_columns, :type => :hash, :desc => 'Columns to add to table', :depends => [:table, :generate_migration]

Actually, the last example uses [:table, :generate_migration] just to illustrate, since :table itself depends already on :generate_migrations. Alternatively, :depends could also accept a symbol or string in case of a single dependency.

Additionally, an :assumes option would be also interesting. Suppose this statement:

class_option :table, :type => :string :desc => 'Database table in which to operate', :assumes => {:generate_migration => true}

In this case, passing a table option would assume generate_migration is set to true.

thor -T

I get this returned to me when asking for the Thor tasks.

[21:22][adamstacoviak@AS-MBP15:~/Code/OS/Thor/Thor-Gem(master)]$ thor -T
WARNING: unable to load thorfile "/Users/adamstacoviak/Code/OS/Thor/Thor-Gem/Thorfile": no such file to load -- rdoc/task

[21:25][adamstacoviak@AS-MBP15:~/Code/OS/Thor/Thor-Gem(master)]$ gem list rspec

*** LOCAL GEMS ***

rspec (1.2.9, 1.2.2)
rspec-rails (1.2.2)

Feature request: roll back/forward, similar to migrations

Running a generator results in updates to a project much like updates to a DB schema from migrations. It is often the case that you want to undo the result of a generator, fx rename or delete.
Why not have all the project affecting actions as Commands, with up and down methods?

Example: template could default to call Template.up which would also log the command in a command log (in the project) to be rolled back, in this case calling Template.down would delete the resulting file. I'll try to develop such a solution this week - spec driven this time!

Improve Windows compatibility

As Thor will be an important part of Rails 3, compatibility with Windows should be taken in consideration.

In the following gist you will find diff/patches to be applied over master that fix file operation and also increase the compatibility with Ruby 1.9.

http://gist.github.com/267357

On a side note, I noticed a lot of specs depends on successfully execution of previous one, making impossible ensure specs are doing what it suppose to (try executing with reverse options).

Cheers!

Subcommands with $thor_runner=false breaks help

I was working on a project that is using thor as a CLI. Since I'm not using the thor runner, I set $thor_runner to false so that I wouldn't see the namespaces. However, whenever I started using subcommands, I noticed that it wasn't displaying the primary command.

With "$thor_runner = false" I get:
~/Dev/slimgem/bin > ./slim
Tasks:
./slim help [COMMAND] # Describe subcommands or one specific subcommand
./slim help [TASK] # Describe available tasks or one specific task
./slim init # Creates a gem project using the active snapset.
./slim init # Creates a snapset.
./slim snapset # Allows the management of snapsets.

Without messing with $thor_runner I get:

~/Dev/slimgem/bin > ./slim help
Tasks:
  ./slim slimgem:c_l_i:help [TASK]             # Describe available tasks or ...
  ./slim slimgem:c_l_i:init                    # Creates a gem project using ...
  ./slim slimgem:c_l_i:snapset                 # Allows the management of sna...
  ./slim slimgem:c_l_i:snapset:help [COMMAND]  # Describe subcommands or one ...
  ./slim slimgem:c_l_i:snapset:init            # Creates a snapset.

The desired result would be:
~/Dev/slimgem/bin > ./slim help
Tasks:
./slim help [TASK] # Describe available tasks or ...
./slim init # Creates a gem project using ...
./slim snapset # Allows the management of sna...
./slim snapset help [COMMAND] # Describe subcommands or one ...
./slim snapset init # Creates a snapset.

Thor ArgumentError spec's that accept InvocationError

The commit hedgehog/thor@b406cb6 is part of resolving #12.
This patch exposes two spec's that incorrectly accept InvocationError although they claim to expect ArgumentError.
After applying the patch cited, running thor spec's reveals:

ArgumentError in 'Thor::Runner#start does not swallow Thor ArgumentError'
'animal' was called incorrectly. Are you sure it has arity equals to 0?
/usr/src/thor/spec/runner_spec.rb:88:
/usr/src/thor/spec/spec_helper.rb:29:in `capture'
/usr/src/thor/spec/runner_spec.rb:88:

ArgumentError in 'Thor#start raises an error if a required param is not provided'
'animal' was called incorrectly. Are you sure it has arity equals to 0?
/usr/src/thor/spec/thor_spec.rb:115:
/usr/src/thor/spec/spec_helper.rb:29:in `capture'
/usr/src/thor/spec/thor_spec.rb:115:

Broken in ruby 1.9.2

Thor does not work with ruby 1.9.2. It works fine on ruby 1.9.1 and 1.8.7.

ruby --version
ruby 1.9.2dev (2009-09-07 trunk 24787) [i386-darwin10.2.0]
thor
could not find Thor class or task 'help'

Inject

Hi,

it's possible in inject_into_file prevent to re-insert two times the same thing?

That's it's what I need to do for each inject:

          if options[:destroy] || !File.read(..).include?(...)
            inject_into_file ...,  "...", :after => ...
          end

default_app

Would it make sense to allow a default application to be specified like "default_app 'myapp'"? This way invoking thor without any arguments at all could default to a specific app and task (instead of listing available tasks), like rake.

Thor::Runner.start missing namespaces.

The list task in Thor::Runner doesn't print any namespaces just task names when $thor_runner is not true (e.g. another application).

For example:

module Foo
  class Bar < Thor
    desc 'bar', 'Bar'
    def bar
    end
  end

  class Baz < Thor
    desc 'baz', 'Baz'
    def baz
    end
  end
end

thor -T prints:

foo:bar
-------
thor foo:bar:bar  # Bar

foo:baz
-------
thor foo:baz:baz  # Baz

But calling Thor::Runner.start %w{-T} inside a script say 'test' will print:

foo:bar
-------
test bar  # Bar

foo:baz
-------
test baz  # Baz

This is a little confusing if you have tasks named the same thing in different namespaces.

Thor::Actions#apply fails for paths with spaces.

URI(path).is_a?(URI::HTTP) at lib/thor/actions.rb:198 is failing with paths like /Users/user/Projects/Project with Spaces/ as input with a URI::InvalidURIError: bad URI(is not URI?) exception.

paths to look for .thor files in is hardcoded

i'd like to be able to add to the array of glob patterns that thor looks for .thor files in. maybe a case for an ENV var in Thor::Util#globs_for(path) or a CLI option or something. currently, it's being limited to "#{path}", "#{path}/tasks", or "#{path}/lib/tasks".

Uninitialized constant Thor::Group when running thor commands

Hi,

Just installed Thor and when I try "thor list" or "thor installed" I get the following error:

/Users/mhfs/.rvm/gems/ruby-1.8.7-p248/gems/thor-0.13.0/lib/thor/runner.rb:258:in `display_klasses': uninitialized constant Thor::Group (NameError)
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/gems/thor-0.13.0/lib/thor/runner.rb:147:in `list'
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/gems/thor-0.13.0/lib/thor/task.rb:32:in `send'
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/gems/thor-0.13.0/lib/thor/task.rb:32:in `run'
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/gems/thor-0.13.0/lib/thor/invocation.rb:108
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/gems/thor-0.13.0/lib/thor/invocation.rb:115:in `call'
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/gems/thor-0.13.0/lib/thor/invocation.rb:115:in `invoke'
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/gems/thor-0.13.0/lib/thor.rb:137:in `start'
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/gems/thor-0.13.0/lib/thor/base.rb:369:in `start'
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/gems/thor-0.13.0/lib/thor.rb:124:in `start'
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/gems/thor-0.13.0/bin/thor:8
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/bin/thor:19:in `load'
from /Users/mhfs/.rvm/gems/ruby-1.8.7-p248/bin/thor:19

Thanks,
Marcelo

Thor::Runner needs to be improved

I created a thor task to generate a new thor task project and one to create a skeleton ruby project.
In both cases I have a templates dir with the template files for the template statement.
They both run fine locally, but when I install the gem, only the thor file itself seems to be installed, not its templates dir. This seems a reasonable default, but how do I then force thor to deploy other files/dirs as part of the thor task?
I think I might instead have to build a generator gem with binaries? Seems like thor is only suitable in the simplest cases?

Undefined method camelize

When running the thor example newgem, I am getting

(erb):3:in template': undefined methodcamelize' for ...

Underscores in method_options symbol names are ignored

eg method_options :name => :required, :repos => :string, :version_control => :boolean, :no_doc_type => :boolean, :no_pdf => :boolean, :unabridged => :boolean

The only options parsed are the ones without underscores. This used to work in 0.9.9. Any suggestions on how to use underscores in options?

"super called outside of method" exception with Thor 0.12.3.

I've been using Thor::Group and Thor::Actions to write custom generators for a project, "ronin-gen":http://github.com/postmodern/ronin-gen. As of Thor 0.12.3 I've noticed a strange exception being raised only under Ruby 1.8.7-p249. This exception is not raised under Ruby 1.9.1-p376 and all specs pass.

An example from the specs of ronin-gen:

NoMethodError in 'Ronin::Generators::Platform::Overlay before(:all)'
super called outside of method
/usr/lib64/ruby/gems/1.8/gems/thor-0.12.3/lib/thor/task.rb:32:in `send'
/usr/lib64/ruby/gems/1.8/gems/thor-0.12.3/lib/thor/task.rb:32:in `run'
/usr/lib64/ruby/gems/1.8/gems/thor-0.12.3/lib/thor/invocation.rb:108:in `invoke'
/usr/lib64/ruby/gems/1.8/gems/thor-0.12.3/lib/thor/task.rb:106:in `map'
/usr/lib64/ruby/gems/1.8/gems/thor-0.12.3/lib/thor/core_ext/ordered_hash.rb:75:in `each'
/usr/lib64/ruby/gems/1.8/gems/thor-0.12.3/lib/thor/invocation.rb:117:in `map'
/usr/lib64/ruby/gems/1.8/gems/thor-0.12.3/lib/thor/invocation.rb:117:in `invoke'
./spec/generators/platform/overlay_spec.rb:20:

run and in_root not working

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>'

Can't create a task without usage and description

Rake allows you to create "hidden" tasks which are pretty much tasks without descriptions. You can still invoke them but they don't show up in the task list (rake -T). I have a need for a non-printable task, is there a supported way to accomplish this?

Thor::Actions#apply fails for paths with spaces.

URI(path).is_a?(URI::HTTP) at lib/thor/actions.rb:198 is failing with paths like /Users/user/Projects/Project with Spaces/ as input with a URI::InvalidURIError: bad URI(is not URI?) exception.

Adding a default task breaks invocation behavior

Adding a default task (hedgehog/thor@d2d9d3c) breaks the invocation behavior.

The error report is

1)
Thor::InvocationError in 'Thor::Invocation#invoke invokes the default task if none is given to a Thor class'
'default' was called incorrectly. Call as 'b:default'
/usr/src/thor/spec/invocation_spec.rb:24:
/usr/src/thor/spec/spec_helper.rb:29:in `capture'
/usr/src/thor/spec/invocation_spec.rb:24:

and

2)
Thor::InvocationError in 'Thor::Invocation#invoke accepts a class as argument without a task to invoke'
'default' was called incorrectly. Call as 'b:default'
/usr/src/thor/spec/invocation_spec.rb:30:
/usr/src/thor/spec/spec_helper.rb:29:in `capture'
/usr/src/thor/spec/invocation_spec.rb:30:

This error remains even if the spec is changed to:
it "invokes the default task if none is given to a Thor class" do
content = capture(:stdout){ A.new.invoke("b:default") }
content.must =~ /Tasks/
content.must =~ /LAST_NAME/
end

task :my_task => :environment do

this isn't a bug, more a usage question - but I can't find any google group for this...

is there a way to include the Rails environment into Thor tasks, classes, etc similar to the rake method (in title)

destination_root not used by template function

Is there a reason why Thor::Actions::template does not use the destination_root for its destination argument? I thought it would since the documentation says: "relative path to the destination".

Am I misunderstanding the usage of template, or should one explicity pass in File.join(destination_root, filename) as the destination parameter?

Console redirection fails on 1.9.x

Running specs in Ruby 1.9 fails due console redirection (mock of $stdin and replacement of $stdout)

This is not an issue on 1.8.6 or 1.8.7

Thor should allow namespaces to be turned off

If you are writing a command line utility based on Thor, you don't need Thor to include information about the namespace when it prints usage and errors. For example:

$ bundle foo
The bundler:c_l_i namespace doesn't have a 'foo' task

It seems like it should work like this instead:

$ bundle foo
There is no 'foo' task

It would be very nice to have a way to tell Thor::Task that I don't want namespaces to be mentioned in messages.

Windows platform color codes and path issues.

On windows you need the win32console gem for the color codes to show up.

Also there is an error with the home path.
util.rb
212c212
< File.join(user_home, ".thor")
---
> File.join(user_home, ".thor").gsub('', '/')

Refactored and improved install and list tasks with better deployment features etc.

I have started to refactor the 'install' task in a major way, as it is getting too complex as it is.
Now it also allows for deploying tasks and their templates to special repositories, so as to allow development to be distinct from the deployed task and have all templates used in one location.

The deploy feature could be combined with my github_repo gem and github_thor_tasks, to deploy tasks and templates to a github repo instead ;)

I have also refactored and improved the 'list' task to display task groups correctly with their namespace.

See http://github.com/kristianmandrup/thor

PS: Install refactoring not completely tested yet...

invoking a group task w/ required option results in error

invoking a group task w/ required option results in an error: "no value provided for required options"
However, when the option is marked an not required, option is passed and accessible:

invoke "my:group:task", ["some_argument"], :required_option => "value" #=> will raise: no value provided for required options '--required-option'

Arbitrary code execution

Hi!

I just noticed:

Thor allows the execution of arbitrary code via any Thorfile. Just run
thor instance_eval "p 12"
This will cause thor to call the "instance_eval task" of the Thor object in that Thorfile.
Pretty devastating...
I'd suggest, thor limits the access to builtin functions via tasks, e.g. by using something like this little snippet here I found a while ago:
[http://snippets.dzone.com/posts/show/1873]
That would remove all the 'evil' method calls from the thor object.

Greetz!

Make task usage and description optional? (no "desc" for task)

Currently Thor only makes tasks out of methods described with "desc", and prints a warning for public methods without a description. Would it be possible to make "desc" optional, and make all public methods tasks (albeit with empty descriptions), without printing a warning?

A frequent use case is to create Thorfiles for private use where the method name is sufficient as documentation. Having to add the "desc" lines with empty usage and description is a nuisance when one wants to create small and compact Thorfiles.

help output: Order default runtime options

Sometimes the output is:

Runtime options:
  -p, [--pretend]  # Run but do not make any changes
  -q, [--quiet]    # Supress status output
  -s, [--skip]     # Skip files that already exist
  -f, [--force]    # Overwrite files that already exist

Other times:

Runtime options:
  -s, [--skip]     # Skip files that already exist
  -p, [--pretend]  # Run but do not make any changes
  -q, [--quiet]    # Supress status output
  -f, [--force]    # Overwrite files that already exist

Too many 'usage' methods.

This make debugging a more of a pita than it needs to be:

  • usage:task.rb
    • usage:option.rb
    • usage:argument.rb

and to round it out...

  • hsh.usage

Fine if you restain employing these methods to their declared files,
but when they are intertwined thoughout Thor it means that
reading << understanding code.

Inject into file from template

Would it be okay to add an option (or a new method) in order to inject content to a file/class but from an ERB rendered template?

No way to nicely change default task?

Hi there,

I'd love to use thor in my application, but I'd need it to do a default task when invoked without parameters. ATM it displays the help message in that case.
I was wondering, if there was a way of doing that nicely, since I may have overlooked it.

Right now, I'm doing this quick little workaround:
map 'help' => :real_help
def help _args
list(_args)
end
which will call the list() function when there were no arguments specified and the real_help function, whenever the the help command was given explicitly.

It would be really nice to be able to do something like
map :default => :list
or something similar to change the default task more nicely. My solution is quite hacky after all g

Anyways, thanks for this really great program, I'm definitely enjoying it.
Keep up the good work!

running specs in gem

Packaging thor for a Fedora submission and would like to run the specs as part of the build process. The stumbling block seems to be some key files are missing from the gem, eg:

mkent@fortaleza:~/git/thor/spec (master)$ find -type f | grep -v \.rb | grep -v sandbox
./fixtures/bundle/main.thor
./fixtures/doc/README
./fixtures/doc/components/.empty_directory
./fixtures/group.thor
./fixtures/invoke.thor
./fixtures/script.thor
./fixtures/task.thor
./spec.opts

Would it be possible to include these in the gem?

Feature Request: brace expansion argument (bash style)

Add option:

:brace_expansion => true/false

to

argument()  # applies just to this argument

When true the following syntax is supported

thor task a{1..3} arg2 
# equivalent to 
thor task a1 a2 a3 arg2

Example behaviors

a{1..3}{x..z}          # a1x a1y a1z a2x a2y a2z a3x a3y a3z
a{{a..c},b{1..3}}     # aa ab ac ab1 ab2 ab3
\\{X..d}         # \X \Y \Z \[ \ \] \^ \_ \` \a \b \c \d
{1..3}{x..z}", "      # 1x, 1y, 1z, 2x, 2y, 2z, 3x, 3y, 3z

Other behaviors people think will be useful?

More importantly: Does anyone know of a ruby library that has already implemented this?

errors when loading Thorfiles do not include stacktrace

Whenever errors/exceptions are encountered, only the error's type and message are displayed, excluding any sort of line information. For example, I had an uninitialized constant because I forgot to do a require, and I get this message:

WARNING: unable to load thorfile "/Users/technicalpickles/code/active/bedazzle/Thorfile": uninitialized constant Bedazzle::Build

I probably figure out this one just by looking at the code in Thorfile, but sometimes the error originates from code outside the code, and then it's basically impossible to debug.

It's a pretty easy fix to change thor to raise the error instead of putsing it. But the question remains, would this be acceptable for thor to do?

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.