kojo 0.2.4 → 0.2.5

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
  SHA256:
3
- metadata.gz: cf86e9c731c19158840673852b2edb3fdb047ff1e80170ba8f33685c40e677c1
4
- data.tar.gz: 38d5f668d58d4681e635cfb73944f4a5927a9865a9e72f1040cfa968f119186c
3
+ metadata.gz: 84a6675eb6aa7317e160722d8070a9fca5d772f49a18e6d3fd29687dd294116a
4
+ data.tar.gz: 6c3289e8c830dacb8aefc87fc4fbbc4efec17c000aabd3a10743fa6f083d59db
5
5
  SHA512:
6
- metadata.gz: d9abd6c45fc2cf8a92659db86914ed4baa0e4754d117ae348444b5dcceed7301f7e3f822d3fcf7ad0602be4bdcaa29d8c58e19aff5071c3321c849e1a4e937df
7
- data.tar.gz: 4358ffb8cde4c83ec10aa73e2f5bae4c34b369200cfeb1abe837249528a7cfcc16d5ed2c80967232795a38c14dc49a95a9f96ee9bfa0f6c70c199c4d225fcb4d
6
+ metadata.gz: 1f3dbed142076b6a0f5d3603cd033f8ef7b7e720c5fc1cfdb59b833c35856560193d40b3a061c1ab4087a8a5175ed2a1d4553d251011a2044f396e6338c50c43
7
+ data.tar.gz: d918c15cdf9cb1b07841b6c19a2bc9fd789155a796d5ad490780397111f4735c34f0fe7097d5e5cc0cc02cba0d198a23d8687b136e37ff304d0c9d9d4484c0d7
data/bin/kojo CHANGED
@@ -5,6 +5,9 @@ runner = Kojo::CLI.runner
5
5
 
6
6
  begin
7
7
  exit runner.run ARGV
8
+ rescue Kojo::Interrupt
9
+ say! "\nGoodbye"
10
+ exit 1
8
11
  rescue => e
9
12
  puts e.backtrace.reverse if ENV['DEBUG']
10
13
  say! "!undred!#{e.class}!txtrst!\n#{e.message}"
@@ -1,4 +1,5 @@
1
1
  module Kojo
2
+ class Interrupt < Interrupt; end
2
3
  class Error < StandardError; end
3
4
  class TemplateError < Error; end
4
5
  class NotFoundError < Error; end
@@ -21,12 +21,17 @@ class String
21
21
 
22
22
  rescue KeyError => e
23
23
  print "> #{e.key}: "
24
- response = $stdin.gets
25
-
26
- raise Kojo::TemplateError, e.message unless response
27
-
28
- vars[e.key] = response.chomp
24
+ vars[e.key] = get_user_input
29
25
  retry
30
26
  end
31
27
 
28
+ private
29
+
30
+ def get_user_input
31
+ response = $stdin.gets
32
+ raise Kojo::Interrupt unless response # Ctrl+D
33
+ response.chomp
34
+ rescue Interrupt # Ctrl+C
35
+ raise Kojo::Interrupt
36
+ end
32
37
  end
data/lib/kojo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kojo
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kojo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit