Skip to content

If --eval option to bind executable is not provided - default to system(ARGV.pop) #1

@dolzenko

Description

@dolzenko

Basically I would like to write

rbind to 'lib/**/*.rb' 'rake spec'

instead of

rbind to 'lib/**/*.rb' -e 'system \"rake spec\"'

Does this seems reasonable?

Crude hack illustrating the concept:


diff --git a/bin/rbind b/bin/rbind
index 79bc0c6..faa9ebd 100644
--- a/bin/rbind
+++ b/bin/rbind
@@ -18,7 +18,9 @@ command :to do |c|
   c.example 'Bind to a file, and a directory of files', "rbind to stylesheets style.css -e 'puts file.path'"
   c.example 'Run specs when ruby files are modified', "rbind to 'lib/**/*.rb' -e 'system \"rake spec\"'"
   c.action do |args, options|
-    abort 'invalid option. --eval switch is required in order to perform any action on the bound file(s)' unless options.eval
+    unless options.eval
+      options.eval = "system('#{args.pop}')"
+    end    
     common_options options
     options.paths = args
     listener(options).run!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions