hquby 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +4 -0
  3. data/bin/hquby +26 -12
  4. data/lib/hquby/version.rb +1 -1
  5. metadata +7 -9
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 80853adf7fadcb0bb7dd9176f1f0f3413cc9d4cf
4
+ data.tar.gz: 8b9e88dbeaf678ce1b2b3c0922725934b1bda6f2
5
+ SHA512:
6
+ metadata.gz: 80c20280c3965a831c757103679de2678e331f9e660496da06dd397c8529c5d2d7553e0f812dbcd1e3cd2267a3471da44f2e89ca05cdaa0f4eeac313ac101143
7
+ data.tar.gz: 806f003cc1fc16911726534dfda83b813273d76df8c6854462e0b9b1ae3e6f4ac9dfea750b64ee17d89ac5609a5aedd22148f5ba6309fad59d08ea0de7c9d491
data/README.md CHANGED
@@ -36,3 +36,7 @@ You can also use the following service commands while in interactive mode:
36
36
  ## Installation
37
37
 
38
38
  $ gem install hquby
39
+
40
+ ## TODO
41
+
42
+ Add tests
data/bin/hquby CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'optparse'
4
+ require 'hquby'
4
5
 
5
6
  def eval_h
6
7
  puts "Hello, world!"
@@ -52,6 +53,7 @@ end
52
53
 
53
54
  def show_greeting
54
55
  puts <<-GREETING
56
+ --- HQUBY v#{Hquby::VERSION}
55
57
  --- Welcome to hquby interactive mode!
56
58
  --- hquby is an implementation of HQ9+ interpreter.
57
59
  --- Type ':help' or '?' for more options.
@@ -124,7 +126,7 @@ optparse = OptionParser.new do |opts|
124
126
  exit(0)
125
127
  end
126
128
 
127
- opts.on('-e SCRIPT', 'Execute script from command line') do |scr|
129
+ opts.on('-e SCRIPT', 'Execute script from the command line') do |scr|
128
130
  eval_string(scr)
129
131
  exit(0)
130
132
  end
@@ -142,11 +144,10 @@ if not ARGV.empty? or not $stdin.tty?
142
144
  end
143
145
 
144
146
  # Fall back to interactive mode
145
- # TODO Check 'Readline' support!
146
- require 'readline'
147
- $stdout.sync = true
148
147
 
149
148
  DEFAULT_PROMPT = '>> '
149
+ $stdout.sync = true
150
+
150
151
  $prompt = DEFAULT_PROMPT
151
152
  $is_interactive = true
152
153
 
@@ -161,13 +162,26 @@ LIST = [
161
162
  ':quit', ':examine',
162
163
  ].sort
163
164
 
164
- comp = proc { |s| LIST.grep( /^#{Regexp.escape(s)}/ ) }
165
-
166
- Readline.completion_append_character = " "
167
- Readline.completion_proc = comp
168
-
169
165
  show_greeting()
170
- while line = Readline.readline($prompt, true)
171
- eval_string(line.chomp)
166
+ HAS_READLINE = begin
167
+ require 'readline'
168
+ rescue LoadError
169
+ puts "(Install 'readline' gem for better experience)"
170
+ false
171
+ end
172
+ if HAS_READLINE
173
+ # Readline gem is present
174
+ comp = proc { |s| LIST.grep( /^#{Regexp.escape(s)}/ ) }
175
+
176
+ Readline.completion_append_character = " "
177
+ Readline.completion_proc = comp
178
+
179
+ while line = Readline.readline($prompt, true)
180
+ eval_string(line.chomp)
181
+ end
182
+ else
183
+ loop do
184
+ print $prompt
185
+ eval_string(gets.chomp)
186
+ end
172
187
  end
173
-
@@ -1,3 +1,3 @@
1
1
  module Hquby
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hquby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
4
+ version: 0.1.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Anton Ovchinnikov
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-14 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: HQ9+ interpreter
15
14
  email:
@@ -30,26 +29,25 @@ files:
30
29
  - lib/hquby/version.rb
31
30
  homepage: https://github.com/rev112/hquby
32
31
  licenses: []
32
+ metadata: {}
33
33
  post_install_message:
34
34
  rdoc_options: []
35
35
  require_paths:
36
36
  - lib
37
37
  required_ruby_version: !ruby/object:Gem::Requirement
38
- none: false
39
38
  requirements:
40
- - - ! '>='
39
+ - - '>='
41
40
  - !ruby/object:Gem::Version
42
41
  version: '0'
43
42
  required_rubygems_version: !ruby/object:Gem::Requirement
44
- none: false
45
43
  requirements:
46
- - - ! '>='
44
+ - - '>='
47
45
  - !ruby/object:Gem::Version
48
46
  version: '0'
49
47
  requirements: []
50
48
  rubyforge_project:
51
- rubygems_version: 1.8.25
49
+ rubygems_version: 2.0.0
52
50
  signing_key:
53
- specification_version: 3
51
+ specification_version: 4
54
52
  summary: Simple HQ9+ implementation
55
53
  test_files: []