recycle 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/exe/recycle +28 -10
- data/lib/recycle/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e7d964be5b85855d08762c76e209cfab0873b1d
|
4
|
+
data.tar.gz: 1fa32cfea649c2c875f8be015723aa450a940392
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e34b8f0616cca12dc2fd4d93595c506de847f15a901b3a5374f6e4cca736c66549dcea2b3b80240ac8301071d158177a42747699d4d95282c7d6b5b908c51524
|
7
|
+
data.tar.gz: d571def5acf8bf554e2a3ec8c14b7948f6633b8799f346a80867c81b8ed3e5cc1b0d16f983480f8c425a68a5d878cb7c9c2481b0748c5f87668fceba0f96c649
|
data/README.md
CHANGED
@@ -14,6 +14,20 @@ some of the frustration by adding an easy way of adding directory shortcuts
|
|
14
14
|
eval "$(recycle exec)"
|
15
15
|
```
|
16
16
|
|
17
|
+
or
|
18
|
+
|
19
|
+
If you'd prefer to not run a ruby executable every startup you can use
|
20
|
+
`recycle cache` in conjunction with sourcing the following.
|
21
|
+
|
22
|
+
```sh
|
23
|
+
source $HOME/.recycle/cache
|
24
|
+
```
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
17
31
|
Listing configuration:
|
18
32
|
|
19
33
|
```sh
|
data/exe/recycle
CHANGED
@@ -14,6 +14,7 @@ default_command :help
|
|
14
14
|
|
15
15
|
RECYCLE_HOME = File.join(ENV['RECYCLE_ROOT'] || Dir.home, '.recycle')
|
16
16
|
DATA_FILE = File.join(RECYCLE_HOME, 'data.yml')
|
17
|
+
CACHE_FILE = File.join(RECYCLE_HOME, 'cache')
|
17
18
|
RECYCLE_CONFIG = File.exists?(DATA_FILE) ? YAML.load_file(DATA_FILE) : {}
|
18
19
|
|
19
20
|
RECYCLE_CONFIG['commands'] ||= {}
|
@@ -113,20 +114,37 @@ command :remove do |cmd|
|
|
113
114
|
end
|
114
115
|
end
|
115
116
|
|
117
|
+
def output_config(io)
|
118
|
+
RECYCLE_CONFIG.fetch('directories', {}).each do |key, value|
|
119
|
+
io.puts %|alias #{key}="cd #{value}"|
|
120
|
+
end
|
121
|
+
|
122
|
+
RECYCLE_CONFIG.fetch('commands', {}).each do |key, value|
|
123
|
+
io.puts <<~DOC
|
124
|
+
function #{key}() {
|
125
|
+
#{value}
|
126
|
+
}
|
127
|
+
DOC
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
116
131
|
command :exec do |cmd|
|
117
132
|
cmd.syntax = 'recycle exec'
|
118
133
|
cmd.description = 'Outputs all configuration in a shell consumable manner'
|
119
134
|
cmd.action do
|
120
|
-
|
121
|
-
|
122
|
-
|
135
|
+
output_config($stdout)
|
136
|
+
end
|
137
|
+
end
|
123
138
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
139
|
+
command :cache do |cmd|
|
140
|
+
cmd.syntax = 'recycle cache'
|
141
|
+
cmd.description = "Stores all configuration in a shell consumable manner to #{CACHE_FILE}"
|
142
|
+
cmd.action do
|
143
|
+
File.open(CACHE_FILE, 'w') { |file| output_config(file) }
|
144
|
+
puts <<~DOC
|
145
|
+
You can now source #{CACHE_FILE} instead of using eval.
|
146
|
+
|
147
|
+
Note: You'll have to rerun 'recycle cache' after you add configuration.
|
148
|
+
DOC
|
131
149
|
end
|
132
150
|
end
|
data/lib/recycle/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recycle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy W. Rowe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|