go2dir 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/bin/go2dir.rb +5 -0
- data/go2dir.gemspec +20 -0
- data/lib/go2dir/storage.rb +18 -0
- data/lib/go2dir/version.rb +3 -0
- data/lib/go2dir.rb +26 -0
- metadata +58 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Bruno Costa
|
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,29 @@
|
|
1
|
+
# Go2dir
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'go2dir'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install go2dir
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/go2dir.rb
ADDED
data/go2dir.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/go2dir/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Bruno Costa"]
|
6
|
+
gem.email = ["bruno.costa@hardquarters.com"]
|
7
|
+
gem.summary = "go2dir is a shorcut manager to speed up your command line cding"
|
8
|
+
gem.description = "Are you tired of typing over and over again the same paths to the
|
9
|
+
same directories? go2dir lets you create shortcuts for your most used paths and change
|
10
|
+
lightning fast your current directory."
|
11
|
+
|
12
|
+
gem.homepage = "https://github.com/brunohq/go2dir"
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split($\)
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.name = "go2dir"
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
gem.version = Go2dir::VERSION
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Go2dir::Storage
|
2
|
+
class << self
|
3
|
+
STORAGE_FILE = "#{ENV['HOME']}/.go2dir"
|
4
|
+
|
5
|
+
def storage_file
|
6
|
+
STORAGE_FILE
|
7
|
+
end
|
8
|
+
|
9
|
+
def save(json)
|
10
|
+
File.open(storage_file,"w") { |f| f << json.to_json }
|
11
|
+
end
|
12
|
+
|
13
|
+
def load
|
14
|
+
json = File.read(storage_file)
|
15
|
+
JSON.parse(json)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/go2dir.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'go2dir/version'
|
3
|
+
require 'go2dir/storage'
|
4
|
+
|
5
|
+
module Go2dir
|
6
|
+
class << self
|
7
|
+
|
8
|
+
def execute(*args)
|
9
|
+
return help if args.empty?
|
10
|
+
return change_dir(args[0]) if args.length == 1
|
11
|
+
return add_shortcut(args[0], args[1]) if args.length == 2
|
12
|
+
end
|
13
|
+
|
14
|
+
def change_dir(shortcut)
|
15
|
+
shortcuts = Go2dir::Storage.load
|
16
|
+
puts shortcuts[shortcut]
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_shortcut(shortcut, path)
|
20
|
+
shortcuts = Go2dir::Storage.load
|
21
|
+
shortcuts[shortcut] = path
|
22
|
+
Go2dir::Storage.save(shortcuts)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: go2dir
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bruno Costa
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-13 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: ! "Are you tired of typing over and over again the same paths to the\n
|
15
|
+
\ same directories? go2dir lets you create shortcuts for your most used paths and
|
16
|
+
change\n lightning fast your current directory."
|
17
|
+
email:
|
18
|
+
- bruno.costa@hardquarters.com
|
19
|
+
executables:
|
20
|
+
- go2dir.rb
|
21
|
+
extensions: []
|
22
|
+
extra_rdoc_files: []
|
23
|
+
files:
|
24
|
+
- .gitignore
|
25
|
+
- Gemfile
|
26
|
+
- LICENSE
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- bin/go2dir.rb
|
30
|
+
- go2dir.gemspec
|
31
|
+
- lib/go2dir.rb
|
32
|
+
- lib/go2dir/storage.rb
|
33
|
+
- lib/go2dir/version.rb
|
34
|
+
homepage: https://github.com/brunohq/go2dir
|
35
|
+
licenses: []
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 1.8.21
|
55
|
+
signing_key:
|
56
|
+
specification_version: 3
|
57
|
+
summary: go2dir is a shorcut manager to speed up your command line cding
|
58
|
+
test_files: []
|