nib 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/config/commands/shell/irbrc +11 -0
- data/config/commands/shell/pryrc +17 -0
- data/lib/nib.rb +4 -0
- data/lib/nib/history.rb +52 -22
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcfc968d8ee13c4739cb42a5afeddd81d5c45f1b
|
4
|
+
data.tar.gz: 04db626c3a278a91cba59bfef4d2707875e326fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74ac8b08e4f48246cb6b6fb401225309cb2369175f83f1e3f2c394c0cb427880bebbe1f2e9392e7dff7e022482ad3700d5898e10227581ea0558907dbea27e50
|
7
|
+
data.tar.gz: 26cceb3d695fb319555683fc00728714670c69cf3801f3d1bc9f4d7b7af3299b232a7367342451a1b8642a431a74884f68b189b18539a9743ed19913a74b2bde
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.2
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# === CUSTOM PROMPT ===
|
2
|
+
# This prompt shows the ruby version (useful for RVM)
|
3
|
+
Pry.prompt = [
|
4
|
+
proc { |obj, nest_level, _| "#{RUBY_VERSION} (#{obj}):#{nest_level} > " },
|
5
|
+
proc { |obj, nest_level, _| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " }
|
6
|
+
]
|
7
|
+
|
8
|
+
# === Listing config ===
|
9
|
+
# Better colors - by default the headings for methods are too
|
10
|
+
# similar to method name colors leading to a "soup"
|
11
|
+
# These colors are optimized for use with Solarized scheme
|
12
|
+
# for your terminal
|
13
|
+
Pry.config.ls.separator = "\n" # new lines between methods
|
14
|
+
Pry.config.ls.heading_color = :magenta
|
15
|
+
Pry.config.ls.public_method_color = :green
|
16
|
+
Pry.config.ls.protected_method_color = :yellow
|
17
|
+
Pry.config.ls.private_method_color = :bright_black
|
data/lib/nib.rb
CHANGED
data/lib/nib/history.rb
CHANGED
@@ -1,32 +1,62 @@
|
|
1
|
-
|
2
|
-
IRBRC = <<-'IRB'.freeze
|
3
|
-
require \"rubygems\"
|
4
|
-
require \"irb/completion\"
|
5
|
-
require \"irb/ext/save-history\"
|
6
|
-
# irb configuration
|
7
|
-
IRB.conf[:PROMPT_MODE] = :SIMPLE
|
8
|
-
IRB.conf[:AUTO_INDENT] = true
|
9
|
-
# irb history
|
10
|
-
IRB.conf[:EVAL_HISTORY] = 10
|
11
|
-
IRB.conf[:SAVE_HISTORY] = 1000
|
12
|
-
IRB.conf[:HISTORY_FILE] = \"#{Dir.pwd}/tmp/irb_history\"
|
13
|
-
IRB
|
14
|
-
|
15
|
-
PRYRC = 'Pry.config.history.file = \"#{Dir.pwd}/tmp/irb_history\"'.freeze
|
16
|
-
|
17
|
-
def execute
|
18
|
-
system('mkdir', '-p', './tmp')
|
19
|
-
super
|
20
|
-
end
|
1
|
+
require 'fileutils'
|
21
2
|
|
3
|
+
module Nib::History
|
22
4
|
def command
|
23
5
|
<<-COMMAND
|
24
6
|
/bin/sh -c \"
|
25
7
|
export HISTFILE=./tmp/shell_history
|
26
|
-
|
27
|
-
|
8
|
+
cp #{irbrc.container_path} /root/.irbrc 2>/dev/null
|
9
|
+
cp #{pryrc.container_path} /root/.pryrc 2>/dev/null
|
28
10
|
#{super}
|
29
11
|
\"
|
30
12
|
COMMAND
|
31
13
|
end
|
14
|
+
|
15
|
+
def irbrc
|
16
|
+
@irbrc ||= Config.new(
|
17
|
+
:irbrc,
|
18
|
+
'IRB.conf[:HISTORY_FILE] = "#{Dir.pwd}/tmp/irb_history"'
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
def pryrc
|
23
|
+
@pryrc ||= Config.new(
|
24
|
+
:pryrc,
|
25
|
+
'Pry.config.history.file = "#{Dir.pwd}/tmp/irb_history"'
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
class Config
|
30
|
+
attr_reader :type, :history_command, :host_path
|
31
|
+
|
32
|
+
def initialize(type, history_command)
|
33
|
+
@type = type
|
34
|
+
@history_command = history_command
|
35
|
+
@host_path = "#{ENV['HOME']}/.#{type}"
|
36
|
+
|
37
|
+
FileUtils.mkdir_p './tmp'
|
38
|
+
end
|
39
|
+
|
40
|
+
def container_path
|
41
|
+
config_file.path
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def config
|
47
|
+
if File.exist?(host_path)
|
48
|
+
File.read(host_path)
|
49
|
+
else
|
50
|
+
Nib.load_default_config(:shell, type)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def config_file
|
55
|
+
@config_file ||= File.open("./tmp/#{type}", 'w+') do |file|
|
56
|
+
file.write(config)
|
57
|
+
file.write(history_command + "\n")
|
58
|
+
file
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
32
62
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Allen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-02-
|
12
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gli
|
@@ -150,6 +150,8 @@ files:
|
|
150
150
|
- bin/nib
|
151
151
|
- config/commands.json
|
152
152
|
- config/commands/codeclimate/docker-compose.yml
|
153
|
+
- config/commands/shell/irbrc
|
154
|
+
- config/commands/shell/pryrc
|
153
155
|
- config/options.yml
|
154
156
|
- lib/core_extensions/hash.rb
|
155
157
|
- lib/nib.rb
|