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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/archer.rb +8 -12
- data/lib/archer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83355041e7d4db676c39d7578272e2ad5b1f485a1d3ce93f19c0ecf997afc270
|
4
|
+
data.tar.gz: 6dbafdf30bdd43a6866b25f137f3e9c23218d6f756b7f1e31a37f07cf321f5b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b4638dcf53e8b2fc7883a992ae5a2234406298ebd7cb2a8d3a4eaf78e06fb81eb80cc7c892b7f8996c4785e7b60a55b702d85655587f4ee4989c7bff4f72f25
|
7
|
+
data.tar.gz: 4e2da0efaa2218f940ec22d62ef20d5f0747a1b5e63fe15189860306013cbb736440b96bec783d4774bdf5e5886218d908faaaeb60bf2ac5ae1be500a994456d
|
data/CHANGELOG.md
CHANGED
data/lib/archer.rb
CHANGED
@@ -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
|
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.
|
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
|
38
|
-
|
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 =
|
45
|
+
history.commands = Readline::HISTORY.to_a.last(limit).join("\n")
|
50
46
|
history.save
|
51
47
|
end
|
52
|
-
rescue
|
53
|
-
|
48
|
+
rescue ActiveRecord::StatementInvalid
|
49
|
+
warn "[archer] Unable to save history"
|
54
50
|
end
|
55
51
|
|
56
52
|
# private
|
data/lib/archer/version.rb
CHANGED