forked from cykod/Webiva
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit
More file actions
executable file
·59 lines (46 loc) · 1.3 KB
/
commit
File metadata and controls
executable file
·59 lines (46 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env ruby
# my take on a easy commit script for rails...
# it is far from prefect, so:
# please feed back the modifications you made to it!
#
# by Cies Breijs -- cies.breijsATgmailDOTcom
# based on a bash script by Anonymous Gentleman
# found here: http://wiki.rubyonrails.org/rails/pages/HowtoUseRailsWithSubversion
to_add = []
to_remove = []
to_checkin = []
`svn status`.each_line do |l|
action_char, path = l.split(' ', 2)
path.strip!
case action_char
when '?'
to_add << path
when '!'
to_remove << path
when 'M'
to_checkin << path
end
end
puts "\nyou are about to..."
def print_list(array, str)
puts "\n#{str}:"
array.each { |i| puts "\t"+i }
puts "\t<nothing>" if array.length == 0
end
print_list(to_add, 'add')
print_list(to_remove, 'remove')
print_list(to_checkin, 'checkin')
puts "\nplease write something for the commit log and hit enter..."
puts "(hitting enter on an empty line will cancel this commit)\n\n"
log = gets.strip
if log.empty?
puts "commit cancelled!\n"
exit
end
puts "\ncontacting repository...\n"
`svn add #{to_add.join(' ')}`
`svn remove #{to_remove.join(' ')}`
puts "\n" + `svn commit -m "#{log.gsub('"', '\"')}"` + "\n"
puts "running 'svn update' to be shure we are up-to-date..."
puts `svn update`
puts "\nfinished.\n"