From 22e2f5682b86bf2e6c56b355390147c15f6dda4c Mon Sep 17 00:00:00 2001 From: hoverlover Date: Thu, 23 Dec 2010 09:41:05 -0600 Subject: [PATCH] Added README --- .bundle/config | 2 ++ .gitignore | 2 ++ Gemfile | 6 +++- Gemfile.lock | 57 +++++++++++++++++++++++++++++++++++++ README.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ config.ru | 13 ++++----- 6 files changed, 148 insertions(+), 8 deletions(-) create mode 100644 .bundle/config create mode 100644 .gitignore create mode 100644 Gemfile.lock create mode 100644 README.md diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 0000000..8ebbe30 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_DISABLE_SHARED_GEMS: "1" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..88280dd --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +.rvmrc diff --git a/Gemfile b/Gemfile index 2dd5d43..ddadea9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,7 @@ source 'http://rubygems.org' -gem 'cijoe' +gem 'cijoe', :git => 'git://github.com/hoverlover/cijoe.git' +gem 'sinatra' +gem 'rake' +gem 'bitly' +gem 'twitter' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..80b5021 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,57 @@ +GIT + remote: git://github.com/hoverlover/cijoe.git + revision: fca3db9f21a55a6326a924eaa149ffc0f05e0e0d + specs: + cijoe (0.5.0) + choice + sinatra + +GEM + remote: http://rubygems.org/ + specs: + addressable (2.2.2) + bitly (0.6.1) + crack (>= 0.1.4) + httparty (>= 0.5.2) + oauth2 (>= 0.1.1) + choice (0.1.4) + crack (0.1.8) + faraday (0.5.4) + addressable (~> 2.2.2) + multipart-post (~> 1.1.0) + rack (>= 1.1.0, < 2) + faraday_middleware (0.3.1) + faraday (~> 0.5.3) + hashie (0.4.0) + httparty (0.6.1) + crack (= 0.1.8) + multi_json (0.0.5) + multi_xml (0.2.0) + multipart-post (1.1.0) + oauth2 (0.1.1) + faraday (~> 0.5.0) + multi_json (~> 0.0.4) + rack (1.2.1) + rake (0.8.7) + simple_oauth (0.1.3) + sinatra (1.1.2) + rack (~> 1.1) + tilt (~> 1.2) + tilt (1.2.1) + twitter (1.1.0) + faraday (~> 0.5.3) + faraday_middleware (~> 0.3.1) + hashie (~> 0.4.0) + multi_json (~> 0.0.5) + multi_xml (~> 0.2.0) + simple_oauth (~> 0.1.3) + +PLATFORMS + ruby + +DEPENDENCIES + bitly + cijoe! + rake + sinatra + twitter diff --git a/README.md b/README.md new file mode 100644 index 0000000..a15ac3b --- /dev/null +++ b/README.md @@ -0,0 +1,76 @@ +# Heroku CI Joe: Run CI Joe on Heroku! + +I <3 [CI Joe](https://github.com/defunkt/cijoe)! But CI Joe uses conventions that don't jive with [Heroku](http://www.heroku.com), like: + +* git config variables +* git hooks + +Heroku CI Joe attempts to solve these problems so you can run the +awesome goodness of CI Joe on the raddest platform out there! + +## Additional Features +Along with the features provided by CI Joe, you also get: + +* Twitter integration - Tweet your build results +* Automatic shortening of URLs in the build messages using [Bit.ly](http://bit.ly) + +If you would like to have additional notification methods or features available, feel free to +fork and contribute! The ci-joe fork that actually does all the work is +located [here](https://github.com/hoverlover/cijoe). + +## Quickstart +1. Clone me +2. Deploy to Heroku +3. Configure +4. Push some commits to your git repo +5. Let the buildin' begin + +## Configuration +CI Joe reads it's configuration from git config. This, of course, won't +work on Heroku. Heroku CI Joe gets around this hurdle by using Heroku +config variables. For example the CI Joe config variable `cijoe.runner` +can be configured for Heroku CI Joe by executing the folowing using the +heroku command: + + heroku config:add cijoe_runner=rake spec + +Notice how "." is replace by "\_" in the config variables. Any CI Joe +config variable can be used in Heroku CI Joe. Simply replace the "." +with "_". The following sections outline the configuration variables +that are available. + +### Twitter +To tweet your build results, you will need a Twitter account, of course. +Also, you will need to [register](http://dev.twitter.com/apps) the build server +as a Twitter application. Once the registration is complete you will +need to set the following configuration variables: + +* `twitter_consumer_key` +* `twitter_consumer_secret` +* `twitter_oauth_token` +* `twitter_oauth_token_secret` + +### Bit.ly +You can use [Bit.ly](http://bit.ly) to automatically shorten the URLs in +the build messages. You will need a Bit.ly account. Once you have an +account, set the following configuration variables: + +* `bitly_api_key` +* `bitly_user_name` + +### CI Joe +* `cijoe_buildallfile` - see the [CI Joe README](https://github.com/defunkt/cijoe/blob/master/README.md) for this variable +* `cijoe_runner` - see the [CI Joe README](https://github.com/defunkt/cijoe/blob/master/README.md) for this variable +* `cijoe_ci_server_url` - this is the URL for your deployed instance of + Heroku CI Joe (used in the build status message) +* `cijoe_git_url` - this is the URL to your git repository +* `cijoe_user` - HTTP basic auth user for Heroku CI Joe +* `cijoe_pass` - HTTP basic auth password for Heroku CI Joe + +## Caveats +Heroku's platform is, for the most part, a [read-only filesystem](http://docs.heroku.com/constraints#read-only-filesystem). Heroku CI Joe writes builds to the `./tmp` directory. This means that after a build is performed, the results may or may not be available to review. If you immediately go look at the results after a build notification, I've noticed that they are generally available. If you wait for very long after the build is complete, they usually are not available. + +## Future Features + +* Writing builds to Amazon S3, or some other endpoint +* Configurable build message format diff --git a/config.ru b/config.ru index 0d0005d..f911afd 100644 --- a/config.ru +++ b/config.ru @@ -1,10 +1,9 @@ -puts "Making projects directory at tmp/projects" -File.mkdirp "tmp/projects" +require 'rubygems' +require 'bundler/setup' +Bundler.require(:default) -puts "Cloning git repo" -`git clone https://hoverlover@github.com/bustoutsolutions/affluence.git tmp/projects/affluence` +project = ENV['cijoe_git_url'].split('/').last.chomp('.git') +CIJoe::Server.set :project_path, File.expand_path("tmp/projects/#{project}") puts "Starting CI Joe" -`cijoe tmp/projects/affluence` - -puts "Done" +run CIJoe::Server