junoser 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04241a9dee01f2996227ba94241a5d072b5c8968
4
- data.tar.gz: a1c7851253a38cb45aec788d987a166cf64c0c90
3
+ metadata.gz: db6b2a917c2763fad5155635ea974d5a0c361f1b
4
+ data.tar.gz: 08de52d21a5f010b650b6675c509250009e5b356
5
5
  SHA512:
6
- metadata.gz: 9145301bba9640fc462b7ee7136af70730f77f7cd8b056b468b5ad66eef1e841b67b05ba170e5b27c3b41008859f1c8bc04f1c815a4d2e7cb9f12cd19c18ce72
7
- data.tar.gz: dab4dc7ce5b7d618c4555425215c4e3c2120db84958b36d9d64669e8f2ba64a510df2bf7de620c5b926c9c70ed897b61828658c76f8a576f8b7fd6ee8f78877d
6
+ metadata.gz: cf53ced06ef52a8882b510109e3bca652b729c3c5dd53a113a8699ad32e6174cf5e359890d82053773216a2e185b4e63cedbb0c1d341f348379171c746d394cf
7
+ data.tar.gz: 26de1af70c0c1c113ec6fd55b0aaba04734de319d64155db08cc756f07895263db4ae184f86ac68c54c2e4d8b7282c89a51462711a84753bd1f07ee494509296
data/exe/junoser CHANGED
@@ -40,7 +40,7 @@ opts.parse!
40
40
 
41
41
  case command
42
42
  when :check
43
- Junoser::Cli.commit_check $<
43
+ abort unless Junoser::Cli.commit_check($<)
44
44
  when :display_set
45
45
  Junoser::Cli.display_set $<
46
46
  when :struct
data/lib/junoser/cli.rb CHANGED
@@ -8,7 +8,7 @@ module Junoser
8
8
  class << self
9
9
  def commit_check(io_or_string)
10
10
  config = if io_or_string.respond_to?(:read)
11
- $<.read
11
+ io_or_string.read
12
12
  else
13
13
  io_or_string.to_s
14
14
  end
@@ -1,3 +1,4 @@
1
+ require 'parslet'
1
2
  require 'junoser/display/base'
2
3
 
3
4
  module Junoser
@@ -13,7 +14,7 @@ module Junoser
13
14
 
14
15
  def commit_check(&block)
15
16
  parser = Junoser::Parser.new
16
- failed = false
17
+ passed = true
17
18
 
18
19
  process do |current_stack, str|
19
20
  config = transform_line(current_stack, str)
@@ -21,12 +22,16 @@ module Junoser
21
22
  begin
22
23
  parser.parse config
23
24
  rescue Parslet::ParseFailed
24
- $stderr.puts "Invalid syntax:\n#{struct(current_stack.dup, str)}"
25
- failed = true
25
+ $stderr.puts "Invalid syntax: #{config}"
26
+ passed = false
26
27
  end
27
28
  end
28
29
 
29
- abort if failed
30
+ rescue
31
+ $stderr.puts $!
32
+ passed = false
33
+ ensure
34
+ passed
30
35
  end
31
36
 
32
37
 
@@ -48,7 +53,7 @@ module Junoser
48
53
  when /(.*);/
49
54
  yield stack, $1
50
55
  else
51
- raise "ERROR* unknown statement: #{line}"
56
+ raise "ERROR: unknown statement: #{line}"
52
57
  end
53
58
  end
54
59
  end
@@ -1,3 +1,3 @@
1
1
  module Junoser
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/junoser.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'junoser/cli'
1
2
  require 'junoser/display'
2
3
  require 'junoser/parser'
3
4
  require 'junoser/version'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: junoser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shintaro Kojima