zewo-dev 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zewo/version.rb +1 -1
- data/lib/zewo.rb +24 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eebbdadabfe94b2f519bf3009ae8497333858c0
|
4
|
+
data.tar.gz: 0db9baf3c3a4696e9609397d57443a7a588c244c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbc6393f9a8dd82d591498d7617c0c21408e2feb3be8421c4103d5ee529c25a70b4af2734273e5026d9a6172912b8036be860ca601c922d756d71c44ec80bc35
|
7
|
+
data.tar.gz: f730684bc8a6195aa367443dadb459c18bdf6dbff93505cd93196bbfb594866bfaa98f046ea4f48a393af2f8d8b01e358941382ac784b5b8f9d9cf3dc2d6e531
|
data/lib/zewo/version.rb
CHANGED
data/lib/zewo.rb
CHANGED
@@ -49,6 +49,19 @@ module Zewo
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
def verify_branches
|
53
|
+
last_branch_name = nil
|
54
|
+
each_repo do |repo|
|
55
|
+
branch_name = `cd #{repo.name}; git rev-parse --abbrev-ref HEAD`.gsub("\n", "")
|
56
|
+
if !last_branch_name.nil? && branch_name != last_branch_name
|
57
|
+
puts "Branch mismatch. Branch of #{repo.name} does not match previous branch #{branch_name}".red
|
58
|
+
return false
|
59
|
+
end
|
60
|
+
last_branch_name = branch_name
|
61
|
+
end
|
62
|
+
true
|
63
|
+
end
|
64
|
+
|
52
65
|
def prompt(question)
|
53
66
|
printf "#{question} - press 'y' to continue: "
|
54
67
|
p = STDIN.gets.chomp
|
@@ -99,6 +112,8 @@ module Zewo
|
|
99
112
|
|
100
113
|
desc :push, 'git push on all repos'
|
101
114
|
def push
|
115
|
+
verify_branches
|
116
|
+
|
102
117
|
each_repo do |repo|
|
103
118
|
if uncommited_changes?(repo.name)
|
104
119
|
puts "Uncommitted changes in #{repo.name}. Skipping.."
|
@@ -119,6 +134,7 @@ module Zewo
|
|
119
134
|
end
|
120
135
|
end
|
121
136
|
|
137
|
+
|
122
138
|
desc :build, 'Clones all Zewo repositories'
|
123
139
|
def build
|
124
140
|
each_repo do |repo|
|
@@ -134,7 +150,10 @@ module Zewo
|
|
134
150
|
desc 'commit MESSAGE', 'Commits changes to all repos with the same commit message'
|
135
151
|
def commit(message)
|
136
152
|
|
153
|
+
return unless verify_branches
|
154
|
+
|
137
155
|
each_repo do |repo|
|
156
|
+
|
138
157
|
next unless uncommited_changes?(repo.name)
|
139
158
|
puts repo.name
|
140
159
|
puts '--------------------------------------------------------------'
|
@@ -142,19 +161,18 @@ module Zewo
|
|
142
161
|
puts 'Status:'.yellow
|
143
162
|
system("cd #{repo.name}; git status")
|
144
163
|
return unless prompt("Proceed with #{repo.name}?")
|
145
|
-
puts 'Diff (press q to exit):'.yellow
|
146
|
-
system("cd #{repo.name}; git diff")
|
147
164
|
end
|
148
165
|
|
149
|
-
puts "Warning. You're not in the master branch".yellow unless master_branch?(repo.name)
|
150
|
-
puts "\n"
|
151
166
|
|
152
|
-
return unless prompt('Changes look ok?')
|
153
167
|
system("cd #{repo.name}; git add --all; git commit -am #{message}")
|
154
168
|
puts "Commited #{repo.name}\n".green
|
155
169
|
|
156
170
|
end
|
157
|
-
|
171
|
+
if prompt('Pull & push changes?'.red)
|
172
|
+
self.push
|
173
|
+
self.push
|
174
|
+
end
|
175
|
+
|
158
176
|
end
|
159
177
|
end
|
160
178
|
end
|