code-ruby 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/code +20 -17
  3. data/lib/code/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a15136e1a9999fb8cba9a433f0e72d6bd237b8de8d0c948477824944853da2d
4
- data.tar.gz: 98a7b20d9225d717865eaa8fa461fa660e970a281f9de464725fd3923c0dee9f
3
+ metadata.gz: fbab52af883b6728dd2be14b84df672b911f542bc1b46e5f905be43acf1c0aed
4
+ data.tar.gz: 266bfadcff8f8deffc940f1a802d97a2dc5b89a189233eda6418f0e6939798b2
5
5
  SHA512:
6
- metadata.gz: 998e06a88b8d4bfb4cd1529c01a5ea347b3f1874c5c11ddbe9952942db999cb25bba645c5f49bfdb40ff7f17a217af035561ad58fcb06dd8c4383d8906362947
7
- data.tar.gz: b9a5b0703efca344bdd1f1f0b972ddabad86746cbd6745eb71c2a82ef61fc4a30370bd7052dfe703e1a44055926f17c9a57005ff5b353057dc462078c148ea80
6
+ metadata.gz: 2503a5d2bfe52eb270c81156dfa40fa535427ff2222748344669f27cd069da453eb5d2ea506f01af8f5e210e51f89eaa80de5d0558539d38a14d714393d5b7b5
7
+ data.tar.gz: 455729dce33fe36792986541c6c78d3e53fad319728f141568f51d13b989d0da648422c69cb623c9ab327679610150c0bf06eefc9caf0a740b86c3d5de79700a
data/bin/code CHANGED
@@ -9,15 +9,14 @@ options = {
9
9
  profile: false,
10
10
  profiler: "text",
11
11
  input: "",
12
- context: "",
13
12
  parse: false
14
13
  }
15
14
 
16
- OptionParser
15
+ argv = OptionParser
17
16
  .new do |opts|
18
- opts.banner = "Usage: code [options]"
17
+ opts.banner = "Usage: code INPUT\n\n"
19
18
 
20
- opts.on("-v", "--version", "Version of template") do |_input|
19
+ opts.on("-v", "--version", "Version of Code") do |_input|
21
20
  puts Code::Version
22
21
  exit
23
22
  end
@@ -25,24 +24,14 @@ OptionParser
25
24
  opts.on(
26
25
  "-i INPUT",
27
26
  "--input INPUT",
28
- "Input in the code language (String or File)"
27
+ "Input in the Code language (String or File)"
29
28
  ) do |input|
30
29
  input = File.read(input) if File.exist?(input)
31
30
 
32
31
  options[:input] = input
33
32
  end
34
33
 
35
- opts.on(
36
- "-c CONTEXT",
37
- "--context CONTEXT",
38
- "Context in the code language (String or File)"
39
- ) do |context|
40
- context = File.read(context) if File.exist?(context)
41
-
42
- options[:context] = context
43
- end
44
-
45
- opts.on("-p", "--parse", "Get parser results for input") do |parse|
34
+ opts.on("-p", "--parse", "Parser tree for input") do |parse|
46
35
  options[:parse] = parse
47
36
  end
48
37
 
@@ -68,6 +57,21 @@ OptionParser
68
57
  end
69
58
  .parse!
70
59
 
60
+ options[:input] = argv.join(" ") if options[:input].empty?
61
+
62
+ if options[:input].empty?
63
+ abort <<~HELP
64
+ Usage: code INPUT
65
+
66
+ -v, --version Version of Code
67
+ -i, --input INPUT Input in the Code language (String or File)
68
+ -p, --parse Parser tree for input
69
+ -t, --timeout TIMEOUT Set timeout in seconds
70
+ --profile Profile Ruby code
71
+ --profiler TYPE Profiler output type (text (default) or html)
72
+ HELP
73
+ end
74
+
71
75
  RubyProf.start if options[:profile]
72
76
 
73
77
  if options[:parse]
@@ -75,7 +79,6 @@ if options[:parse]
75
79
  else
76
80
  print Code.evaluate(
77
81
  options[:input],
78
- options[:context],
79
82
  output: $stdout,
80
83
  error: $stderr,
81
84
  timeout: options[:timeout]
data/lib/code/version.rb CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require_relative "../code"
4
4
 
5
- Code::Version = Gem::Version.new("0.9.2")
5
+ Code::Version = Gem::Version.new("0.9.3")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié