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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zewo/version.rb +1 -1
  3. data/lib/zewo.rb +24 -6
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1fce2b95a2225f242cf7a04a289bc52f9f658a4
4
- data.tar.gz: 185fef6e048f6e6eaf6a0b256b19fcb4becea201
3
+ metadata.gz: 8eebbdadabfe94b2f519bf3009ae8497333858c0
4
+ data.tar.gz: 0db9baf3c3a4696e9609397d57443a7a588c244c
5
5
  SHA512:
6
- metadata.gz: c1b89e01a06efaa73a4919648d0a86e77385f3c9a2ddad2107fa35953080852211d37e23d5c05cd4292a9ccb7cf7486f32e9c78627ffeee076cbd939f10ed191
7
- data.tar.gz: 84c117c5ff55372ee4e87aab088b80a811046a1a84cb8a50febfdabfeb3339623dbb601dde38c28041d02695a2f03e1c8e6d2af503c95e18279809d39d9cfdf8
6
+ metadata.gz: fbc6393f9a8dd82d591498d7617c0c21408e2feb3be8421c4103d5ee529c25a70b4af2734273e5026d9a6172912b8036be860ca601c922d756d71c44ec80bc35
7
+ data.tar.gz: f730684bc8a6195aa367443dadb459c18bdf6dbff93505cd93196bbfb594866bfaa98f046ea4f48a393af2f8d8b01e358941382ac784b5b8f9d9cf3dc2d6e531
data/lib/zewo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zewo
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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
- self.push if prompt('Push changes?')
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
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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ask