pro 1.1.5 → 1.2.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 +4 -4
- data/lib/pro/commands.rb +10 -4
- data/lib/pro/indexer.rb +20 -6
- 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: bac7d8d2053e0da160ba6538267c02fac60d3296
|
4
|
+
data.tar.gz: 9612b95281dd1742e4b4cf9bcccacc62dd5cbfb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 120a20d1a8fbafb8ee31313b1136ff41850c98dde9d29963e099773ca06e18e3dd527e3f92240c973514e771d3376f7cb6c7a8beea031ad0782567977ee8afc4
|
7
|
+
data.tar.gz: f4bf179ae60d60086ad5c5a66d0fc75d9b46f3228a704dd86780d351c5fe88168b06d17f97adf3cf85a42bc389cb8491a1068535bdc9f7b310e2622ef6a29ec6
|
data/lib/pro/commands.rb
CHANGED
@@ -2,6 +2,7 @@ require "pro/index"
|
|
2
2
|
require "find"
|
3
3
|
require "fuzzy_match"
|
4
4
|
require "colored"
|
5
|
+
require "open3"
|
5
6
|
|
6
7
|
SHELL_FUNCTION = <<END
|
7
8
|
|
@@ -40,7 +41,7 @@ module Pro
|
|
40
41
|
|
41
42
|
# Fuzzy search for a git repository by name
|
42
43
|
# Returns the full path to the repository.
|
43
|
-
#
|
44
|
+
#
|
44
45
|
# If name is nil return the pro base.
|
45
46
|
def find_repo(name)
|
46
47
|
return @index.base_dirs.first unless name
|
@@ -56,9 +57,14 @@ module Pro
|
|
56
57
|
end
|
57
58
|
@index.each do |r|
|
58
59
|
Dir.chdir(r.path)
|
59
|
-
result =
|
60
|
-
|
61
|
-
|
60
|
+
stdin, result, wait_thr = Open3.popen2e(command)
|
61
|
+
if wait_thr.value == 0
|
62
|
+
puts "#{r.name}:".bold.green
|
63
|
+
else
|
64
|
+
puts "#{r.name}:".bold.red
|
65
|
+
end
|
66
|
+
puts result.read
|
67
|
+
[stdin, result].map &:close
|
62
68
|
end
|
63
69
|
end
|
64
70
|
|
data/lib/pro/indexer.rb
CHANGED
@@ -104,12 +104,20 @@ module Pro
|
|
104
104
|
|
105
105
|
def index_repos_fast(base)
|
106
106
|
Dir.chdir(base)
|
107
|
-
|
108
|
-
#
|
107
|
+
git_paths = `find . -name .git`.lines
|
108
|
+
# additionally, index repos symlinked directly from a base root
|
109
|
+
dirs = `find -L . -maxdepth 1 -type d`.lines
|
110
|
+
symlinks = `find . -maxdepth 1 -type l`.lines
|
111
|
+
# intersect those two results
|
112
|
+
dir_sl = dirs & symlinks
|
113
|
+
dir_sl_git_paths = dir_sl.
|
114
|
+
map {|path| path.chomp + '/.git'}.
|
115
|
+
select {|path| File.exists?(path)}
|
116
|
+
# turn the command outputs into a list of repos
|
109
117
|
repos = []
|
110
|
-
|
111
|
-
next if
|
112
|
-
git_path = File.expand_path(
|
118
|
+
(git_paths + dir_sl_git_paths).each do |git_path|
|
119
|
+
next if git_path.empty?
|
120
|
+
git_path = File.expand_path(git_path.chomp)
|
113
121
|
path = File.dirname(git_path)
|
114
122
|
repo_name = File.basename(path)
|
115
123
|
repos << Repo.new(repo_name,path)
|
@@ -122,8 +130,14 @@ module Pro
|
|
122
130
|
STDERR.puts "WARNING: pro is indexing slowly, please install the 'find' command."
|
123
131
|
repos = []
|
124
132
|
Find.find(base) do |path|
|
133
|
+
target = path
|
134
|
+
# additionally, index repos symlinked directly from a base root
|
135
|
+
if FileTest.symlink?(path)
|
136
|
+
next if File.dirname(path) != base
|
137
|
+
target = File.readlink(path)
|
138
|
+
end
|
125
139
|
# dir must exist and be a git repo
|
126
|
-
if FileTest.directory?(
|
140
|
+
if FileTest.directory?(target) && File.exists?(path+"/.git")
|
127
141
|
base_name = File.basename(path)
|
128
142
|
repos << Repo.new(base_name,path)
|
129
143
|
Find.prune
|
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.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tristan Hume
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fuzzy_match
|