ripl-fresh 0.1.2 → 0.2.0

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/.gemspec CHANGED
@@ -11,8 +11,10 @@ Gem::Specification.new do |s|
11
11
  s.summary = "Fresh Ruby Enhanced SHell"
12
12
  s.description = "Fresh Ruby Enhanced SHell automatically detects, if your current command should be Ruby or a system command."
13
13
  s.required_rubygems_version = ">= 1.3.6"
14
+ s.required_ruby_version = ">= 1.9"
14
15
  s.executables = ['ripl-fresh', 'fresh']
15
- s.add_dependency 'ripl', '>= 0.2.5'
16
+ s.add_dependency 'ripl', '>= 0.2.6'
17
+ s.add_dependency 'ripl-multi_line', '>= 0.2.0'
16
18
  s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
17
19
  s.extra_rdoc_files = ["README.rdoc", "LICENSE"]
18
20
  s.license = 'MIT'
data/CHANGELOG.rdoc CHANGED
@@ -1,2 +1,21 @@
1
+ == 0.2.0
2
+ * Better system command error handling
3
+ * Refactored command mode detection, changed configuration settings
4
+ * Now you can redirect system results to ruby vars using => variable
5
+ * Compatible with ripl-0.2.6 and ripl-multi_line-0.2.0
6
+ * No more Ruby 1.8 support!
7
+ * More little changes and doc updates
8
+
9
+ == 0.1.2
10
+ * Command mode detection changes
11
+ * Added flexible fresh_prompt configuration
12
+ * set config[:fresh_prompt] to :PS1 to get your shell prompt, thanks to fallwith
13
+ * Improved auto-completion
14
+
15
+ == 0.1.1
16
+ * Fixed cd command
17
+ * Changed command_mode detection (using PATH)
18
+ * Better autocompletion
19
+
1
20
  == 0.1.0
2
21
  * Initial release
data/README.rdoc CHANGED
@@ -26,23 +26,20 @@ Note, that it will also load your <tt>.irbrc</tt> file. To avoid this, you can d
26
26
 
27
27
  == Usage & configuration options
28
28
 
