pro 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -6
- data/bin/pro +9 -1
- data/lib/pro.rb +22 -13
- data/lib/pro/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: 07227b6c46ae38f06d1f71d88f7af991c8529961
|
4
|
+
data.tar.gz: 4f47220c46cada7a220f9d697c27cd93c2f4ef3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bf92b9b967ce02ec82c2423dcc2deda45f9c2d3b374ea1e02b333fe21372cc6698f0ba8c79da7378f9d59a9eeebdd03fe833a0506f9df9bfa91e6585f874f98
|
7
|
+
data.tar.gz: 2d863cb3c27e014c3512ed4175f8fede472100d8b1d22111e877bb01c79ba3d3cab0ff769a7b0151a9c0c914e2ea70cc311f72f4d517276b1ced68d3cbc0b6ac
|
data/README.md
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
It includes features like instantly cd'ing to your git repos and getting a
|
5
5
|
status overview, and running an arbitrary command in every git repo.
|
6
6
|
|
7
|
-
Note that pro only currently works on Unix systems. If you experience speed issues
|
8
|
-
see the section on setting a pro base
|
7
|
+
Note that pro only currently works on Unix systems. **If you experience speed issues
|
8
|
+
see the section on setting a pro base.**
|
9
9
|
|
10
10
|
## CD'ing to a project's repository
|
11
11
|
|
@@ -21,6 +21,8 @@ Once you have it you can do some pretty intense cd'ing:
|
|
21
21
|
|
22
22
|
![pd demo](http://thume.ca/assets/postassets/pro/pd_screen.png)
|
23
23
|
|
24
|
+
**Protip:** running `pd` with no arguments changes to the pro base.
|
25
|
+
|
24
26
|
## State of the Repos Address
|
25
27
|
|
26
28
|
Oftentimes I find myself wondering which git repositories of mine still have
|
@@ -52,8 +54,11 @@ Notice that it double checks before running so you don't accidentally run
|
|
52
54
|
`pro` can use a base directory to speed up its search for git repos. By default it
|
53
55
|
uses your home folder.
|
54
56
|
|
55
|
-
To set the base directory
|
56
|
-
|
57
|
+
To set the base directory set the PRO_BASE environment variable or make
|
58
|
+
a ~/.proBase file containing the path. The .proBase file can contain many lines
|
59
|
+
each with a path to a folder to search. Pro will search the path in the PRO_BASE
|
60
|
+
variable as well as all paths in the .proBase file. If neither exists then the home
|
61
|
+
directory will be used.
|
57
62
|
|
58
63
|
## Installation
|
59
64
|
|
@@ -73,7 +78,10 @@ You may also want to set your Pro Base. See the above section.
|
|
73
78
|
they don't have to be at the base level, just somewhere down the tree.
|
74
79
|
|
75
80
|
To set the base directory set the PRO_BASE environment variable or make
|
76
|
-
a ~/.proBase file containing the path.
|
81
|
+
a ~/.proBase file containing the path. The .proBase file can contain many lines
|
82
|
+
each with a path to a folder to search. Pro will search the path in the PRO_BASE
|
83
|
+
variable as well as all paths in the .proBase file. If neither exists then the home
|
84
|
+
directory will be used.
|
77
85
|
|
78
86
|
Commands ===============
|
79
87
|
pro search <query> - prints path of git repo that matches query.
|
@@ -88,12 +96,16 @@ You may also want to set your Pro Base. See the above section.
|
|
88
96
|
You can use the 'pro install' command to install a wrapper shell function that allows
|
89
97
|
you to cd to git repositories in your Pro Base wherever you are based on fuzzy matching.
|
90
98
|
|
99
|
+
Just running 'pd' cd's to the pro base.
|
100
|
+
|
91
101
|
Example:
|
92
102
|
|
93
103
|
~/randomFolder/ $ pd pro
|
94
104
|
pro/ $ pwd
|
95
105
|
/Users/tristan/Box/Dev/Projects/pro
|
96
|
-
|
106
|
+
pro/ $ pd
|
107
|
+
Dev/ $ pwd
|
108
|
+
/Users/tristan/Box/Dev
|
97
109
|
|
98
110
|
## Contributing
|
99
111
|
|
data/bin/pro
CHANGED
@@ -12,7 +12,10 @@ This is the folder that contains all your other git repositories;
|
|
12
12
|
they don't have to be at the base level, just somewhere down the tree.
|
13
13
|
|
14
14
|
To set the base directory set the PRO_BASE environment variable or make
|
15
|
-
a ~/.proBase file containing the path.
|
15
|
+
a ~/.proBase file containing the path. The .proBase file can contain many lines
|
16
|
+
each with a path to a folder to search. Pro will search the path in the PRO_BASE
|
17
|
+
variable as well as all paths in the .proBase file. If neither exists then the home
|
18
|
+
directory will be used.
|
16
19
|
|
17
20
|
Commands ===============
|
18
21
|
pro search <query> - prints path of git repo that matches query.
|
@@ -27,11 +30,16 @@ CD Command ============
|
|
27
30
|
You can use the 'pro install' command to install a wrapper shell function that allows
|
28
31
|
you to cd to git repositories in your Pro Base wherever you are based on fuzzy matching.
|
29
32
|
|
33
|
+
Just running 'pd' cd's to the pro base.
|
34
|
+
|
30
35
|
Example:
|
31
36
|
|
32
37
|
~/randomFolder/ $ pd pro
|
33
38
|
pro/ $ pwd
|
34
39
|
/Users/tristan/Box/Dev/Projects/pro
|
40
|
+
pro/ $ pd
|
41
|
+
Dev/ $ pwd
|
42
|
+
/Users/tristan/Box/Dev
|
35
43
|
|
36
44
|
END
|
37
45
|
|
data/lib/pro.rb
CHANGED
@@ -33,31 +33,37 @@ module Pro
|
|
33
33
|
# Finds the base directory where repos are kept
|
34
34
|
# Checks the environment variable PRO_BASE and the
|
35
35
|
# file .proBase
|
36
|
-
def self.
|
36
|
+
def self.base_dirs()
|
37
|
+
bases = []
|
37
38
|
# check environment first
|
38
39
|
base = ENV['PRO_BASE']
|
39
|
-
|
40
|
+
bases << base if base
|
40
41
|
# next check proBase file
|
41
42
|
path = ENV['HOME'] + "/.proBase"
|
42
|
-
base = ENV['HOME'] # default to home
|
43
43
|
if File.exists?(path)
|
44
|
-
base
|
45
|
-
|
44
|
+
# read lines of the pro base file
|
45
|
+
bases += IO.read(path).split("\n").map {|p| File.expand_path(p.strip)}
|
46
46
|
end
|
47
|
-
|
47
|
+
# strip bases that do not exist
|
48
|
+
bases.select! {|b| File.exists?(b)}
|
49
|
+
# if no bases then return home
|
50
|
+
bases << ENV['HOME'] if bases.empty?
|
51
|
+
bases
|
48
52
|
end
|
49
53
|
|
50
54
|
# Searches for all the git repositories in the base directory.
|
51
55
|
# returns an array of [repo_name, path] pairs.
|
52
56
|
def self.repo_list
|
53
57
|
repos = []
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
Pro.base_dirs.each do |base|
|
59
|
+
Find.find(base) do |path|
|
60
|
+
if FileTest.directory?(path)
|
61
|
+
# is this folder a git repo
|
62
|
+
if File.exists?(path+"/.git")
|
63
|
+
base_name = File.basename(path)
|
64
|
+
repos << [base_name,path]
|
65
|
+
Find.prune
|
66
|
+
end
|
61
67
|
end
|
62
68
|
end
|
63
69
|
end
|
@@ -66,7 +72,10 @@ module Pro
|
|
66
72
|
|
67
73
|
# Fuzzy search for a git repository by name
|
68
74
|
# Returns the full path to the repository.
|
75
|
+
#
|
76
|
+
# If name is nil return the pro base.
|
69
77
|
def self.find_repo(name)
|
78
|
+
return Pro.base_dirs.first unless name
|
70
79
|
repos = Pro.repo_list
|
71
80
|
match = FuzzyMatch.new(repos, :read => :first).find(name)
|
72
81
|
match[1] unless match.nil?
|
data/lib/pro/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tristan Hume
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fuzzy_match
|