pro 1.1.5 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3db7f68df476b807f22c2d69fce741dbe6cb9940
4
- data.tar.gz: 95a0ced81a2cf42b99bb91deb5d47b48895136eb
3
+ metadata.gz: bac7d8d2053e0da160ba6538267c02fac60d3296
4
+ data.tar.gz: 9612b95281dd1742e4b4cf9bcccacc62dd5cbfb4
5
5
  SHA512:
6
- metadata.gz: 70eb07a63a67d9986b5a801b68d1e6ad64016e68d670efbc33d69981571cdd7a9bb8b74c574297e95761155bb44c4693cfbcd8b6e5e946a315c95e254d27a315
7
- data.tar.gz: b9c79cb990b22445219cb8bc77b89eb5e9871f7a81b57d39305d302a483f1065d9b5d70b66b37909062ea158e851aff08020dc2c8ba0aa0f05de04868cbef5da
6
+ metadata.gz: 120a20d1a8fbafb8ee31313b1136ff41850c98dde9d29963e099773ca06e18e3dd527e3f92240c973514e771d3376f7cb6c7a8beea031ad0782567977ee8afc4
7
+ data.tar.gz: f4bf179ae60d60086ad5c5a66d0fc75d9b46f3228a704dd86780d351c5fe88168b06d17f97adf3cf85a42bc389cb8491a1068535bdc9f7b310e2622ef6a29ec6
@@ -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 = `#{command}`
60
- puts "#{r.name}:".bold.red
61
- puts result
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
 
@@ -104,12 +104,20 @@ module Pro
104
104
 
105
105
  def index_repos_fast(base)
106
106
  Dir.chdir(base)
107
- res = `find . -name .git`
108
- # turn the output into a list of repos
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
- res.each_line do |line|
111
- next if line.empty?
112
- git_path = File.expand_path(line.chomp)
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?(path) && File.exists?(path+"/.git")
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
@@ -1,3 +1,3 @@
1
1
  module Pro
2
- VERSION = "1.1.5"
2
+ VERSION = "1.2.0"
3
3
  end
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.1.5
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: 2014-05-19 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fuzzy_match