# File lib/hub/speedy_stdlib.rb, line 30 def URI(str) URI.parse(str) end
Aruba unnecessarily creates new Announcer instance on each invocation
# File features/support/env.rb, line 149 def announcer @announcer ||= super end
# File features/support/env.rb, line 110 def assert_command_run cmd cmd += "\n" unless cmd[-1..-1] == "\n" history.should include(cmd) end
# File features/support/env.rb, line 115 def edit_hub_config config = File.join(ENV['HOME'], '.config/hub') FileUtils.mkdir_p File.dirname(config) if File.exist? config data = YAML.load File.read(config) else data = {} end yield data File.open(config, 'w') { |cfg| cfg << YAML.dump(data) } end
# File features/support/env.rb, line 143 def empty_commit(message = nil) message ||= 'empty' run_silent "git commit --quiet -m '#{message}' --allow-empty" end
# File features/support/env.rb, line 101 def history histfile = File.join(ENV['HOME'], '.history') if File.exist? histfile File.readlines histfile else [] end end
# File test/hub_test.rb, line 16 def matches?(body, content_type = "") content_type = content_type.split(';').first if content_type.respond_to? :split matches_with_dumb_content_type(body, content_type) end
strip out the “charset” directive from Content-type value
override normalizing hash since it otherwise requires JSON
# File test/hub_test.rb, line 12 def normalize_hash(hash) hash end
# File features/support/env.rb, line 135 def run_silent cmd in_current_dir do command = SimpleCommand.run(cmd) command.should be_successful_command command.output end end
# File features/support/completion.rb, line 98 def set_shell(shell) @shell = shell end
# File features/support/completion.rb, line 127 def tmux_kill_pane system(*($tmux + ['kill-pane', '-t', tmux_pane])) if tmux_pane? end
# File features/support/completion.rb, line 109 def tmux_pane? defined?(@tmux_pane) && @tmux_pane end
# File features/support/completion.rb, line 113 def tmux_pane_contents system(*($tmux + ['capture-pane', '-t', tmux_pane])) %x#{$tmux.join(' ')} show-buffer`.rstrip end
# File features/support/completion.rb, line 118 def tmux_send_keys(*keys) system(*($tmux + ['send-keys', '-t', tmux_pane, *keys])) end
# File features/support/completion.rb, line 122 def tmux_send_tab @last_pane_contents = tmux_pane_contents tmux_send_keys('Tab') end
# File features/support/completion.rb, line 140 def tmux_wait_for_completion num_waited = 0 raise "tmux_send_tab not called first" unless defined? @last_pane_contents while tmux_pane_contents == @last_pane_contents if num_waited > 300 if block_given? then return yield else raise "timeout while waiting for completions to expand" end end sleep 0.01 num_waited += 1 end end
# File features/support/completion.rb, line 131 def tmux_wait_for_prompt num_waited = 0 while tmux_pane_contents !~ /\$\Z/ raise "timeout while waiting for shell prompt" if num_waited > 300 sleep 0.01 num_waited += 1 end end