archer-rails 0.2.0 → 0.3.0

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: 7efb1ead011d342fecc5b05028013de7a07fd101bbda3610b67f11d2707b8e59
4
- data.tar.gz: 26e4472b7a6e5402a4319fd148d4b921225b19cd4d47215a1f6e45b20d1300d1
3
+ metadata.gz: 35a51652ad167e88ab4359b2a007746f46c1e15ed689ab252cda60631adaef45
4
+ data.tar.gz: 71f8034c47eeb7f6f0ed618544332f32a318e04a6419963bfa4a8dc9a9413c94
5
5
  SHA512:
6
- metadata.gz: 452c0c2b502e99e1d88694751ab538cab0134193ecff8de09ae27adc130cb37ab488162d48998c4e935165cf18c9c517298c7c33a04c89c4156a5ce997ac449e
7
- data.tar.gz: 7adbb6348c77d01d5a3e9ddf5bd61ef4071e54f1a5b2018d7b877f67b04a05160025852408498a2fff6fa25d45cf4c38b4663135708fa517af9569844f9e0784
6
+ metadata.gz: fa0caa5c6ef56a53b2e76b2b753eed6e02695584ecc23f57ae4e46b939e4bdd53288b8d997ffd24b1e3eb85a8210d3c61c3755b52c98f8f83ae65ccca9453507
7
+ data.tar.gz: 7150fd672798cb21d465fb9247093c2e1b220e56106f5e38a5fdc3cbbb26f9c2bce2e3f5fb856035d53e33a3641e767ea5603d20aab851db6862a06510400fe8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 0.3.0 (2022-01-10)
2
+
3
+ - Dropped support for Ruby < 2.6 and Rails < 5.2
4
+
5
+ ## 0.2.3 (2021-08-03)
6
+
7
+ - Added `save_session` option
8
+
9
+ ## 0.2.2 (2021-01-07)
10
+
11
+ - Fixed issue with Reline detection
12
+
13
+ ## 0.2.1 (2020-11-23)
14
+
15
+ - Fixed issue with not loading history
16
+ - Use `datetime` type in migration
17
+
1
18
  ## 0.2.0 (2020-04-09)
2
19
 
3
20
  - Added support for Reline
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018-2019 Andrew Kane
3
+ Copyright (c) 2018-2022 Andrew Kane
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -11,7 +11,7 @@ Designed for platforms with ephemeral filesystems
11
11
  Add this line to your application’s Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'archer-rails'
14
+ gem "archer-rails"
15
15
  ```
16
16
 
17
17
  And run:
@@ -24,7 +24,7 @@ rails db:migrate
24
24
  Lastly, update your Gemfile to only include it in environments where you need it:
25
25
 
26
26
  ```ruby
27
- gem 'archer-rails', group: [:production]
27
+ gem "archer-rails", group: [:production]
28
28
  ```
29
29
 
30
30
  ## How It Works
@@ -53,14 +53,20 @@ Archer.user
53
53
 
54
54
  ## Clearing History
55
55
 
56
+ Disable saving history for the current session with:
57
+
58
+ ```ruby
59
+ Archer.save_session = false
60
+ ```
61
+
62
+ You should do this when running sensitive commands.
63
+
56
64
  Clear history for current user with:
57
65
 
58
66
  ```ruby
59
67
  Archer.clear
