path_manager 0.0.1 → 0.0.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
  SHA1:
3
- metadata.gz: e00c22ee7ca017f8380e2b53171e1216a6a395ca
4
- data.tar.gz: b15574bff8400e37a41fb7b9a71aaad39ae00374
3
+ metadata.gz: 92bb2daba7c3d6fc8550b20395c9fea61daa1793
4
+ data.tar.gz: 473fa9a85f98d3ae7ac6fa41e389485950f5e61f
5
5
  SHA512:
6
- metadata.gz: 6cc87f317502d1bf733b7b15a2096098275c226de206c5484a9202a7bf496270e9f8dc4002c0688742c5c329de2708a3ad91658e767e62608aa5c9c7e801c336
7
- data.tar.gz: 522beb1822c34113392f7c9e5c86e855ead4968920c918473ed90ef6320f525e22eed9864e82b394b1d12200ce2c50c2e8191f94c7476b8bd7f1b723531ae150
6
+ metadata.gz: 67d7a6fda44254da2b045c437afce787daf77478f9bd0410faff3b4d1137e27ec9a07e6f080858edf032b66a326e1144ff5b769935ed43a474115c67022947a5
7
+ data.tar.gz: f81b98733159a739a0df76aee69703fc87a14a1b5770949cfc75b834fc59c9590b4875ef9f65a4dbbfba9a05323a82042a62d961d6c9a07ec4b264ec9a49503d
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # PathManager
2
+ [![Gem Version](https://badge.fury.io/rb/path_manager.svg)](http://badge.fury.io/rb/path_manager)
2
3
 
3
4
  Helps you manage your PATH variable.
4
5
 
data/lib/path_manager.rb CHANGED
@@ -7,7 +7,8 @@ module PathManager
7
7
  include Thor::Actions
8
8
  no_commands do
9
9
  def get_path_location
10
- file = File.read("./config.json")
10
+ puts File.dirname(__FILE__) + "config.json"
11
+ file = File.read(File.dirname(__FILE__) + "/config.json")
11
12
  configs = JSON.parse(file, symbolize_names: true)
12
13
  regex = /Shell: \/bin\/([a-zA-Z\/]*)/i
13
14
  info = %x[finger `whoami`]
@@ -57,6 +58,7 @@ module PathManager
57
58
  location = get_path_location
58
59
  File.open(location[:path], "r+") do |file|
59
60
  while (location[:line] -= 1) > 0
61
+ file.readline
60
62
  end
61
63
  pos = file.pos
62
64
  regex = /((?:\/|~).+)/
@@ -68,7 +70,6 @@ module PathManager
68
70
  path_items = path_items.join(":")
69
71
  rest = file.read
70
72
  file.seek pos
71
- final_path = "export PATH=" + path_items + ":$PATH\n"
72
73
  file.write "export PATH=" + path_items + ":$PATH\n"
73
74
  file.write rest
74
75
  end
@@ -79,6 +80,7 @@ module PathManager
79
80
  location = get_path_location
80
81
  File.open(location[:path], "r+") do |file|
81
82
  while (location[:line] -= 1) > 0
83
+ file.readline
82
84
  end
83
85
  pos = file.pos
84
86
  regex = /((?:\/|~).+)/
@@ -90,7 +92,6 @@ module PathManager
90
92
  path_items = path_items.join(":")
91
93
  rest = file.read
92
94
  file.seek pos
93
- final_path = "export PATH=" + path_items + ":$PATH\n"
94
95
  file.write "export PATH=" + path_items + ":$PATH\n"
95
96
  file.write rest
96
97
  end
@@ -1,3 +1,3 @@
1
1
  module PathManager
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: path_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charley Hutchison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-07 00:00:00.000000000 Z
11
+ date: 2014-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.4.1
107
+ rubygems_version: 2.2.2
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Helps manage your $PATH variable.