Class: Rake::Application
- Inherits:
-
Object
- Object
- Rake::Application
- Defined in:
- lib/raken.rb
Instance Method Summary collapse
- #_run ⇒ Object
- #_standard_rake_options ⇒ Object
- #keyworded(opt) ⇒ Object
- #pry_debug_alias(opt) ⇒ Object
- #run ⇒ Object
- #standard_rake_options ⇒ Object
Instance Method Details
#_run ⇒ Object
10 |
# File 'lib/raken.rb', line 10 alias_method :_run, :run |
#_standard_rake_options ⇒ Object
9 |
# File 'lib/raken.rb', line 9 alias_method :_standard_rake_options, :standard_rake_options |
#keyworded(opt) ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/raken.rb', line 45 def keyworded opt JSON.parse('{' + opt.gsub(/(\w+):/, '"\1":') + '}').tap do |hash| hash.keys.each do |k| v = hash.delete(k) hash[k.to_sym] = v end end rescue raise ArgumentError, "->#{opt}<- is not ruby keyword argument" end |
#pry_debug_alias(opt) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/raken.rb', line 56 def pry_debug_alias opt return unless opt {c: 'continue', s: 'step', n: 'next', f: 'finish'}.each_pair do |ali, cmd| Pry.commands.alias_command(ali, cmd) if opt.include?(ali.to_s) end Pry::Commands.command /^$/, "repeat last command" do _pry_.run_command Pry.history.to_a.last end if opt.include?('e') end |
#run ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/raken.rb', line 36 def run _run ensure tasks.each do |t| next unless t.beginning puts "#{t.name} #{t.beginning} -> #{t.ending} = #{t.duration}" end if .time end |
#standard_rake_options ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/raken.rb', line 12 def [ ['--time [all]', 'time tasks', lambda { |value| .time = value || true } ], ['--trace-tree OPTS', 'https://github.com/turnon/trace_tree', lambda { |value| .trace_tree = keyworded(value) } ], ['--pry [csnfe]', 'invoke pry-byebug before task. `csnf` to enable stepping alias and `e` to repeat last command by hitting Enter', lambda { |value| .pry_debug = true pry_debug_alias value } ] ] + end |