eployday 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/bin/eployday +4 -0
- data/eployday.gemspec +23 -0
- data/lib/eployday/cli.rb +19 -0
- data/lib/eployday/deploy.rb +19 -0
- data/lib/eployday/permission_checker.rb +13 -0
- data/lib/eployday/version.rb +3 -0
- data/lib/eployday.rb +5 -0
- data/spec/cli_spec.rb +10 -0
- data/spec/deploy_spec.rb +29 -0
- data/spec/permission_cheker_spec.rb +16 -0
- metadata +85 -0
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use --create 1.9.2@eployday
|
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/eployday
ADDED
data/eployday.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "eployday/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "eployday"
|
7
|
+
s.version = Eployday::VERSION
|
8
|
+
s.authors = ["Steve Klabnik"]
|
9
|
+
s.email = ["steve@steveklabnik.com"]
|
10
|
+
s.homepage = "http://github.com/steveklabnik/eployday"
|
11
|
+
s.summary = %q{An IRC bot to deploy stuff.}
|
12
|
+
s.description = %q{An IRC bot that allows whitelisted users to deploy your code to production.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "eployday"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_development_dependency "rspec"
|
22
|
+
s.add_runtime_dependency "cinch"
|
23
|
+
end
|
data/lib/eployday/cli.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'cinch'
|
2
|
+
require 'eployday/deploy'
|
3
|
+
|
4
|
+
module Eployday
|
5
|
+
class CLI
|
6
|
+
def run
|
7
|
+
bot = Cinch::Bot.new do
|
8
|
+
configure do |c|
|
9
|
+
c.nick = "eployday"
|
10
|
+
c.server = "irc.freenode.net"
|
11
|
+
c.channels = ["#rstatus"]
|
12
|
+
c.plugins.plugins = [Deploy]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
bot.start
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'cinch'
|
2
|
+
require 'eployday/permission_checker'
|
3
|
+
|
4
|
+
module Eployday
|
5
|
+
class Deploy
|
6
|
+
include Cinch::Plugin
|
7
|
+
|
8
|
+
match "deploy"
|
9
|
+
|
10
|
+
def execute(m)
|
11
|
+
if PermissionChecker.allowed?(m.user.nick)
|
12
|
+
m.reply "#{m.user.nick}: beginning deploy."
|
13
|
+
Kernel.system "sm deploy"
|
14
|
+
m.reply "#{m.user.nick}: deploy finished."
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
data/lib/eployday.rb
ADDED
data/spec/cli_spec.rb
ADDED
data/spec/deploy_spec.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'eployday/deploy'
|
2
|
+
|
3
|
+
describe Eployday::Deploy do
|
4
|
+
context "is a Cinch Plugin" do
|
5
|
+
it "mixes in the right module" do
|
6
|
+
Eployday::Deploy.ancestors.include?(Cinch::Plugin).should be_true
|
7
|
+
end
|
8
|
+
|
9
|
+
context "execute" do
|
10
|
+
let(:message) {
|
11
|
+
message = stub(:reply => nil, :user => stub(:nick => "steve"))
|
12
|
+
}
|
13
|
+
|
14
|
+
it "executes a deploy" do
|
15
|
+
Eployday::PermissionChecker.should_receive(:allowed?).and_return true
|
16
|
+
Kernel.should_receive(:system).with("sm deploy")
|
17
|
+
|
18
|
+
Eployday::Deploy.new(stub.as_null_object).execute(message)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "respects the permissions checker" do
|
22
|
+
Eployday::PermissionChecker.should_receive(:allowed?).and_return false
|
23
|
+
Kernel.should_not_receive(:system)
|
24
|
+
|
25
|
+
Eployday::Deploy.new(stub.as_null_object).execute(message)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'eployday/permission_checker'
|
2
|
+
|
3
|
+
describe Eployday::PermissionChecker do
|
4
|
+
it "loads the whitelist" do
|
5
|
+
Eployday::PermissionChecker.should_receive(:load_whitelist).and_return([])
|
6
|
+
Eployday::PermissionChecker.allowed?("steveklabnik")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "allows people on the list" do
|
10
|
+
Eployday::PermissionChecker.allowed?("imgood", ["imgood"]).should be_true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "disallows people not on the list" do
|
14
|
+
Eployday::PermissionChecker.allowed?("imnot", []).should_not be_true
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eployday
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Steve Klabnik
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-09-16 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &2157647800 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2157647800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: cinch
|
27
|
+
requirement: &2157647380 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2157647380
|
36
|
+
description: An IRC bot that allows whitelisted users to deploy your code to production.
|
37
|
+
email:
|
38
|
+
- steve@steveklabnik.com
|
39
|
+
executables:
|
40
|
+
- eployday
|
41
|
+
extensions: []
|
42
|
+
extra_rdoc_files: []
|
43
|
+
files:
|
44
|
+
- .gitignore
|
45
|
+
- .rvmrc
|
46
|
+
- Gemfile
|
47
|
+
- Rakefile
|
48
|
+
- bin/eployday
|
49
|
+
- eployday.gemspec
|
50
|
+
- lib/eployday.rb
|
51
|
+
- lib/eployday/cli.rb
|
52
|
+
- lib/eployday/deploy.rb
|
53
|
+
- lib/eployday/permission_checker.rb
|
54
|
+
- lib/eployday/version.rb
|
55
|
+
- spec/cli_spec.rb
|
56
|
+
- spec/deploy_spec.rb
|
57
|
+
- spec/permission_cheker_spec.rb
|
58
|
+
homepage: http://github.com/steveklabnik/eployday
|
59
|
+
licenses: []
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project: eployday
|
78
|
+
rubygems_version: 1.8.6
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: An IRC bot to deploy stuff.
|
82
|
+
test_files:
|
83
|
+
- spec/cli_spec.rb
|
84
|
+
- spec/deploy_spec.rb
|
85
|
+
- spec/permission_cheker_spec.rb
|