tcollier-commando 0.2.0 → 0.2.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: 9bab78dc964fa7ce13e372cfed2902f152c3a0a2
4
- data.tar.gz: c34eddbfb57a271a68c635d79d278c76053cb38b
3
+ metadata.gz: 5325137899697d0e9166e6cbe578ac16be28753e
4
+ data.tar.gz: b27473af548a18cc382444b85d20574a7b1a1e58
5
5
  SHA512:
6
- metadata.gz: 57425515b9b2cd72748222130d6ea4ea39b65834c4315b3921c7e933505b70b4af0112ebb81f68c03155139437fd1af496f6dc842abe27b18d7df0fc5ee6df91
7
- data.tar.gz: 8a7870cfe6aed8d9bab534d3161fbfacd448e7a0a1639b8682cc496db9b892197f20fd1ff78a454c4e113fbf3845cea2bbf79aa221f6ad47d71465cf5939bf19
6
+ metadata.gz: 2068d9b73e94d36a392f7be87bcef00df62bc6d18a089ea319ac565ab06f3b7ab40b5508767457af5cd00c4c43da15605cc03764fdfc02f5e1ef3e6836bf07f1
7
+ data.tar.gz: e87b4c3b616b2342cb016bc5837489dbc54727c1be30b054a401442099e8bac64ae18825a35058ef11db6914b80c1e846e3ffcb1a20f1f48c13e3f9c0900e917
data/README.md CHANGED
@@ -8,6 +8,7 @@ A command line interface builder with Readline support
8
8
  * `0.1.1` - Alphabetize commands printed via `help`
9
9
  * `0.1.2` - Remove empty lines from history
10
10
  * `0.2.0` - Persist history across CLI sessions
11
+ * `0.2.1` - Fix bug when history file doesn't exist
11
12
 
12
13
  ## Installation
13
14
 
@@ -41,19 +41,19 @@ module Commando
41
41
  end
42
42
 
43
43
  def load_history
44
- if Commando.config.history_file
45
- File.readlines(Commando.config.history_file).each do |line|
44
+ if history_file && File.exists?(history_file)
45
+ File.readlines(history_file).each do |line|
46
46
  Readline::HISTORY.push(line.chomp)
47
47
  end
48
48
  end
49
49
  end
50
50
 
51
51
  def save_history(line)
52
- if Commando.config.history_file
53
- File.open(Commando.config.history_file, 'a') do |f|
54
- f.puts line
55
- end
56
- end
52
+ File.open(history_file, 'a') { |f| f.puts(line) } if history_file
53
+ end
54
+
55
+ def history_file
56
+ Commando.config.history_file
57
57
  end
58
58
  end
59
59
 
@@ -1,3 +1,3 @@
1
1
  module Commando
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tcollier-commando
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Collier