archer-rails 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
  SHA256:
3
- metadata.gz: bc91028877ce1f88f0b7a00d7ae59f560f54b810920b4b63182da896c9e3f763
4
- data.tar.gz: adc85d772d7c4b8b8e603eb38d4980f7c1949cec7bbd610f21ade433f7f0a3cf
3
+ metadata.gz: 83355041e7d4db676c39d7578272e2ad5b1f485a1d3ce93f19c0ecf997afc270
4
+ data.tar.gz: 6dbafdf30bdd43a6866b25f137f3e9c23218d6f756b7f1e31a37f07cf321f5b2
5
5
  SHA512:
6
- metadata.gz: 865302453215cfbb7401227d7d00ef7ecd0afaee60b2d113e5bb0e2c713a5158938edbf91fd1569d40e943a75dbe9a91eb3f709cba8d57820dcc2dff0c72dcd3
7
- data.tar.gz: 8029f6e80439966df685d4402f72d40366e1f97bdfe2ae4ea1580cbce6c69625bd47df7b90248c6db9d336772b58514fd6083285d27663577de3cb45235943f9
6
+ metadata.gz: 2b4638dcf53e8b2fc7883a992ae5a2234406298ebd7cb2a8d3a4eaf78e06fb81eb80cc7c892b7f8996c4785e7b60a55b702d85655587f4ee4989c7bff4f72f25
7
+ data.tar.gz: 4e2da0efaa2218f940ec22d62ef20d5f0747a1b5e63fe15189860306013cbb736440b96bec783d4774bdf5e5886218d908faaaeb60bf2ac5ae1be500a994456d
@@ -1,3 +1,7 @@
1
+ ## 0.1.1
2
+
3
+ - Fixed issue with not loading history on Heroku
4
+
1
5
  ## 0.1.0
2
6
 
3
7
  - First release
@@ -20,7 +20,7 @@ module Archer
20
20
  quietly do
21
21
  Archer::History.where(user: user).delete_all
22
22
  end
23
- Readline::HISTORY.clear rescue nil
23
+ Readline::HISTORY.clear
24
24
  true
25
25
  end
26
26
 
@@ -28,29 +28,25 @@ module Archer
28
28
  history = nil
29
29
  begin
30
30
  quietly do
31
- history = Archer::History.where(user: user).first_or_initialize
31
+ history = Archer::History.find_by(user: user)
32
32
  end
33
- rescue
33
+ rescue ActiveRecord::StatementInvalid
34
34
  warn "[archer] Create table to enable history"
35
35
  end
36
36
 
37
- if history && history.persisted?
38
- File.write(history_file, history.commands)
37
+ if history
38
+ Readline::HISTORY.push(*history.commands.split("\n"))
39
39
  end
40
-
41
- require "irb/ext/save-history"
42
- IRB.conf[:SAVE_HISTORY] = limit
43
- IRB.conf[:HISTORY_FILE] = history_file
44
40
  end
45
41
 
46
42
  def self.save
47
43
  quietly do
48
44
  history = Archer::History.where(user: user).first_or_initialize
49
- history.commands = File.read(history_file)
45
+ history.commands = Readline::HISTORY.to_a.last(limit).join("\n")
50
46
  history.save
51
47
  end
52
- rescue
53
- # do nothing
48
+ rescue ActiveRecord::StatementInvalid
49
+ warn "[archer] Unable to save history"
54
50
  end
55
51
 
56
52
  # private
@@ -1,3 +1,3 @@
1
1
  module Archer
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archer-rails
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
  - Andrew Kane