Permalink
Browse files

Let's try v1

  • Loading branch information...
1 parent ff1c8e6 commit 88925ee2ac432049eb93fe09f0c66ecd3e3a7dc7 @steveklabnik committed Sep 16, 2011
Showing with 65 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +4 −0 bin/eployday
  3. +19 −0 lib/eployday/cli.rb
  4. +16 −0 lib/eployday/deploy.rb
  5. +10 −0 spec/cli_spec.rb
  6. +15 −0 spec/deploy_spec.rb
View
@@ -1,3 +1,4 @@
+*.swp
*.gem
.bundle
Gemfile.lock
View
@@ -0,0 +1,4 @@
+require 'eployday/cli'
+
+cli = Eployday::CLI.new(ARGV)
+cli.run
View
@@ -0,0 +1,19 @@
+require 'cinch'
+require 'eployday/deploy'
+
+module Eployday
+ class CLI
+ def run
+ bot = Cinch::Bot.new do
+ configure do |c|
+ c.nick = "eployday"
+ c.server = "irc.freenode.net"
+ c.channels = ["#rstatus"]
+ c.plugins.plugins = [Deploy]
+ end
+ end
+
+ bot.start
+ end
+ end
+end
@@ -0,0 +1,16 @@
+require 'cinch'
+
+module Eployday
+ class Deploy
+ include Cinch::Plugin
+
+ match "deploy"
+
+ def execute(m)
+ m.reply "#{m.user.nick}: beginning deploy."
+ Kernel.system "sm deploy"
+ m.reply "#{m.user.nick}: deploy finished."
+ end
+ end
+end
+
View
@@ -0,0 +1,10 @@
+require 'eployday/cli'
+
+describe Eployday::CLI do
+ it "runs a cinch bot" do
+ bot = double
+ bot.should_receive(:start)
+ Cinch::Bot.stub(:new => bot)
+ subject.run
+ end
+end
View
@@ -0,0 +1,15 @@
+require 'eployday/deploy'
+
+describe Eployday::Deploy do
+ context "is a Cinch Plugin" do
+ it "mixes in the right module" do
+ Eployday::Deploy.ancestors.include?(Cinch::Plugin).should be_true
+ end
+
+ it "executes a deploy" do
+ Kernel.should_receive(:system).with("sm deploy")
+ message = stub(:reply => nil, :user => stub(:nick => "steve"))
+ Eployday::Deploy.new(stub.as_null_object).execute(message)
+ end
+ end
+end

0 comments on commit 88925ee

Please sign in to comment.