Permalink
Browse files

Getting rid of base.rb.

  • Loading branch information...
1 parent 5a78e55 commit 5af17249ecd13ec11f4fe624f867e42493cfeeb2 @jqr jqr committed Aug 29, 2008
Showing with 55 additions and 58 deletions.
  1. +0 −1 Manifest.txt
  2. +55 −3 lib/snitch.rb
  3. +0 −54 lib/snitch/base.rb
View
@@ -6,7 +6,6 @@ Rakefile
TODO.txt
bin/snitch
lib/snitch.rb
-lib/snitch/base.rb
lib/snitch/config.rb
lib/snitch/patches/hash.rb
lib/snitch/service.rb
View
@@ -1,8 +1,5 @@
-# This file simply includes the gems and snitch files needed.
-
%w[uri yaml rubygems active_support].each { |x| require x }
-require 'snitch/base'
require 'snitch/config'
require 'snitch/patches/hash'
require 'snitch/service'
@@ -14,3 +11,58 @@
require 'snitch/revisions/subversion'
require 'snitch/revisions/git'
require 'snitch/version'
+
+class Snitch
+ attr_reader :services, :config
+
+ class ConfigFileLoadError < StandardError; end
+ class ServiceLoginError < StandardError; end
+
+ def initialize(repository, revision, options)
+ config_file = options[:config_file]
+ Config.config_file_path = config_file unless config_file.nil?
+ @config = Config::load
+ @revision =
+ case options[:scm]
+ when :git
+ Revisions::Git.new(repository, revision)
+ when :subversion
+ Revisions::Subversion.new(repository, revision, @config[:svnlook])
+ else
+ raise "Unrecognized scm: #{options[:scm].inspect}"
+ end
+
+ @services = []
+ @config[:services].each { |s, attrs| use(s, attrs) }
+ if @services.empty?
+ use('echo', :message_length => :long)
+ end
+ end
+
+ def commit_message(which = :long)
+ @revision.to_s(which)
+ end
+
+ def use(s, attrs = {})
+ @services << Service.new_from_name(s, attrs)
+ end
+
+ def tattle
+ superlong = commit_message(:superlong)
+ long = commit_message(:long)
+ short = commit_message(:short)
+ @services.each do |s|
+ message =
+ case s.message_length.to_s
+ when 'superlong'
+ superlong
+ when 'long'
+ long
+ else
+ short
+ end
+
+ s.tattle(message)
+ end
+ end
+end
View
@@ -1,54 +0,0 @@
-class Snitch
- attr_reader :services, :config
-
- class ConfigFileLoadError < StandardError; end
- class ServiceLoginError < StandardError; end
-
- def initialize(repository, revision, options)
- config_file = options[:config_file]
- Config.config_file_path = config_file unless config_file.nil?
- @config = Config::load
- @revision =
- case options[:scm]
- when :git
- Revisions::Git.new(repository, revision)
- when :subversion
- Revisions::Subversion.new(repository, revision, @config[:svnlook])
- else
- raise "Unrecognized scm: #{options[:scm].inspect}"
- end
-
- @services = []
- @config[:services].each { |s, attrs| use(s, attrs) }
- if @services.empty?
- use('echo', :message_length => :long)
- end
- end
-
- def commit_message(which = :long)
- @revision.to_s(which)
- end
-
- def use(s, attrs = {})
- @services << Service.new_from_name(s, attrs)
- end
-
- def tattle
- superlong = commit_message(:superlong)
- long = commit_message(:long)
- short = commit_message(:short)
- @services.each do |s|
- message =
- case s.message_length.to_s
- when 'superlong'
- superlong
- when 'long'
- long
- else
- short
- end
-
- s.tattle(message)
- end
- end
-end

0 comments on commit 5af1724

Please sign in to comment.