envo 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4cec2ad575a0169c6dacbf43e31fd020f782223a90f18e4e5f88c773e584d8f
4
- data.tar.gz: 5d88e738f7b0f1d2c183d1ce420b10e0c4456b94ef9dcededd59f05f8ff75386
3
+ metadata.gz: 9fa260370764e3c4a2572f56b6c35e2dcf67ae4b0f472ff68b73ede8379baa59
4
+ data.tar.gz: f544d7f23a506033845e274b09edd0a64b5d75e659ef6e665c0523ecb0e886b6
5
5
  SHA512:
6
- metadata.gz: 0ff617b289561c7cfbd31dc75be388b370f5170e8103dc6603be2e58f95e8e6178dc7f1824bf295cc7abe82d8681c80fe16aa7842c13230d0265ab84059309b7
7
- data.tar.gz: 739f0a9d752398a92accb8e5ed2c53c3fcbec2b5486ac6c7598fdc1fff777ecf2a0b2a1f5ca7b5e12e90e9a8648d3f71f7747d65336d186a19e544d7880afb03
6
+ metadata.gz: 2ff4f904d7a4f2301c50dbd8064f7b1205e166c7de23b353f55184c2f3385fa33173f4cfba67874803c0a16aeb1a395cda51c7208370a7c98a5d215440b867cd
7
+ data.tar.gz: bcaeb1403f08292a407cc7ceaae314e76dc07fd3c63d2db93129a56851acbd2e2fb3ff70b441f27f8a251065f1e6635dbcf656aa317e533895e90a9274008f70
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Envo
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/envo.svg)](https://badge.fury.io/rb/envo)
4
+
3
5
  A command-line environment variable manager for the current shell session. It works with bash and Windows cmd.
4
6
 
5
7
  Envo offers several commands to view and change environment variables and also to execute simple scripts composed of those commands, thus allowing the same script for a particular env-var configuration on all supported platforms.
@@ -6,6 +6,6 @@
6
6
  :: so... just choose the a very unlikely duplicate var name
7
7
  for /f "delims=" %%A in ('envo_run g') do set _ENVO_PLD=%%A
8
8
 
9
- envo_run pld "%_ENVO_PLD%" %*
9
+ call envo_run pld "%_ENVO_PLD%" %*
10
10
  call "%_ENVO_PLD%"
11
11
  del "%_ENVO_PLD%"
@@ -20,5 +20,10 @@ module Envo
20
20
  def path_exists?(path)
21
21
  File.exist?(path)
22
22
  end
23
+
24
+ def path_id(path)
25
+ return -1 if !File.exist?(path)
26
+ File.stat(path).ino
27
+ end
23
28
  end
24
29
  end
@@ -67,13 +67,10 @@ module Envo
67
67
  end
68
68
  end
69
69
 
70
- def pp_attribs(elem)
71
- @ar.count(elem) > 1 ? 'D' : ' '
72
- end
73
70
  def pretty_print(ctx)
74
71
  ctx.puts "["
75
72
  @ar.each_with_index do |v, i|
76
- str = pp_attribs(v) + ' '
73
+ str = @ar.count(v) > 1 ? 'D ' : ' '
77
74
  str += "#{i}:".ljust(4)
78
75
  str += v
79
76
  ctx.puts str
@@ -13,12 +13,40 @@ module Envo
13
13
  def accept_item?(item)
14
14
  item.type == :path
15
15
  end
16
- def pp_attribs(elem)
17
- super + (@host.path_exists?(elem) ? ' ' : 'N')
16
+
17
+ def make_helper_map
18
+ @ar.map { |p|
19
+ id = @host.path_id(p)
20
+ { str: p, id: id }
21
+ }
18
22
  end
23
+
24
+ def pretty_print(ctx)
25
+ helper = make_helper_map
26
+
27
+ ctx.puts "["
28
+ helper.each_with_index do |v, i|
29
+ dupes = helper.count { |e|
30
+ if e[:str] == v[:str] then true
31
+ elsif e[:id] == -1 then false
32
+ else e[:id] == v[:id]
33
+ end
34
+ }
35
+ str = dupes > 1 ? 'D' : ' '
36
+ str += v[:id] != -1 ? ' ' : 'N'
37
+ str += ' '
38
+ str += "#{i}:".ljust(4)
39
+ str += v[:str]
40
+ ctx.puts str
41
+ end
42
+ ctx.puts ']'
43
+ end
44
+
19
45
  def clean!
20
- super
21
- @ar.select! { |s| @host.path_exists?(s) }
46
+ helper = make_helper_map
47
+ helper.select! { |e| e[:id] != -1 }
48
+ helper.uniq! { |e| e[:id] }
49
+ @ar = helper.map { |e| e[:str] }
22
50
  end
23
51
  end
24
52
  end
@@ -1,4 +1,4 @@
1
1
  module Envo
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  VERSION_TYPE = 'alpha'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: envo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Borislav Stanimirov
@@ -68,7 +68,7 @@ licenses:
68
68
  - MIT
69
69
  metadata: {}
70
70
  post_install_message: |
71
- Thanks for installing envo v0.1.1 alpha!
71
+ Thanks for installing envo v0.1.2 alpha!
72
72
  For the tool to work you must also run the installation program:
73
73
  $ envo-install
74
74
  Running it will complete the setup and 'envo' should be available as a command.
@@ -91,5 +91,5 @@ requirements: []
91
91
  rubygems_version: 3.1.4
92
92
  signing_key:
93
93
  specification_version: 4
94
- summary: An CLI environment variable manager
94
+ summary: A CLI environment variable manager
95
95
  test_files: []