ruby / ruby/rake

Perhaps prevent Rake from interpretting tasks beyond --

Open
#430 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.5k
Forks
650
Avg merge
6m
Merged PRs (30d)
3

Description

I extract task arguments directly from ARGV, beyond the -- string.

For example I do:

rake update_date -- _posts/xyz.markdown

And in the code I have the :update_date task extract the filename after --.

But to prevent Rake from interpreting arguments beyond --, I have to rerun it with with_aplication.

unless $_args_filtered || ARGV.empty?
  $_args_filtered = true
  app_args = ARGV.dup.take_while{ |a| a != "--" }

  unless app_args.size == ARGV.size
    Dir.chdir Rake.original_dir

    Rake.with_application do |application|
      application.run(app_args)
    end

    exit
  end
end

This is something I'd like to avoid if possible.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Rake's command-line argument parsing and handling of the -- separator. Compare the current behavior with the reported with_application workaround, then define how arguments after -- should reach the task without being interpreted or requiring a rerun. Done means the example command preserves _posts/xyz.markdown for the task while avoiding the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.