alterpath 0.1.0
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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/alterpath.gemspec +26 -0
- data/bin/alterpath +3 -0
- data/lib/alterpath/cli.rb +101 -0
- data/lib/alterpath/version.rb +3 -0
- data/lib/alterpath.rb +1 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b8c95fd692ab55f0083cdbbcfc232e23249a0aac
|
4
|
+
data.tar.gz: ff1475b58d6fa1d4560d053fa2a5e6e6fc44d02e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 81b44c043bfc459484c145f5b2a94b838f08489860658c2cf5a1846f0f2b2eb3752b5d20d9f36b3dd34f4e345c6b5047a04be01f8d03cacd5af26d9dca03ad08
|
7
|
+
data.tar.gz: b421d2f8fdef04dc6ee363046918892053dd4990a7cf95ccd21a340368471a38fbf407b946cbdcd4ac24335b49e7ba3d80211b44063c1fac31e1e00e47d2b9e7
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 MOZGIII
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Alterpath
|
2
|
+
|
3
|
+
Alterpath allows you to manipulate the system `PATH` (environment variable) on Windows in a flexible manner.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
- Windows
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
$ gem install alterpath
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
$ alterpath -h
|
16
|
+
Read the usage instructions shown.
|
17
|
+
|
18
|
+
$ alterpath prepend "C:\test"
|
19
|
+
Prepending PATH with "C:\test"!
|
20
|
+
|
21
|
+
$ alterpath list
|
22
|
+
C:\test
|
23
|
+
...
|
24
|
+
|
25
|
+
$ alterpath remove "C:\test"
|
26
|
+
Removing "C:\test" from PATH!
|
27
|
+
|
28
|
+
|
29
|
+
## Notes
|
30
|
+
|
31
|
+
If the item you're adding is already in `PATH`,
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/alterpath.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'alterpath/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "alterpath"
|
8
|
+
spec.version = Alterpath::VERSION
|
9
|
+
spec.authors = ["MOZGIII"]
|
10
|
+
spec.email = ["mike-n@narod.ru"]
|
11
|
+
spec.description = %q{Alterpath allows you to alter the system PATH on Windows in a flexible manner}
|
12
|
+
spec.summary = %q{Alterpath allows you to alter the system PATH on Windows in a flexible manner}
|
13
|
+
spec.homepage = "https://github.com/MOZGIII/alterpath"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "slop", ">= 3.4.7"
|
22
|
+
spec.add_dependency "win-path-utils", ">= 0.0.1"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
end
|
data/bin/alterpath
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'slop'
|
2
|
+
require 'win-path-utils'
|
3
|
+
|
4
|
+
module Alterpath
|
5
|
+
module CLI
|
6
|
+
class << self
|
7
|
+
def start
|
8
|
+
appname = File.basename($0)
|
9
|
+
opts = Slop.parse(strict: true, help: true) do
|
10
|
+
banner "Usage: #{appname} command [options]"
|
11
|
+
|
12
|
+
on :v, :version, 'Print the version.' do
|
13
|
+
require 'win-path-utils/version'
|
14
|
+
require 'alterpath/version'
|
15
|
+
|
16
|
+
puts "Alterpath version: #{VERSION}"
|
17
|
+
puts "WinPathUtils version: #{WinPathUtils::VERSION}"
|
18
|
+
|
19
|
+
exit
|
20
|
+
end
|
21
|
+
|
22
|
+
command 'append' do
|
23
|
+
description "Adds the specified path to the end of system PATH variable."
|
24
|
+
banner "Usage: #{appname} append [-f] path"
|
25
|
+
on :f, :force, "Add even if already found in PATH."
|
26
|
+
run &Alterpath::CLI.method(:append)
|
27
|
+
end
|
28
|
+
|
29
|
+
command 'prepend' do
|
30
|
+
description "Adds the specified path to the beginning of system PATH variable."
|
31
|
+
banner "Usage: #{appname} prepend [-f] path"
|
32
|
+
on :f, :force, "Add even if already found in PATH."
|
33
|
+
run &Alterpath::CLI.method(:prepend)
|
34
|
+
end
|
35
|
+
|
36
|
+
command 'remove' do
|
37
|
+
description "Removes the specified path from the system PATH variable."
|
38
|
+
banner "Usage: #{appname} remove path"
|
39
|
+
run &Alterpath::CLI.method(:remove)
|
40
|
+
end
|
41
|
+
|
42
|
+
command 'list' do
|
43
|
+
description "Lists current system PATH variable, one entry per line."
|
44
|
+
banner "Usage: #{appname} list"
|
45
|
+
run &Alterpath::CLI.method(:list)
|
46
|
+
end
|
47
|
+
|
48
|
+
command 'get' do
|
49
|
+
description "Prints current system PATH variable as is."
|
50
|
+
banner "Usage: #{appname} get"
|
51
|
+
run &Alterpath::CLI.method(:get)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
puts opts
|
56
|
+
end
|
57
|
+
|
58
|
+
def path
|
59
|
+
@path ||= WinPathUtils::Path.new
|
60
|
+
end
|
61
|
+
|
62
|
+
def get_addition_options(opts)
|
63
|
+
opts[:force] ? { duplication_filter: :none } : {}
|
64
|
+
end
|
65
|
+
|
66
|
+
def append(opts, args)
|
67
|
+
args.each do |arg|
|
68
|
+
puts "Appending \"#{arg}\" to PATH!"
|
69
|
+
path.append(arg, get_addition_options(opts))
|
70
|
+
exit
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def prepend(opts, args)
|
75
|
+
args.each do |arg|
|
76
|
+
puts "Prepending PATH with \"#{arg}\"!"
|
77
|
+
path.prepend(arg, get_addition_options(opts))
|
78
|
+
exit
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def remove(opts, args)
|
83
|
+
args.each do |arg|
|
84
|
+
puts "Removing \"#{arg}\" from PATH!"
|
85
|
+
path.remove(arg)
|
86
|
+
exit
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def list(opts, args)
|
91
|
+
puts *path.get_array
|
92
|
+
exit
|
93
|
+
end
|
94
|
+
|
95
|
+
def get(opts, args)
|
96
|
+
puts path.get
|
97
|
+
exit
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
data/lib/alterpath.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "alterpath/version"
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alterpath
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- MOZGIII
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: slop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.4.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.4.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: win-path-utils
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Alterpath allows you to alter the system PATH on Windows in a flexible
|
70
|
+
manner
|
71
|
+
email:
|
72
|
+
- mike-n@narod.ru
|
73
|
+
executables:
|
74
|
+
- alterpath
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- .gitignore
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- alterpath.gemspec
|
84
|
+
- bin/alterpath
|
85
|
+
- lib/alterpath.rb
|
86
|
+
- lib/alterpath/cli.rb
|
87
|
+
- lib/alterpath/version.rb
|
88
|
+
homepage: https://github.com/MOZGIII/alterpath
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.1.10
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Alterpath allows you to alter the system PATH on Windows in a flexible manner
|
112
|
+
test_files: []
|