60
68
  ```
61
69
 
62
- You should do this after running sensitive commands.
63
-
64
70
  ## Configuration
65
71
 
66
72
  Change the number of commands to remember
data/lib/archer/engine.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  module Archer
2
2
  class Engine < Rails::Engine
3
3
  console do
4
- Archer.history_file ||= Rails.root.join("tmp", ".irb-history")
5
- Archer.start
4
+ # need IRB context to be ready before Archer.start
5
+ ::IRB::Irb.prepend(Archer::Irb)
6
6
 
7
7
  at_exit do
8
- Archer.save
8
+ Archer.save if Archer.save_session
9
9
  end
10
10
  end
11
11
  end
data/lib/archer/irb.rb ADDED
@@ -0,0 +1,9 @@
1
+ module Archer
2
+ module Irb
3
+ # needs to run after conf[:MAIN_CONTEXT] is set
4
+ def eval_input(*)
5
+ Archer.start
6
+ super
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Archer
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/archer.rb CHANGED
@@ -3,6 +3,7 @@ require "active_support/core_ext/module/attribute_accessors"
3
3
 
4
4
  # modules
5
5
  require "archer/engine" if defined?(Rails)
6
+ require "archer/irb"
6
7
  require "archer/version"
7
8
 
8
9
  module Archer
@@ -14,7 +15,8 @@ module Archer
14
15
  mattr_accessor :user
15
16
  self.user = ENV["USER"]
16
17
 
17
- mattr_accessor :history_file
18
+ mattr_accessor :save_session
19
+ self.save_session = true
18
20
 
19
21
  def self.clear
20
22
  quietly do
@@ -37,9 +39,7 @@ module Archer
37
39
 
38
40
  if history
39
41
  commands = history.commands.split("\n")
40
- # can't use reline? yet, so push to all
41
- Readline::HISTORY.push(*commands) if defined?(Readline)
42
- Reline::HISTORY.push(*commands) if defined?(Reline)
42
+ history_object.push(*commands)
43
43
  end
44
44
  end
45
45
 
@@ -54,6 +54,7 @@ module Archer
54
54
  end
55
55
 
56
56
  # private
57
+ # TODO use IRB.CurrentContext.io.class::HISTORY
57
58
  def self.history_object
58
59
  reline? ? Reline::HISTORY : Readline::HISTORY
59
60
  end
@@ -3,7 +3,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version
3
3
  create_table :archer_history do |t|
4
4
  t.string :user
5
5
  t.text :commands
6
- t.timestamp :updated_at
6
+ t.datetime :updated_at
7
7
  end
8
8
 
9
9
  add_index :archer_history, :user, unique: true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-09 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,58 +16,30 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5'
19
+ version: '5.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5'
26
+ version: '5.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
33
+ version: '5.2'
34
+ type: :runtime
63
35
  prerelease: false
64
36
  version_requirements: !ruby/object:Gem::Requirement
65
37
  requirements:
66
38
  - - ">="
67
39
  - !ruby/object:Gem::Version
68
- version: '0'
69
- description:
70
- email: andrew@chartkick.com
40
+ version: '5.2'
41
+ description:
42
+ email: andrew@ankane.org
71
43
  executables: []
72
44
  extensions: []
73
45
  extra_rdoc_files: []
@@ -79,6 +51,7 @@ files:
79
51
  - lib/archer.rb
80
52
  - lib/archer/engine.rb
81
53
  - lib/archer/history.rb
54
+ - lib/archer/irb.rb
82
55
  - lib/archer/version.rb
83
56
  - lib/generators/archer/install_generator.rb
84
57
  - lib/generators/archer/templates/migration.rb.tt
@@ -86,7 +59,7 @@ homepage: https://github.com/ankane/archer
86
59
  licenses:
87
60
  - MIT
88
61
  metadata: {}
89
- post_install_message:
62
+ post_install_message:
90
63
  rdoc_options: []
91
64
  require_paths:
92
65
  - lib
@@ -94,15 +67,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
67
  requirements:
95
68
  - - ">="
96
69
  - !ruby/object:Gem::Version
97
- version: '2.4'
70
+ version: '2.6'
98
71
  required_rubygems_version: !ruby/object:Gem::Requirement
99
72
  requirements:
100
73
  - - ">="
101
74
  - !ruby/object:Gem::Version
102
75
  version: '0'
103
76
  requirements: []
104
- rubygems_version: 3.1.2
105
- signing_key:
77
+ rubygems_version: 3.3.3
78
+ signing_key:
106
79
  specification_version: 4
107
80
  summary: Rails console history for Heroku, Docker, and more
108
81
  test_files: []