29
- For an example session, see {this blog entry}[http://rbjl.net/43-use-fresh-ruby-as-your-shell].
29
+ Just start the shell and play around, to get a fresh feeling. For an example session, see {this blog entry}[http://rbjl.net/43-use-fresh-ruby-as-your-shell].
30
30
 
31
- The main regexp to determine if the command should be interpreted as system command is similar to this one: <tt>/^[a-z_-]+\s+.*/i</tt> (match a single word followed by at least one space). It can be adjusted in <tt>Ripl.config[:fresh_match_regexp]</tt>.
31
+ The main regexp to determine if the command should be interpreted as system command is similar to this one: <tt>/^\\w+\\s+.*/</tt> (match a single word followed by at least one space). See below for details.
32
32
 
33
- If this regexp matches or the input is a single word <tt>([a-z_-]+)</tt>, _fresh_ searches through the <tt>Ripl.config[:fresh_ruby_words]</tt> array for exceptions that still should get interpreted as Ruby (e.g. <tt>def </tt>).
33
+ You can use the output of system commands and redirect it to a Ruby variable (or similar Ruby expression) like this:
34
34
 
35
- Then, the <tt>Ripl.config[:fresh_system_words]</tt> arrays is checked, if it contains the command. This array defaults to your <tt>ENV['PATH']</tt>. You can add your own system commands there.
35
+ ls => variable
36
36
 
37
- There is also a third kind of command mode (besides <tt>:ruby</tt> and <tt>:system</tt>): <tt>:mixed</tt>. They look and feel like system commands, but redirect to the Ruby method described by the first word. You can register them in <tt> Ripl.config[:fresh_mixed_words]</tt> (e.g. +cd+).
37
+ Please note: The "=> variable" part has to be at the line ending.
38
+ The output of the <tt>ls</tt> command is now stored as array in <tt>variable</tt> and can be used in the next line. There are three variations of this command:
39
+ * <tt>=>></tt> append result to the array specified (or create it)
40
+ * <tt>~></tt> use command as string instead of an array
41
+ * <tt>~>></tt> use command as string instead of an array and append (or create it)
38
42
 
39
- As a fallback, _fresh_ checks <tt>Kernel.respond_to?</tt>, if there is a ruby method with that name.
40
-
41
- If the regexp does match, but the command could not be found in any of the three word arrays, the command mode will be set to <tt>Ripl.config[:fresh_match_default]</tt> (<tt>:ruby</tt>). If the regexp does not match, <tt>Ripl.config[:fresh_default]</tt> is used (also defaults to <tt>:ruby</tt>).
42
-
43
- Of course, there is a way to explicitly set your command mode: You can prefix your input with a space to force Ruby mode as well as you can prefix it with <tt>^</tt> to force system mode. The strings used for this can be customized in <tt>Ripl.config[:fresh_system_prefix]</tt> and <tt>Ripl.config[:fresh_ruby_prefix]</tt>.
44
-
45
- You need to take a look at <tt>get_input</tt> method in the source file to 100% understand the command mode detection way.
46
43
 
47
44
  === Prompt
48
45
  There is <tt>Riplc.config[:fresh_prompt]</tt> option, which takes a wide range of possible values. You can pass in a proc or a direct string. Furthermore, you can pass a symbol to get one of the following:
@@ -52,26 +49,34 @@ There is <tt>Riplc.config[:fresh_prompt]</tt> option, which takes a wide range o
52
49
  * <tt>:irb</tt> - use irbs :PROMPT_I (if set)
53
50
  * <tt>:simple</tt> - ">> "
54
51
 
52
+ === Command mode determination
53
+
54
+ There are three different command modes: <tt>:ruby</tt>, <tt>:system</tt> and <tt>:mixed</tt>.
55
+
56
+ <tt>:ruby</tt> is usual Ruby, <tt>:system</tt> means system command and <tt>:mixed</tt> looks like system command, but is just redirected to the Ruby method with that name.
57
+
58
+ The input is matched against the regexps in <tt>Ripl.config[:fresh_patterns]</tt>. These regexps also contain named groups, to determine the command or if the command should be stored in a variable.
59
+
60
+ When a regexp has matched, the command is searched for in <tt>Ripl.config[:fresh_ruby_commands]</tt>, <tt>Ripl.config[:fresh_system_commands]</tt> and <tt>Ripl.config[:fresh_mixed_commands]</tt> (in this order).
61
+
62
+ The ruby command array contains some common Ruby words, e.g. <tt>def </tt>. The system command array is set to your <tt>ENV['PATH']</tt>. The mixed array currently contains only +cd+. You can adjust the arrays as you want to.
63
+
64
+ As a fallback, _fresh_ checks <tt>Kernel.respond_to?</tt>, if there is a ruby method with that name.
65
+
66
+ If the regexp did match, but the command could not be found in any of the three word arrays and <tt>respond_to?</tt> has not been successful, the command mode will be set to <tt>Ripl.config[:fresh_unknown_command_mode]</tt> (default <tt>:ruby</tt>). If the regexp did not match, <tt>Ripl.config[:fresh_default_mope]</tt> is used (default <tt>:ruby</tt>).
67
+
68
+ You need to take a look at <tt>get_input</tt> method in the source file to 100% understand the command mode detection way.
69
+
70
+ === Patterns
71
+
72
+ The <tt>Ripl.config[:fresh_patterns]</tt> contains three Regexps, which do the following:
73
+ * match <tt>^</tt> to force system mode
74
+ * match a single word
75
+ * match a word followed by a space
76
+
55
77
  === Defaults
56
78
 
57
- # prefixes
58
- Ripl.config[:fresh_system_prefix] = %w[^]
59
- Ripl.config[:fresh_ruby_prefix] = [' ']
60
- # word arrays
61
- Ripl.config[:fresh_ruby_words] = %w[begin case class def for if module undef unless until while puts warn print p pp ap raise fail loop require load lambda proc system]
62
- Ripl.config[:fresh_system_words] =
63
- ENV['PATH'].split(File::PATH_SEPARATOR).uniq.map {|e|
64
- File.directory?(e) ? Dir.entries(e) : []
65
- }.flatten.uniq - ['.', '..']
66
- Ripl.config[:fresh_mixed_words] = %w[cd]
67
- # main regexp
68
- Ripl.config[:fresh_match_regexp] = /^([a-z\/_-]+)\s+(?!(?:[=%*]|!=|\+=|-=|\/=))/i
69
- # regex matched but word not in one of the three arrays, possible values: :ruby, :system, :mixed
70
- Ripl.config[:fresh_match_default] = :ruby
71
- # regex did not match
72
- Ripl.config[:fresh_default] = :ruby
73
- # configure prompt
74
- Ripl.config[:fresh_prompt] = :default
79
+ See <tt>lib/ripl/fresh/config.rb</tt> for all configuration options and its defaults.
75
80
 
76
81
  == Customization
77
82
 
@@ -87,20 +92,20 @@ There are lots of things which can get better:
87
92
 
88
93
  * Improve auto-completion
89
94
  * More cool (and colorful?) <tt>:mixed</tt> Ruby commands
90
- * Improve interaction between system and Ruby commands
91
- * <tt>ripl-multi_line</tt> for system commands
92
- * Result of system commands should be available for ruby, not only printed to stdout
93
- * Respect "..." (single argument) for :mixed commands
94
- * Improve default configuration
95
+ * Respect "..." (single argument) for :mixed commands
95
96
  * Add tests
97
+ * Be compatible (and installable) with JRuby/Rubinius
96
98
  * Fresh ideas
97
99
 
98
100
  Feel free to fork in your improvements ;)
99
101
 
100
102
  == Other gems you might find interesting
101
103
 
102
- * {rush}[https://github.com/adamwiggins/rush] - Another Ruby shell, different concept
103
- * {ripl}[https://github.com/cldwalker/ripl] - An irb alternative, +fresh+ is based on it
104
+ * {rush}[https://github.com/adamwiggins/rush] - Another Ruby shell, different concept
105
+ * {ripl}[https://github.com/cldwalker/ripl] - An irb alternative, _fresh_ is based on it
106
+ * {rubsh}[https://github.com/danielb2/rubsh] - Some similar ideas
107
+ * {urchin}[https://github.com/Spakman/urchin] - More unix like approach
108
+ * {rubish}[https://github.com/hayeah/rubish] - And another approach
104
109
 
105
110
  == Copyright
106
111
 
data/Rakefile CHANGED
@@ -26,3 +26,10 @@ desc "Validate the gemspec"
26
26
  task :gemspec do
27
27
  gemspec.validate
28
28
  end
29
+
30
+ desc 'build dummy "fresh" gem'
31
+ task :dummy_gem do
32
+ sh "gem build fresh.gemspec"
33
+ FileUtils.mkdir_p 'pkg'
34
+ FileUtils.mv "fresh-#{gemspec.version}.gem", 'pkg'
35
+ end
@@ -1,5 +1,5 @@
1
1
  # no advanced auto completion, yet
2
- # todo: not only default options
2
+ # TODO meaningful, fine-tuned, good autocompletion
3
3
 
4
4
  require 'readline'
5
5
 
@@ -18,16 +18,15 @@ everything_completion = proc{ # TODO: improve
18
18
  }
19
19
 
20
20
 
21
- complete :on => Ripl.config[:fresh_match_regexp],
22
- :search => false,
23
- &file_completion
21
+ complete on: Regexp.union( *Ripl.config[:fresh_patterns].compact ),
22
+ search: false,
23
+ &file_completion
24
24
 
25
25
  # TODO fires only when space after ^
26
- complete :on => Ripl::Fresh.option_array_to_regexp( Ripl.config[:fresh_system_prefix] ),
27
- # :search => false,
28
- &system_command_completion
26
+ complete on: Ripl.config[:fresh_patterns][0],
27
+ &system_command_completion
29
28
 
30
- complete :on => /^[a-z\/_-]*/i,
31
- &everything_completion
29
+ complete on: /^[a-z\/_-]*/i,
30
+ &everything_completion
32
31
 
33
32
  # J-_-L
@@ -4,16 +4,11 @@ require 'fileutils'
4
4
  module Ripl
5
5
  module Fresh
6
6
  module Commands
7
- =begin
8
- def ls(path='.')
9
- Dir[ File.join( path, '*' )].map{|res| res =~ /^#{path}\/?/; $' }
10
- end
11
- alias dir ls
12
- =end
13
-
14
7
  def cd( path = File.expand_path('~') )
15
8
  new_last_path = FileUtils.pwd
16
- if path == '-'
9
+ if path =~ /^\.{3,}$/
10
+ path = File.join( %w[..] * ($&.size-1) )
11
+ elsif path == '-'
17
12
  if @last_path
18
13
  path = @last_path
19
14
  else
@@ -29,4 +24,6 @@ module Ripl
29
24
  end
30
25
  end
31
26
 
32
- Ripl::Commands.send :include, Ripl::Fresh::Commands if defined? Ripl::Commands
27
+ Ripl::Commands.send :include, Ripl::Fresh::Commands
28
+
29
+ # J-_-L
@@ -0,0 +1,41 @@
1
+ # configure prompt
2
+ Ripl.config[:fresh_prompt] = :default
3
+
4
+ # word arrays
5
+ Ripl.config[:fresh_ruby_commands] = %w[begin case class def for if module undef unless until while puts warn print p pp ap raise fail loop require load lambda proc]
6
+ Ripl.config[:fresh_system_commands] =
7
+ ENV['PATH'].split(File::PATH_SEPARATOR).uniq.map {|e|
8
+ File.directory?(e) ? Dir.entries(e) : []
9
+ }.flatten.uniq - ['.', '..']
10
+ Ripl.config[:fresh_mixed_commands] = %w[cd]
11
+
12
+ # a regex matched but command is not in one of the three arrays
13
+ # or regex did not match
14
+ # possible values: :ruby, :system, :mixed
15
+ Ripl.config[:fresh_unknown_command_mode] = :ruby
16
+ Ripl.config[:fresh_default_mode] = :ruby
17
+
18
+ # main regexes
19
+ # $<command>: whole command_line
20
+ # $<command_line>: only the system command (if possible)
21
+ # $<result_operator>: (optional) result operator
22
+ # $<result_storage>: (optional) variable to store command result
23
+ # $<force>: force system command prefix
24
+ # please note: although the main regexp looks pretty complicated, it's just an detailed version of
25
+ # /\w+\s+(=> \w)?/
26
+ force = '(?<force>[\^])'
27
+ command = '(?<command>[a-zA-Z\/_-]+)'
28
+ result_operator = '(?<result_operator>[=|~]>{1,2})'
29
+ result_storage = '(?<result_storage>[a-zA-Z@\$_][a-zA-Z0-9@_\[\]:"\']*)'
30
+ _store = "(?:#{ result_operator }\s*#{ result_storage })?" # matches for example: "=> here"
31
+ _anything_but_these = '(?!(?:[=%*]|!=|\+=|-=|\/=)).*?'
32
+
33
+ Ripl.config[:fresh_patterns] = [
34
+ /^#{ force }(?<command_line>.*?)#{ _store }$/, # [0] force system
35
+ nil, nil, nil, nil,
36
+ /^(?<command_line>#{ command })\s*#{ _store }$/, # [5] single word
37
+ nil, nil, nil, nil,
38
+ /^(?<command_line>#{ command }\s+#{ _anything_but_these })#{ _store }$/, # [10] command + space
39
+ ]
40
+
41
+ # J-_-L
@@ -1,17 +1,17 @@
1
- require 'socket'
2
- require 'etc'
3
-
4
1
  # save current prompt
5
- ripl_prompt = Ripl.config[:prompt] # TODO currently not working
2
+ ripl_prompt = Ripl.config[:prompt] # FIXME currently not working
6
3
 
7
4
  # setup default prompt
8
- default_prompt = proc{ |path|
5
+ default_prompt = proc{ |path = FileUtils.pwd|
9
6
  path.gsub! /#{ File.expand_path('~') }/, '~'
10
7
  path + '> '
11
8
  }
12
9
 
13
10
  # PS environment variable prompt
14
11
  ps_prompt = proc{ |prompt_number|
12
+ require 'socket'
13
+ require 'etc'
14
+
15
15
  prompt = ENV['PS' + prompt_number.to_s].dup
16
16
  prompt.gsub!('\a', '') # unsupported
17
17
  prompt.gsub!('\d', Time.now.strftime("%a %b %d"))
@@ -69,7 +69,7 @@ Ripl.config[:prompt] = proc{
69
69
 
70
70
  # call if proc or return directly
71
71
  if fp.respond_to? :call
72
- fp.arity == 1 ? fp[ FileUtils.pwd ] : fp.call
72
+ fp[ FileUtils.pwd ]
73
73
  else
74
74
  case fp
75
75
  when nil, false
@@ -78,7 +78,7 @@ Ripl.config[:prompt] = proc{
78
78
  fp
79
79
  else
80
80
  Ripl.config[:fresh_prompt] = :default
81
- default_proc.call[ FileUtils.pwd ]
81
+ default_proc.call
82
82
  end
83
83
  end
84
84
  }
data/lib/ripl/fresh.rb CHANGED
@@ -3,151 +3,132 @@ require 'fileutils'
3
3
 
4
4
  module Ripl
5
5
  module Fresh
6
- VERSION = '0.1.2'
7
-
8
- class << self
9
- # helper to parse options
10
- def option_array_to_regexp(option)
11
- case option
12
- when Regexp # note: some options still _have_ to be arrays
13
- option
14
- when Array, Set
15
- /^(#{
16
- option.map{ |char|
17
- Regexp.escape char.to_s
18
- }*'|'
19
- })/
20
- else
21
- option.to_s
22
- end
23
- end
6
+ VERSION = '0.2.0'
7
+
8
+ def before_loop
9
+ @command_mode = :ruby
10
+ @real_buffer = nil
11
+ super
12
+ # register bond completion
13
+ Ripl.config[:completion][:gems] ||= []
14
+ Ripl.config[:completion][:gems] << 'ripl-fresh'
24
15
  end
25
16
 
26
- module Shell
27
- # setup Fresh
28
- def before_loop
29
- @command_mode = :ruby
30
- super
31
- # register bond completion
32
- Ripl.config[:completion][:gems] ||= []
33
- Ripl.config[:completion][:gems] << 'ripl-fresh'
34
- end
35
-
36
- # determine @command_mode
37
- def get_input
38
- input = super
39
-
40
- return input if @buffer # ripl-multi_line
41
-
42
- @command_mode = case input
43
- # force system with a single ^
44
- when Ripl::Fresh.option_array_to_regexp( Ripl.config[:fresh_system_prefix] )
45
- input = input[$1.size..-1] # TODO refactor, too hacky?
17
+ # determine @command_mode
18
+ def get_input
19
+ command_line = super
20
+
21
+ # This case statement decides the command mode,
22
+ # and which part of the input should be used for what...
23
+ # Note: Regexp match groups are used!
24
+ @result_storage = @result_operator = nil
25
+
26
+ @command_mode = case command_line
27
+ # force ruby with a space
28
+ when /^ /
29
+ :ruby
30
+ # regexp match shell commands
31
+ when *Array( Ripl.config[:fresh_patterns] ).compact
32
+ command_line = $~[:command_line] if $~.names.include? 'command_line'
33
+ command = $~[:command] if $~.names.include? 'command'
34
+ @result_operator = $~[:result_operator] if $~.names.include? 'result_operator'
35
+ @result_storage = $~[:result_storage] if $~.names.include? 'result_storage'
36
+ forced = !! $~[:force] if $~.names.include? 'force'
37
+
38
+ if forced
46
39
  :system
47
- # force ruby with a space
48
- when Ripl::Fresh.option_array_to_regexp( Ripl.config[:fresh_ruby_prefix] )
49
- input = input[$1.size..-1]
40
+ elsif Ripl.config[:fresh_ruby_commands].include?( command )
41
+ :ruby
42
+ elsif Ripl.config[:fresh_mixed_commands].include?( command )
43
+ :mixed
44
+ elsif Ripl.config[:fresh_system_commands].include?( command )
45
+ :system
46
+ elsif Kernel.respond_to? command.to_sym
50
47
  :ruby
51
- # single words, and main regex to match shell commands
52
- when /^([a-z_-]+)$/i, Ripl.config[:fresh_match_regexp]
53
- if Ripl.config[:fresh_ruby_words].include?($1)
54
- :ruby
55
- elsif Ripl.config[:fresh_mixed_words].include?($1)
56
- :mixed
57
- elsif Ripl.config[:fresh_system_words].include?($1)
58
- :system
59
- elsif Kernel.respond_to? $1.to_sym
60
- :ruby
61
- else
62
- Ripl.config[:fresh_match_default]
63
- end
64
- # default is still ruby ;)
65
48
  else
66
- Ripl.config[:fresh_default]
49
+ Ripl.config[:fresh_unknown_command_mode]
67
50
  end
68
-
69
- input
51
+ else
52
+ Ripl.config[:fresh_default_mode]
70
53
  end
71
54
 
72
- # get result (depending on @command_mode)
73
- def loop_eval(input)
74
- if input == ''
75
- @command_mode = :system and return
76
- end
77
-
78
- case @command_mode
79
- when :system # execute command
80
- ret = system input
81
- case ret
82
- when false
83
- warn '[non-nil exit status]' # too verbose?
84
- when nil
85
- warn "[command error #{$?.exitstatus}]" # add message?
86
- end
87
- ret
88
-
89
- when :mixed # call the ruby method, but with shell style arguments
90
- m, *args = *input.split
91
- super "#{m}(*#{args.to_s})"
55
+ command_line
56
+ end
92
57
 
93
- else # good old :ruby
94
- super
95
- end
58
+ # get result (depending on @command_mode)
59
+ def loop_eval(input)
60
+ if input == ''
61
+ @command_mode = :system and return
96
62
  end
97
63
 
98
-
99
- # system commands don't have output values and Ruby is displayed normally
100
- def print_result(result)
101
- if @error_raised ||
102
- @command_mode == :system ||
103
- @command_mode == :mixed && (!result || result == '')
104
- # don't display anything
64
+ case @command_mode
65
+ when :system # generate ruby code to execute the command
66
+ if !@result_storage
67
+ ruby_command_code = "_ = system '#{ input }'\n"
105
68
  else
106
- super # puts(format_result(result))
69
+ temp_file = "/tmp/ripl-fresh_#{ rand 12345678901234567890 }"
70
+ ruby_command_code = "_ = system '#{ input } 2>&1', :out => '#{ temp_file }'\n"
71
+
72
+ # assign result to result storage variable
73
+ case @result_operator
74
+ when '=>', '=>>'
75
+ result_literal = "[]"
76
+ formatted_result = "File.read('#{ temp_file }').split($/)"
77
+ operator = @result_operator == '=>>' ? '+=' : '='
78
+ when '~>', '~>>'
79
+ result_literal = "''"
80
+ formatted_result = "File.read('#{ temp_file }')"
81
+ operator = @result_operator == '~>>' ? '<<' : '='
82
+ end
83
+ ruby_command_code << %Q%
84
+ #{ @result_storage } ||= #{ result_literal }
85
+ #{ @result_storage } #{ operator } #{ formatted_result }
86
+ FileUtils.rm '#{ temp_file }'
87
+ %
107
88
  end
108
- end
109
89
 
110
- # catch ctrl+c
111
- def loop_once(*args)
90
+ # ruby_command_code << "raise( SystemCallError.new $?.exitstatus ) if !_\n" # easy auto indent
91
+ ruby_command_code << "if !_
92
+ raise( SystemCallError.new $?.exitstatus )
93
+ end;"
94
+
95
+ super @input = "(#{ ruby_command_code })"
96
+
97
+ when :mixed # call the ruby method, but with shell style arguments TODO more shell like (e.g. "")
98
+ method_name, *args = *input.split
99
+ super @input = "#{ method_name }(*#{ args })"
100
+
101
+ else # good old :ruby
112
102
  super
113
- rescue Interrupt
114
- @buffer = @error_raised = nil
115
- puts '[C]'
116
- retry
103
+ end
104
+ end
105
+
106
+ # system commands don't have output values and Ruby is displayed normally
107
+ def print_result(result)
108
+ if @error_raised ||
109
+ @command_mode == :system ||
110
+ @command_mode == :mixed && (!result || result == '')
111
+ # don't display anything
112
+ else
113
+ super # puts(format_result(result))
117
114
  end
118
115
  end
119
116
  end
120
117
  end
121
118
 
122
- # hook in (and work around readline loading behaviour)
119
+ # load plugins and hook in (and work around readline loading behaviour)
123
120
  Ripl.config[:readline] = false
124
121
  require 'ripl/readline'
125
- Ripl::Shell.send :include, Ripl::Fresh::Shell
122
+ require 'ripl/multi_line'
123
+ Ripl::Shell.send :include, Ripl::Fresh
126
124
 
127
125
  # load :mixed commands
128
126
  require File.dirname(__FILE__) + '/fresh/commands'
129
127
 
130
- ## fresh config ###
131
-
132
- # prefixes
133
- Ripl.config[:fresh_system_prefix] = %w[^]
134
- Ripl.config[:fresh_ruby_prefix] = [' ']
135
- # word arrays
136
- Ripl.config[:fresh_ruby_words] = %w[begin case class def for if module undef unless until while puts warn print p pp ap raise fail loop require load lambda proc system]
137
- Ripl.config[:fresh_system_words] =
138
- ENV['PATH'].split(File::PATH_SEPARATOR).uniq.map {|e|
139
- File.directory?(e) ? Dir.entries(e) : []
140
- }.flatten.uniq - ['.', '..']
141
- Ripl.config[:fresh_mixed_words] = %w[cd]
142
- # main regexp
143
- Ripl.config[:fresh_match_regexp] = /^([a-z\/_-]+)\s+(?!(?:[=%*]|!=|\+=|-=|\/=))/i
144
- # regex matched but word not in one of the three arrays, possible values: :ruby, :system, :mixed
145
- Ripl.config[:fresh_match_default] = :ruby
146
- # regex did not match
147
- Ripl.config[:fresh_default] = :ruby
148
- # configure prompt
149
- Ripl.config[:fresh_prompt] = :default
128
+ # fresh config
129
+ require File.dirname(__FILE__) + '/fresh/config'
150
130
 
131
+ # fresh_prompt management
151
132
  require File.dirname(__FILE__) + '/fresh/prompt'
152
133
 
153
134
  # J-_-L
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
7
  - 2
9
- version: 0.1.2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan Lelis
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-25 00:00:00 +01:00
17
+ date: 2010-12-03 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -28,10 +28,25 @@ dependencies:
28
28
  segments:
29
29
  - 0
30
30
  - 2
31
- - 5
32
- version: 0.2.5
31
+ - 6
32
+ version: 0.2.6
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: ripl-multi_line
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 0
45
+ - 2
46
+ - 0
47
+ version: 0.2.0
48
+ type: :runtime
49
+ version_requirements: *id002
35
50
  description: Fresh Ruby Enhanced SHell automatically detects, if your current command should be Ruby or a system command.
36
51
  email: mail@janlelis.de
37
52
  executables:
@@ -45,6 +60,7 @@ extra_rdoc_files:
45
60
  files:
46
61
  - lib/ripl/fresh/commands.rb
47
62
  - lib/ripl/fresh/prompt.rb
63
+ - lib/ripl/fresh/config.rb
48
64
  - lib/ripl/fresh.rb
49
65
  - lib/ripl-fresh/bond_workaround.rb
50
66
  - lib/bond/completions/ripl-fresh.rb
@@ -71,8 +87,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
87
  - - ">="
72
88
  - !ruby/object:Gem::Version
73
89
  segments:
74
- - 0
75
- version: "0"
90
+ - 1
91
+ - 9
92
+ version: "1.9"
76
93
  required_rubygems_version: !ruby/object:Gem::Requirement
77
94
  none: false
78
95
  requirements: