Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

--token can be used as an argument, bypassing the stored 'campfire_to…

…ken'. Closes #2
  • Loading branch information...
commit 9b5b394769568ed54276c395f7b68d1559c54c51 1 parent 8418bc0
@georgeguimaraes georgeguimaraes authored
View
2  lib/github-hooker/cli.rb
@@ -27,7 +27,7 @@ def campfire(repo, events)
handle_404 do
check_config!
events = split_events(events)
- Github::Hooker.add_hook(repo, :name => "campfire", :events => events, :config => options)
+ Github::Hooker.add_hook(repo, :name => "campfire", :events => events, :config => options.reverse_merge("token" => Github::Hooker::Config.config['campfire_token']))
end
end
View
2  lib/github-hooker/config.rb
@@ -8,7 +8,7 @@ def self.filename
end
def self.config
- @config ||= YAML.load_file(File.expand_path(config_filename))
+ @config ||= YAML.load_file(File.expand_path(filename))
end
end
end
View
11 spec/github-hooker/cli_spec.rb
@@ -40,9 +40,14 @@
describe "campfire" do
it "calls Github::Hooker with the correct arguments" do
- Github::Hooker.stub(:add_hook).with("user/repo", {:name => "campfire", :events => ["pull_requests", "issue"], :config => {}})
+ Github::Hooker.stub(:add_hook).with("user/repo", {:name => "campfire", :events => ["pull_requests", "issue"], :config => {"token" => "token"}})
subject.campfire("user/repo", "pull_requests, issue")
end
+
+ it "ignores campfire_token if --token is passed" do
+ Github::Hooker.stub(:add_hook).with("user/repo", {:name => "campfire", :events => ["pull_requests", "issue"], :config => {"token"=>"cli_token", "room"=>"ROOM", "subdomain"=>"SUBDOMAIN"}})
+ cli("campfire user/repo pull_requests,issue --room=ROOM --subdomain=SUBDOMAIN --token=cli_token")
+ end
end
describe "web" do
@@ -58,4 +63,8 @@
subject.delete("user/repo", 1010)
end
end
+
+ def cli(string)
+ Github::Hooker::CLI.start(string.split(" "))
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.