summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'projects/gentoolkit-nichoj/trunk/rubycommit.rb')
-rwxr-xr-xprojects/gentoolkit-nichoj/trunk/rubycommit.rb108
1 files changed, 84 insertions, 24 deletions
diff --git a/projects/gentoolkit-nichoj/trunk/rubycommit.rb b/projects/gentoolkit-nichoj/trunk/rubycommit.rb
index c79c964..d28897b 100755
--- a/projects/gentoolkit-nichoj/trunk/rubycommit.rb
+++ b/projects/gentoolkit-nichoj/trunk/rubycommit.rb
@@ -1,13 +1,39 @@
#!/usr/bin/ruby -w
$: << File.dirname(__FILE__)
-require 'changelog'
-require 'repoman'
+
+module ChangeLog
+ def ChangeLog.getLastEntry()
+ f = File.new('ChangeLog')
+ entry=''
+
+ while line = f.gets
+ # TODO parametize this
+ if(line.match(/nichoj@gentoo.org/))
+ while ! line.match(/:$/)
+ line = f.gets
+ end
+
+ while (line = f.gets) && line.strip != ''
+ entry += line.strip + ' '
+ end
+ break
+ end
+ end
+
+ f.close
+ return entry.rstrip
+ end
+end
def isSvn
File.directory? '.svn'
end
+def isCvs
+ File.directory? 'CVS'
+end
+
def display_heading(message)
max = 80
filler = '#######################'
@@ -21,41 +47,75 @@ def hr
puts '#' * max
end
-display_heading('eshowkw')
-system('eshowkw')
-display_heading('diff')
-if isSvn:
- system('svn diff')
-else
- system('cvs diff')
+
+def show_keywords()
+ display_heading('Keywords')
+ system('adjutrix --keyword-graph 2>/dev/null')
+end
+
+def show_diff()
+ if isSvn or isCvs
+ display_heading('diff')
+ if isSvn
+ system('svn diff')
+ elsif isCvs
+ system('cvs diff')
+ end
+ puts 'Exit status: ' + $?.to_s
+ return $?
+ end
end
-puts 'Exit status: ' + $?.to_s
-$? == 2 && exit()
-display_heading 'repoman full'
-Repoman.full()
-puts 'Exit status: ' + $?.to_s
-$? != 0 && exit()
+def show_repoman
+ display_heading 'repoman full'
+ system('repoman full')
+ puts 'Exit status: ' + $?.to_s
+ return $?
+end
+def show_qualudis
+ display_heading 'qualudis'
+ system('qualudis')
+ puts 'Exit status: ' + $?.to_s
+ return $?
+end
+
+def get_logentry()
# use log entry from command line
-logentry = ARGV[0]
-# or default to your last ChangeLog entry
-if File.file?('ChangeLog') && logentry.nil? :
- logentry = ChangeLog.getLastEntry()
+ logentry = ARGV[0]
+ # or default to your last ChangeLog entry
+ if logentry.nil? and File.file?('ChangeLog')
+ logentry = ChangeLog.getLastEntry()
+ end
+ return logentry
+end
+
+def show_logentry(logentry)
+ display_heading('ChangeLog')
+ puts logentry
+ display_heading('Continue? (yes/no)')
end
+show_keywords
+show_diff or exit 1
+show_qualudis or exit 1
+show_repoman or exit 1
+
+
+logentry = get_logentry()
+
# escape the log entry
escaped = logentry.gsub("'") { "\\'" }
-display_heading('ChangeLog')
-puts logentry
-display_heading('Continue? (yes/no)')
+show_logentry(logentry)
+
-if gets.match(/y|yes/i)
+line = gets
+if line.match(/y|yes/i)
display_heading('Committing...')
if isSvn
system("svn commit -m \"#{escaped}\"")
else
- Repoman.commit(escaped)
+ system("repoman commit -m \"#{escaped}\"")
end
end