irt 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +26 -0
- data/LICENSE +20 -0
- data/README.markdown +589 -0
- data/Rakefile +60 -0
- data/VERSION +1 -0
- data/bin/irt +101 -0
- data/bin/irt_irb +4 -0
- data/bin/irt_rails2 +6 -0
- data/goodies/nano/README +6 -0
- data/goodies/nano/irt.nanorc +86 -0
- data/goodies/vi/README +5 -0
- data/irt.gemspec +29 -0
- data/irtrc +48 -0
- data/lib/irt.rb +143 -0
- data/lib/irt/commands/core.rb +52 -0
- data/lib/irt/commands/help.rb +111 -0
- data/lib/irt/commands/log.rb +52 -0
- data/lib/irt/commands/ri.rb +59 -0
- data/lib/irt/commands/system.rb +102 -0
- data/lib/irt/commands/test.rb +60 -0
- data/lib/irt/differ.rb +87 -0
- data/lib/irt/directives.rb +28 -0
- data/lib/irt/directives/test.rb +84 -0
- data/lib/irt/extensions/irb.rb +45 -0
- data/lib/irt/extensions/irb/commands.rb +42 -0
- data/lib/irt/extensions/irb/context.rb +147 -0
- data/lib/irt/extensions/kernel.rb +18 -0
- data/lib/irt/extensions/method.rb +36 -0
- data/lib/irt/extensions/object.rb +7 -0
- data/lib/irt/hunks.rb +111 -0
- data/lib/irt/init.rb +1 -0
- data/lib/irt/log.rb +94 -0
- data/lib/irt/session.rb +59 -0
- metadata +167 -0
data/Rakefile
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
name = 'irt'
|
2
|
+
|
3
|
+
def ensure_clean(action, force=false)
|
4
|
+
if !force && ! `git status -s`.empty?
|
5
|
+
puts <<-EOS.gsub(/^ {6}/, '')
|
6
|
+
Rake task aborted: the working tree is dirty!
|
7
|
+
If you know what you are doing you can use \`rake #{action}[force]\`"
|
8
|
+
EOS
|
9
|
+
exit(1)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Install the gem"
|
14
|
+
task :install, :force do |t, args|
|
15
|
+
ensure_clean(:install, args.force)
|
16
|
+
orig_version = version = File.read('VERSION').strip
|
17
|
+
begin
|
18
|
+
commit_id = `git log -1 --format="%h" HEAD`.strip
|
19
|
+
version = "#{orig_version}.#{commit_id}"
|
20
|
+
File.open('VERSION', 'w') {|f| f.puts version }
|
21
|
+
gem_name = "#{name}-#{version}.gem"
|
22
|
+
sh %(gem build #{name}.gemspec)
|
23
|
+
sh %(gem install #{gem_name} --local)
|
24
|
+
puts <<-EOS.gsub(/^ {6}/, '')
|
25
|
+
|
26
|
+
*******************************************************************************
|
27
|
+
* NOTICE *
|
28
|
+
*******************************************************************************
|
29
|
+
* The version id of locally installed gems is comparable to a --pre version: *
|
30
|
+
* i.e. it is alphabetically ordered (not numerically ordered), besides it *
|
31
|
+
* includes the sah1 commit id which is not aphabetically ordered, so be sure *
|
32
|
+
* your application picks the version you really intend to use *
|
33
|
+
*******************************************************************************
|
34
|
+
|
35
|
+
EOS
|
36
|
+
ensure
|
37
|
+
remove_entry_secure gem_name, true
|
38
|
+
File.open('VERSION', 'w') {|f| f.puts orig_version }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
desc %(Remove all the "#{name}" installed gems and executables and install this version)
|
43
|
+
task :clean_install, :force do |t, args|
|
44
|
+
ensure_clean(:install, args.force)
|
45
|
+
sh %(gem uninstall #{name} --all --ignore-dependencies --executables)
|
46
|
+
Rake::Task['install'].invoke(args.force)
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Push the gem to rubygems.org"
|
50
|
+
task :push, :force do |t, args|
|
51
|
+
begin
|
52
|
+
ensure_clean(:push, args.force)
|
53
|
+
version = File.read('VERSION').strip
|
54
|
+
gem_name = "#{name}-#{version}.gem"
|
55
|
+
sh %(gem build #{name}.gemspec)
|
56
|
+
sh %(gem push #{gem_name})
|
57
|
+
ensure
|
58
|
+
remove_entry_secure gem_name, true
|
59
|
+
end
|
60
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.1.1
|
data/bin/irt
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'irt'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'tempfile'
|
7
|
+
require 'optparse'
|
8
|
+
|
9
|
+
|
10
|
+
copy = "irt #{IRT::VERSION} (c) 2010-2011 Domizio Demichelis".log_color.bold
|
11
|
+
|
12
|
+
options = {}
|
13
|
+
|
14
|
+
optparse = OptionParser.new do |opts|
|
15
|
+
|
16
|
+
opts.banner = <<EOB
|
17
|
+
Interactive Ruby Tools:
|
18
|
+
Improved irb and rails console with lots of easy and powerful tools.
|
19
|
+
Usage:
|
20
|
+
irt [PATH] [options]
|
21
|
+
Options:
|
22
|
+
EOB
|
23
|
+
|
24
|
+
options[:interactive_eof]
|
25
|
+
opts.on( '-i', '--interactive-eof', 'Opens an interactive session at EOF') do
|
26
|
+
options[:interactive_eof] = true
|
27
|
+
end
|
28
|
+
|
29
|
+
options[:irb_options] = nil
|
30
|
+
opts.on( '-b', '--irb-options [OPTIONS]', 'Sets the irb Options' ) do |opt|
|
31
|
+
options[:irb_options] = opt
|
32
|
+
end
|
33
|
+
|
34
|
+
options[:rails_env] = 'development'
|
35
|
+
opts.on( '-r', '--rails-env [ENVIRONMENT]', 'Sets the Rails Environment' ) do |env|
|
36
|
+
options[:rails_env] = env
|
37
|
+
end
|
38
|
+
|
39
|
+
opts.on( '-v', '--version', 'Shows the version and exits' ) do
|
40
|
+
puts IRT::VERSION
|
41
|
+
exit
|
42
|
+
end
|
43
|
+
|
44
|
+
opts.on( '-h', '--help', 'Display this screen' ) do
|
45
|
+
puts copy
|
46
|
+
puts opts
|
47
|
+
exit
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
optparse.parse!
|
53
|
+
|
54
|
+
puts copy
|
55
|
+
|
56
|
+
paths = if ARGV.empty?
|
57
|
+
options[:interactive_eof] = true
|
58
|
+
[ Tempfile.new(%w[tmp- .irt]).path ]
|
59
|
+
else
|
60
|
+
ARGV.map {|p| File.expand_path(p) }
|
61
|
+
end
|
62
|
+
|
63
|
+
files = paths.map do |path|
|
64
|
+
unless File.exists?(path)
|
65
|
+
next if IRT.prompter.no? %(Do you want to create the file "#{path}"?), :hint => '[<enter=y|n]', :default => 'y'
|
66
|
+
options[:interactive_eof] = true
|
67
|
+
dirname = File.dirname(path)
|
68
|
+
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
69
|
+
FileUtils.touch(path)
|
70
|
+
end
|
71
|
+
File.directory?(path) ? Dir.glob(File.join(path, '**/*.irt')) : path
|
72
|
+
end.flatten
|
73
|
+
|
74
|
+
if files.empty?
|
75
|
+
puts 'No *.irt files to run'
|
76
|
+
exit
|
77
|
+
end
|
78
|
+
|
79
|
+
cmd_format = if File.exists?('./config/environment.rb')
|
80
|
+
if File.exists?('./script/rails')
|
81
|
+
'rails c %s %s %s'
|
82
|
+
elsif File.exists?('./script/console')
|
83
|
+
'ruby script/console --irb="irt_rails2"'
|
84
|
+
end
|
85
|
+
else
|
86
|
+
'irt_irb %s %s'
|
87
|
+
end
|
88
|
+
|
89
|
+
if cmd_format.match(/^ruby script\/console/)
|
90
|
+
ENV['RAILS_ENV'] ||= options[:rails_env]
|
91
|
+
end
|
92
|
+
|
93
|
+
ENV['IRT_INTERACTIVE_EOF'] = options[:interactive_eof].inspect if options[:interactive_eof]
|
94
|
+
|
95
|
+
files.each do |file|
|
96
|
+
ENV['IRT_COMMAND'] = sprintf cmd_format, file, options[:irb_options], options[:rails_env]
|
97
|
+
unless system(ENV['IRT_COMMAND'])
|
98
|
+
puts "\e[0m" if Colorer.color
|
99
|
+
exit(1)
|
100
|
+
end
|
101
|
+
end
|
data/bin/irt_irb
ADDED
data/bin/irt_rails2
ADDED
data/goodies/nano/README
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Ruby syntax file with additional irt keywords - Distributed with the irt gem
|
2
|
+
# The regular expressions in this file have been copied
|
3
|
+
# and adapted from many sources
|
4
|
+
|
5
|
+
# Automatically use for '.rb' and '.irt' files
|
6
|
+
syntax "ruby" ".*\.*(rb|irt)$"
|
7
|
+
|
8
|
+
# Shebang
|
9
|
+
color brightcyan "^#!.*"
|
10
|
+
|
11
|
+
# Operators
|
12
|
+
color brightmagenta "\<not\>|\<and\>|\<or\>"
|
13
|
+
color brightmagenta "\*\*|!|~|\*|/|%|\+|-|&|<<|>>|\|\^|>|>=|<|<="
|
14
|
+
color brightmagenta "<=>|\|\||!=|=~|!~|&&|\+=|-=|=|\.\.|\.\.\."
|
15
|
+
|
16
|
+
# Keywords
|
17
|
+
color brightmagenta "\<(BEGIN|END|alias|and|begin|break|case)\>"
|
18
|
+
color brightmagenta "\<(class|def|defined|do|else|elsif|end)\>"
|
19
|
+
color brightmagenta "\<(ensure|for|if|in|module|next|not|or|redo)\>"
|
20
|
+
color brightmagenta "\<(rescue|retry|return|self|super|then|undef)\>"
|
21
|
+
color brightmagenta "\<(unless|until|when|while|yield)\>"
|
22
|
+
|
23
|
+
# Load
|
24
|
+
color brightgreen "\<(load|require)\>"
|
25
|
+
|
26
|
+
# FILE LINE END and similar markers
|
27
|
+
color brightyellow "\<__[A-Z_]+__\>"
|
28
|
+
|
29
|
+
# irt Keywords
|
30
|
+
color brightmagenta "\<(_eql|_yaml_eql|last_value_eql|last_yaml_eql)\?"
|
31
|
+
color brightmagenta "\<(desc|irt|capture|irt_at_exit|eval_file|insert_file)\>"
|
32
|
+
|
33
|
+
# Constants
|
34
|
+
color brightblue "(\$)?\<[A-Z]+[0-9A-Z_a-z]*\>"
|
35
|
+
color brightblue "::[A-Z]"
|
36
|
+
|
37
|
+
# Predefined Constants
|
38
|
+
color brightred "\<(TRUE|FALSE|NIL|STDIN|STDOUT|STDERR|ENV|ARGF|ARGV|DATA|RUBY_VERSION|RUBY_RELEASE_DATE|RUBY_PLATFORM)\>"
|
39
|
+
|
40
|
+
# Predefined Variables
|
41
|
+
color brightred "\$[^A-Za-z]" "\$-.\>" "\$std(err|in|out)\>"
|
42
|
+
|
43
|
+
# Object Variables
|
44
|
+
color green "(@|@@)\<[^:][a-z]+[0-9A-Z_a-z]*\>"
|
45
|
+
|
46
|
+
# Symbols
|
47
|
+
icolor red "[^:]:\<[0-9A-Z_]+\>"
|
48
|
+
|
49
|
+
# false, nil, true
|
50
|
+
color yellow "\<(false|nil|true)\>"
|
51
|
+
|
52
|
+
# Above must not match 'nil?'
|
53
|
+
color red "\<nil\?"
|
54
|
+
|
55
|
+
# Iterators
|
56
|
+
color brightgreen "\|\w*\|"
|
57
|
+
|
58
|
+
# Regular expressions
|
59
|
+
# color green "/(\\.|[^\\/])*/[imox]*"
|
60
|
+
|
61
|
+
## Regular expressions
|
62
|
+
color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
|
63
|
+
|
64
|
+
# Shell command expansion is in `backticks` or like %x{this}.
|
65
|
+
color cyan "`[^`]*`" "%x\{[^}]*\}"
|
66
|
+
|
67
|
+
## Strings, double-quoted
|
68
|
+
color brightcyan ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
|
69
|
+
|
70
|
+
## Strings, single-quoted
|
71
|
+
color cyan "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
|
72
|
+
|
73
|
+
# Escapes
|
74
|
+
color red "\\[0-7][0-7][0-7]|\\x[0-9a-fA-F][0-9a-fA-F]"
|
75
|
+
color red "\\[abefnrs]"
|
76
|
+
color red "(\\c|\\C-|\\M-|\\M-\\C-)."
|
77
|
+
|
78
|
+
# Expression substitution
|
79
|
+
color green "#\{[^}]*\}"
|
80
|
+
|
81
|
+
# Comments
|
82
|
+
color cyan "#[^{].*$" "#$"
|
83
|
+
color brightcyan "##[^{].*$" "##$"
|
84
|
+
|
85
|
+
# Multiline comments
|
86
|
+
color cyan start="^=begin" end="^=end"
|
data/goodies/vi/README
ADDED
data/irt.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
name = File.basename( __FILE__, '.gemspec' )
|
2
|
+
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
|
7
|
+
s.authors = ["Domizio Demichelis"]
|
8
|
+
s.email = 'dd.nexus@gmail.com'
|
9
|
+
s.homepage = 'http://github.com/ddnexus/irt'
|
10
|
+
s.summary = 'Interactive Ruby Tools - Improved irb and rails console with a lot of easy and powerful tools.'
|
11
|
+
s.description = 'If you use IRT in place of irb or rails console, you will have more tools that will make your life a lot easier.'
|
12
|
+
|
13
|
+
s.add_runtime_dependency('differ', [">= 0.1.1"])
|
14
|
+
s.add_runtime_dependency('colorer', [">= 0.7.0"])
|
15
|
+
s.add_runtime_dependency('prompter', [">= 0.1.1"])
|
16
|
+
s.add_runtime_dependency('fastri', [">= 0.3.1.1"])
|
17
|
+
|
18
|
+
s.executables = ['irt', 'irt_irb', 'irt_rails2']
|
19
|
+
s.files = `git ls-files -z`.split("\0") - %w[irt-tutorial.pdf]
|
20
|
+
|
21
|
+
s.name = name
|
22
|
+
s.version = version
|
23
|
+
s.date = Date.today.to_s
|
24
|
+
|
25
|
+
s.required_rubygems_version = ">= 1.3.6"
|
26
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
|
29
|
+
end
|
data/irtrc
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# IRT RC file
|
2
|
+
# ITR conf options
|
3
|
+
|
4
|
+
# set this to true if your prompt get messed up when you use the history
|
5
|
+
# IRT.fix_readline_prompt = false
|
6
|
+
|
7
|
+
# will open an interactie session if a test has diffs
|
8
|
+
# IRT.irt_on_diffs = true
|
9
|
+
|
10
|
+
# will print the log tail when an interactive session is opened
|
11
|
+
# IRT.tail_on_irt = false
|
12
|
+
|
13
|
+
# the lines you want to be printed as the tail
|
14
|
+
# IRT.log.tail_size = 10
|
15
|
+
|
16
|
+
# loads irt_helper.rb files automatically
|
17
|
+
# IRT.autoload_helper_files = true
|
18
|
+
|
19
|
+
# force true/false regardless the terminal ANSI support
|
20
|
+
# IRT.force_color = true
|
21
|
+
|
22
|
+
# the command that should set the clipboard to the last lines from STDIN
|
23
|
+
# default to 'pbcopy' on mac, 'xclip -selection c' on linux/unix and 'clip' on windoze
|
24
|
+
# IRT.copy_to_clipboard_command = 'your command'
|
25
|
+
|
26
|
+
# the format to build the command to launch nano
|
27
|
+
# IRT.nano_command_format = 'nano +%2$d %1$s'
|
28
|
+
|
29
|
+
# the format to build the command to launch vi
|
30
|
+
# IRT.vi_command_format ="vi -c 'startinsert' %1$s +%2$d"
|
31
|
+
|
32
|
+
# the format to build the command to launch the ri tool
|
33
|
+
# IRT.ri_command_format = "qri -f #{Colorer.color? ? 'ansi' : 'plain'} %s"
|
34
|
+
|
35
|
+
# add your command format if you want to use another editor than nano or vi
|
36
|
+
# default 'open -t %1$s' on MacOX; 'kde-open %1$s' or 'gnome-open %1$s' un unix/linux; '%1$s' on windoze
|
37
|
+
# IRT.edit_command_format ="your_preferred_GUI_editor %1$s +%2$d"
|
38
|
+
|
39
|
+
# any log-ignored-echo command you want to add
|
40
|
+
# IRT.log.ignored_echo_commands << %w[commandA commandB ...]
|
41
|
+
|
42
|
+
# any log-ignored command you want to add (includes all the log-ignored-echo commands)
|
43
|
+
# IRT.log.ignored_commands << %w[commandC commandD ...]
|
44
|
+
|
45
|
+
# any command that will not set the last value (includes all the log-ignored commands)
|
46
|
+
# IRT.log.non_setting_commands << %w[commandE commandF ...]
|
47
|
+
|
48
|
+
# add your stuff here
|
data/lib/irt.rb
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
begin
|
3
|
+
require 'ap'
|
4
|
+
rescue LoadError
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'pp'
|
8
|
+
require 'yaml'
|
9
|
+
require 'rbconfig'
|
10
|
+
require 'pathname'
|
11
|
+
require 'irt/extensions/kernel'
|
12
|
+
require 'irt/extensions/object'
|
13
|
+
require 'irt/extensions/method'
|
14
|
+
require 'irt/extensions/irb'
|
15
|
+
require 'irb/completion'
|
16
|
+
require 'colorer'
|
17
|
+
require 'irt/log'
|
18
|
+
require 'irt/hunks'
|
19
|
+
require 'irt/differ'
|
20
|
+
require 'irt/directives'
|
21
|
+
require 'irt/session'
|
22
|
+
|
23
|
+
module IRT
|
24
|
+
|
25
|
+
VERSION = File.read(File.expand_path('../../VERSION', __FILE__)).strip
|
26
|
+
|
27
|
+
class IndexError < RuntimeError ; end
|
28
|
+
class SessionModeError < RuntimeError ; end
|
29
|
+
class ArgumentTypeError < RuntimeError ; end
|
30
|
+
class NotImplementedError < RuntimeError ; end
|
31
|
+
|
32
|
+
extend self
|
33
|
+
|
34
|
+
attr_accessor :irt_on_diffs, :tail_on_irt, :fix_readline_prompt, :debug,
|
35
|
+
:full_exit, :exception_raised, :session_no, :autoload_helper_files,
|
36
|
+
:copy_to_clipboard_command, :nano_command_format, :vi_command_format, :edit_command_format, :ri_command_format
|
37
|
+
attr_reader :log, :irt_file, :differ, :os
|
38
|
+
|
39
|
+
Colorer.def_custom_styles :bold => :bold,
|
40
|
+
:reversed => :reversed,
|
41
|
+
:null => :clear,
|
42
|
+
|
43
|
+
:log_color => :blue,
|
44
|
+
:file_color => :cyan,
|
45
|
+
:interactive_color => :magenta,
|
46
|
+
:inspect_color => :clear,
|
47
|
+
:binding_color => :yellow,
|
48
|
+
:actual_color => :green,
|
49
|
+
:ignored_color => :yellow,
|
50
|
+
|
51
|
+
:error_color => :red,
|
52
|
+
:ok_color => :green,
|
53
|
+
:diff_color => :yellow,
|
54
|
+
:diff_a_color => :cyan,
|
55
|
+
:diff_b_color => :green
|
56
|
+
|
57
|
+
def force_color=(bool)
|
58
|
+
Colorer.color = bool
|
59
|
+
end
|
60
|
+
|
61
|
+
def init
|
62
|
+
@session_no = 0
|
63
|
+
@differ = IRT::Differ
|
64
|
+
@irt_on_diffs = true
|
65
|
+
@tail_on_irt = false
|
66
|
+
@fix_readline_prompt = false
|
67
|
+
@autoload_helper_files = true
|
68
|
+
@os = get_os
|
69
|
+
@copy_to_clipboard_command = case @os
|
70
|
+
when :windows
|
71
|
+
'clip'
|
72
|
+
when :macosx
|
73
|
+
'pbcopy'
|
74
|
+
when :linux, :unix
|
75
|
+
'xclip -selection c'
|
76
|
+
end
|
77
|
+
@edit_command_format = case @os
|
78
|
+
when :windows
|
79
|
+
'%1$s'
|
80
|
+
when :macosx
|
81
|
+
'open -t %1$s'
|
82
|
+
when :linux, :unix
|
83
|
+
case ENV['DESKTOP_SESSION']
|
84
|
+
when /kde/i
|
85
|
+
'kde-open %1$s'
|
86
|
+
when /gnome/i
|
87
|
+
'gnome-open %1$s'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
@vi_command_format = "vi -c 'startinsert' %1$s +%2$d"
|
91
|
+
@nano_command_format = 'nano +%2$d %1$s'
|
92
|
+
@ri_command_format = "qri -f #{Colorer.color? ? 'ansi' : 'plain'} %s"
|
93
|
+
@debug = false
|
94
|
+
end
|
95
|
+
|
96
|
+
def init_files
|
97
|
+
@irt_file = IRB.conf[:SCRIPT]
|
98
|
+
@log = Log.new
|
99
|
+
@log.print_running_file
|
100
|
+
IRT::Directives.load_helper_files
|
101
|
+
end
|
102
|
+
|
103
|
+
def lib_path
|
104
|
+
File.expand_path '../../lib', __FILE__
|
105
|
+
end
|
106
|
+
|
107
|
+
# this fixes a little imperfection of the YAML::dump method
|
108
|
+
# which adds a space at the end of the class
|
109
|
+
def yaml_dump(val)
|
110
|
+
yml = "\n" + YAML.dump(val)
|
111
|
+
yml.gsub(/ +\n/, "\n")
|
112
|
+
end
|
113
|
+
|
114
|
+
def prompter
|
115
|
+
@prompter ||= begin
|
116
|
+
require 'prompter'
|
117
|
+
pr = Prompter.new
|
118
|
+
def pr.say_echo(result, opts={})
|
119
|
+
opts = {:style => :ignored_color}.merge opts
|
120
|
+
say ' #> ' + result.inspect, opts
|
121
|
+
end
|
122
|
+
pr
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
private
|
127
|
+
|
128
|
+
def get_os
|
129
|
+
case RbConfig::CONFIG['host_os']
|
130
|
+
when /mswin|msys|mingw32|windows/i
|
131
|
+
:windows
|
132
|
+
when /darwin|mac os/i
|
133
|
+
:macosx
|
134
|
+
when /linux/i
|
135
|
+
:linux
|
136
|
+
when /solaris|bsd/i
|
137
|
+
:unix
|
138
|
+
else
|
139
|
+
:unknown
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|