zewo-dev 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zewo/version.rb +1 -1
  3. data/lib/zewo.rb +29 -17
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8eebbdadabfe94b2f519bf3009ae8497333858c0
4
- data.tar.gz: 0db9baf3c3a4696e9609397d57443a7a588c244c
3
+ metadata.gz: d1782ea9eb7440700d26ff53788839bc0c8a1cb2
4
+ data.tar.gz: a1e14228bb665ab049fc6145aded9a52b3ab5b73
5
5
  SHA512:
6
- metadata.gz: fbc6393f9a8dd82d591498d7617c0c21408e2feb3be8421c4103d5ee529c25a70b4af2734273e5026d9a6172912b8036be860ca601c922d756d71c44ec80bc35
7
- data.tar.gz: f730684bc8a6195aa367443dadb459c18bdf6dbff93505cd93196bbfb594866bfaa98f046ea4f48a393af2f8d8b01e358941382ac784b5b8f9d9cf3dc2d6e531
6
+ metadata.gz: 20b3fe7ae8ce547c86b47e5e71d145d37e7611d960f0d82ecd809f91723bf50502281db202f177a8deb3a105afc2da4b846f0fd7c03ea76426dd498ad2a76a44
7
+ data.tar.gz: 4f06820f8bde258ac81b37ed4bce69b3f94cbc3edadc8ad223132bf62a0d32d9eb9b945241b4fdaa75d52c943adafc41f65d0b1f20c6fab344792928dd260533
data/lib/zewo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zewo
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/zewo.rb CHANGED
@@ -9,8 +9,8 @@ require 'fileutils'
9
9
  require 'pathname'
10
10
  require 'xcodeproj'
11
11
  require 'colorize'
12
-
13
-
12
+ require 'thread'
13
+ require 'thwait'
14
14
 
15
15
  module Zewo
16
16
  class App < Thor
@@ -49,6 +49,16 @@ module Zewo
49
49
  end
50
50
  end
51
51
 
52
+ def each_repo_async
53
+ threads = []
54
+ each_repo do |repo|
55
+ threads << Thread.new {
56
+ yield(repo)
57
+ }
58
+ end
59
+ ThreadsWait.all_waits(*threads)
60
+ end
61
+
52
62
  def verify_branches
53
63
  last_branch_name = nil
54
64
  each_repo do |repo|
@@ -82,7 +92,7 @@ module Zewo
82
92
  end
83
93
  end
84
94
 
85
- desc :status, 'Intialize'
95
+ desc :status, 'Get status of all repos'
86
96
  def status
87
97
  each_repo do |repo|
88
98
  str = repo.name
@@ -100,38 +110,43 @@ module Zewo
100
110
 
101
111
  desc :pull, 'git pull on all repos'
102
112
  def pull
103
- each_repo do |repo|
104
- puts "Updating #{repo.name}...".green
113
+
114
+ each_repo_async do |repo|
115
+ print "Updating #{repo.name}..." + "\n"
105
116
  if uncommited_changes?(repo.name)
106
- puts "Uncommitted changes in #{repo.name}. Not updating.".red
117
+ print "Uncommitted changes in #{repo.name}. Not updating.".red + "\n"
107
118
  next
108
119
  end
109
- system("cd #{repo.name}; git pull")
120
+ system("cd #{repo.name}; git pull > /dev/null 2>&1")
121
+ print "Updated #{repo.name}".green + "\n"
110
122
  end
123
+
111
124
  end
112
125
 
113
126
  desc :push, 'git push on all repos'
114
127
  def push
115
128
  verify_branches
116
129
 
117
- each_repo do |repo|
130
+ each_repo_async do |repo|
118
131
  if uncommited_changes?(repo.name)
119
- puts "Uncommitted changes in #{repo.name}. Skipping.."
132
+ print "Uncommitted changes in #{repo.name}. Skipping.." + "\n"
120
133
  next
121
134
  end
122
- puts "Pushing #{repo.name}...".green
123
- system("cd #{repo.name}; git push")
135
+ print "Pushing #{repo.name}...".green + "\n"
136
+ system("cd #{repo.name}; git push > /dev/null 2>&1")
124
137
  end
138
+ print 'Done!' + "\n"
125
139
  end
126
140
 
127
141
  desc :init, 'Clones all Zewo repositories'
128
142
  def init
129
- each_repo do |repo|
143
+ each_repo_async do |repo|
130
144
  unless File.directory?(repo.name)
131
- puts "Cloning #{repo.name}...".green
145
+ print "Cloning #{repo.name}...".green + "\n"
132
146
  system("git clone #{repo.data['ssh_url']} > /dev/null 2>&1")
133
147
  end
134
148
  end
149
+ puts 'Done!'
135
150
  end
136
151
 
137
152
 
@@ -149,11 +164,9 @@ module Zewo
149
164
 
150
165
  desc 'commit MESSAGE', 'Commits changes to all repos with the same commit message'
151
166
  def commit(message)
152
-
153
167
  return unless verify_branches
154
168
 
155
169
  each_repo do |repo|
156
-
157
170
  next unless uncommited_changes?(repo.name)
158
171
  puts repo.name
159
172
  puts '--------------------------------------------------------------'
@@ -163,13 +176,12 @@ module Zewo
163
176
  return unless prompt("Proceed with #{repo.name}?")
164
177
  end
165
178
 
166
-
167
179
  system("cd #{repo.name}; git add --all; git commit -am #{message}")
168
180
  puts "Commited #{repo.name}\n".green
169
181
 
170
182
  end
171
183
  if prompt('Pull & push changes?'.red)
172
- self.push
184
+ self.pull
173
185
  self.push
174
186
  end
175
187
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zewo-dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ask