glennr-cijoe 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +6 -0
- data/LICENSE +20 -0
- data/README.markdown +170 -0
- data/Rakefile +68 -0
- data/bin/cijoe +51 -0
- data/cijoe.gemspec +77 -0
- data/deps.rip +4 -0
- data/examples/build-failed +22 -0
- data/examples/build-worked +22 -0
- data/examples/cijoe.ru +15 -0
- data/examples/cijoed +53 -0
- data/glennr-cijoe.gemspec +82 -0
- data/lib/cijoe.rb +233 -0
- data/lib/cijoe/build.rb +62 -0
- data/lib/cijoe/campfire.rb +70 -0
- data/lib/cijoe/commit.rb +27 -0
- data/lib/cijoe/config.rb +43 -0
- data/lib/cijoe/public/favicon.ico +0 -0
- data/lib/cijoe/public/octocat.png +0 -0
- data/lib/cijoe/public/screen.css +213 -0
- data/lib/cijoe/server.rb +91 -0
- data/lib/cijoe/version.rb +3 -0
- data/lib/cijoe/views/template.erb +70 -0
- data/test/helper.rb +12 -0
- data/test/test_cijoe.rb +17 -0
- data/test/test_cijoe_server.rb +50 -0
- metadata +150 -0
| @@ -0,0 +1,70 @@ | |
| 1 | 
            +
            <!DOCTYPE html>
         | 
| 2 | 
            +
            <html>
         | 
| 3 | 
            +
              <head>
         | 
| 4 | 
            +
                <link href="<%= cijoe_root %>/screen.css" media="screen" rel="stylesheet" type="text/css" />
         | 
| 5 | 
            +
                <link rel="shortcut icon" href="<%= cijoe_root %>/favicon.ico" type="image/x-icon" />
         | 
| 6 | 
            +
                <title><%= h(joe.project) %>: CI Joe</title>
         | 
| 7 | 
            +
              </head>
         | 
| 8 | 
            +
              <body>
         | 
| 9 | 
            +
                <div class="site">
         | 
| 10 | 
            +
                  <div class="title">
         | 
| 11 | 
            +
                    <a href="<%= cijoe_root %>/">CI Joe</a>
         | 
| 12 | 
            +
                    <span class="extra">because knowing is half the battle</span>
         | 
| 13 | 
            +
                  </div>
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  <div id="home">
         | 
| 16 | 
            +
                    <h1><a href="<%= joe.url %>"><%= joe.project %></a></h1>
         | 
| 17 | 
            +
                    <ul class="posts">
         | 
| 18 | 
            +
                      <% if joe.current_build %>
         | 
| 19 | 
            +
                        <li>
         | 
| 20 | 
            +
                          <span class="date"><%= pretty_time(joe.current_build.started_at) if joe.current_build %></span> »
         | 
| 21 | 
            +
                          <% if joe.current_build.sha %>
         | 
| 22 | 
            +
                            Building <a href="<%= joe.current_build.commit.url %>"><%= joe.current_build.short_sha %></a> <small>(pid: <%= joe.pid %>)</small>
         | 
| 23 | 
            +
                          <% else %>
         | 
| 24 | 
            +
                            Build starting...
         | 
| 25 | 
            +
                          <% end %>
         | 
| 26 | 
            +
                        </li>
         | 
| 27 | 
            +
                      <% else %>
         | 
| 28 | 
            +
                        <li><form method="POST"><input type="submit" value="Build"/></form></li>
         | 
| 29 | 
            +
                      <% end %>
         | 
| 30 | 
            +
                      
         | 
| 31 | 
            +
                      <% if joe.last_build %>
         | 
| 32 | 
            +
                        <li>
         | 
| 33 | 
            +
                          <span class="date"><%= pretty_time(joe.last_build.finished_at) %></span> » Built <a href="<%= joe.last_build.commit.url %>"><%= joe.last_build.short_sha %></a> <span class="<%= joe.last_build.status %>">(<%= joe.last_build.status %>)</span>
         | 
| 34 | 
            +
                          <% if joe.last_build.duration %>
         | 
| 35 | 
            +
                            in <span class="duration"><%= joe.last_build.duration %></span> seconds.
         | 
| 36 | 
            +
                          <% end %>
         | 
| 37 | 
            +
                        </li>
         | 
| 38 | 
            +
                        <% if joe.last_build.failed? %>
         | 
| 39 | 
            +
                          <li><pre class="terminal"><code><%=ansi_color_codes h(joe.last_build.output) %></code></pre></li>
         | 
| 40 | 
            +
                        <% end %>
         | 
| 41 | 
            +
                      <% end %>
         | 
| 42 | 
            +
                    </ul>
         | 
| 43 | 
            +
                  </div>
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                  <div class="footer">
         | 
| 46 | 
            +
                    <div class="contact">
         | 
| 47 | 
            +
                      <p>
         | 
| 48 | 
            +
                        <a href="http://github.com/defunkt/cijoe/tree/master#readme">Documentation</a><br/>
         | 
| 49 | 
            +
                        <a href="http://github.com/defunkt/cijoe">Source</a><br/>
         | 
| 50 | 
            +
                        <a href="http://github.com/defunkt/cijoe/issues">Issues</a><br/>
         | 
| 51 | 
            +
                        <a href="http://twitter.com/defunkt">Twitter</a>
         | 
| 52 | 
            +
                      </p>
         | 
| 53 | 
            +
                    </div>
         | 
| 54 | 
            +
                    <div class="contact">
         | 
| 55 | 
            +
                      <p>
         | 
| 56 | 
            +
                        Designed by <a href="http://tom.preston-werner.com/">Tom Preston-Werner</a><br/>
         | 
| 57 | 
            +
                        Influenced by <a href="http://integrityapp.com/">Integrity</a><br/>
         | 
| 58 | 
            +
                        Built with <a href="http://sinatrarb.com/">Sinatra</a><br/>
         | 
| 59 | 
            +
                        Keep it simple, Sam.
         | 
| 60 | 
            +
                      </p>
         | 
| 61 | 
            +
                    </div>        
         | 
| 62 | 
            +
                    <div class="rss">
         | 
| 63 | 
            +
                      <a href="http://github.com/defunkt/cijoe">
         | 
| 64 | 
            +
                        <img src="<%= cijoe_root %>/octocat.png" alt="Octocat!" />
         | 
| 65 | 
            +
                      </a>
         | 
| 66 | 
            +
                    </div>
         | 
| 67 | 
            +
                  </div>
         | 
| 68 | 
            +
                </div>
         | 
| 69 | 
            +
              </body>
         | 
| 70 | 
            +
            </html>
         | 
    
        data/test/helper.rb
    ADDED
    
    | @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            require 'rubygems'
         | 
| 2 | 
            +
            require 'test/unit'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            $LOAD_PATH.unshift(File.dirname(__FILE__))
         | 
| 5 | 
            +
            $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
         | 
| 6 | 
            +
            require 'cijoe'
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            CIJoe::Server.set :project_path, "."
         | 
| 9 | 
            +
            CIJoe::Server.set :environment,  "test"
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            class Test::Unit::TestCase
         | 
| 12 | 
            +
            end
         | 
    
        data/test/test_cijoe.rb
    ADDED
    
    | @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            require 'helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class TestCIJoe < Test::Unit::TestCase
         | 
| 4 | 
            +
              def test_raise_error_on_invalid_command
         | 
| 5 | 
            +
                assert_raise RuntimeError, LoadError do
         | 
| 6 | 
            +
                  CIJoe::Config.new('--invalid').to_s
         | 
| 7 | 
            +
                end
         | 
| 8 | 
            +
              end
         | 
| 9 | 
            +
              
         | 
| 10 | 
            +
              def test_return_value_of_config
         | 
| 11 | 
            +
                assert_equal `git config blame`.chomp, CIJoe::Config.new('blame').to_s
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
              
         | 
| 14 | 
            +
              def test_return_empty_string_when_config_does_not_exist
         | 
| 15 | 
            +
                assert_equal '', CIJoe::Config.new('invalid').to_s
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
| @@ -0,0 +1,50 @@ | |
| 1 | 
            +
            require "helper"
         | 
| 2 | 
            +
            require "rack/test"
         | 
| 3 | 
            +
            require "cijoe/server"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            class TestCIJoeServer < Test::Unit::TestCase
         | 
| 6 | 
            +
              include Rack::Test::Methods
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              class ::CIJoe
         | 
| 9 | 
            +
                attr_writer :current_build, :last_build
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              attr_accessor :app
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              def setup
         | 
| 15 | 
            +
                @app = CIJoe::Server.new
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              def test_ping
         | 
| 19 | 
            +
                app.joe.last_build = build :worked
         | 
| 20 | 
            +
                assert !app.joe.building?, "have a last build, but not a current"
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                get "/ping"
         | 
| 23 | 
            +
                assert_equal 200, last_response.status
         | 
| 24 | 
            +
                assert_equal app.joe.last_build.sha, last_response.body
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
              def test_ping_building
         | 
| 28 | 
            +
                app.joe.current_build = build :building
         | 
| 29 | 
            +
                assert app.joe.building?, "buildin' a awsum project"
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                get "/ping"
         | 
| 32 | 
            +
                assert_equal 412, last_response.status
         | 
| 33 | 
            +
                assert_equal "building", last_response.body
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              def test_ping_failed
         | 
| 37 | 
            +
                app.joe.last_build = build :failed
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                get "/ping"
         | 
| 40 | 
            +
                assert_equal 412, last_response.status
         | 
| 41 | 
            +
                assert_equal app.joe.last_build.sha, last_response.body
         | 
| 42 | 
            +
              end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              # Create a new, fake build. All we care about is status.
         | 
| 45 | 
            +
             | 
| 46 | 
            +
              def build status
         | 
| 47 | 
            +
                CIJoe::Build.new "user", "project", Time.now, Time.now,
         | 
| 48 | 
            +
                  "deadbeef", status, "output", 1337
         | 
| 49 | 
            +
              end
         | 
| 50 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,150 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 | 
            +
            name: glennr-cijoe
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              hash: 9
         | 
| 5 | 
            +
              prerelease: false
         | 
| 6 | 
            +
              segments: 
         | 
| 7 | 
            +
              - 0
         | 
| 8 | 
            +
              - 4
         | 
| 9 | 
            +
              - 3
         | 
| 10 | 
            +
              version: 0.4.3
         | 
| 11 | 
            +
            platform: ruby
         | 
| 12 | 
            +
            authors: 
         | 
| 13 | 
            +
            - Chris Wanstrath
         | 
| 14 | 
            +
            autorequire: 
         | 
| 15 | 
            +
            bindir: bin
         | 
| 16 | 
            +
            cert_chain: []
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            date: 2010-07-22 00:00:00 +02:00
         | 
| 19 | 
            +
            default_executable: cijoe
         | 
| 20 | 
            +
            dependencies: 
         | 
| 21 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 22 | 
            +
              name: choice
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 25 | 
            +
                none: false
         | 
| 26 | 
            +
                requirements: 
         | 
| 27 | 
            +
                - - ">="
         | 
| 28 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 29 | 
            +
                    hash: 3
         | 
| 30 | 
            +
                    segments: 
         | 
| 31 | 
            +
                    - 0
         | 
| 32 | 
            +
                    version: "0"
         | 
| 33 | 
            +
              type: :runtime
         | 
| 34 | 
            +
              version_requirements: *id001
         | 
| 35 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 36 | 
            +
              name: sinatra
         | 
| 37 | 
            +
              prerelease: false
         | 
| 38 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 39 | 
            +
                none: false
         | 
| 40 | 
            +
                requirements: 
         | 
| 41 | 
            +
                - - ">="
         | 
| 42 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 43 | 
            +
                    hash: 3
         | 
| 44 | 
            +
                    segments: 
         | 
| 45 | 
            +
                    - 0
         | 
| 46 | 
            +
                    version: "0"
         | 
| 47 | 
            +
              type: :runtime
         | 
| 48 | 
            +
              version_requirements: *id002
         | 
| 49 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 50 | 
            +
              name: tinder
         | 
| 51 | 
            +
              prerelease: false
         | 
| 52 | 
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 53 | 
            +
                none: false
         | 
| 54 | 
            +
                requirements: 
         | 
| 55 | 
            +
                - - ">="
         | 
| 56 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 57 | 
            +
                    hash: 3
         | 
| 58 | 
            +
                    segments: 
         | 
| 59 | 
            +
                    - 0
         | 
| 60 | 
            +
                    version: "0"
         | 
| 61 | 
            +
              type: :runtime
         | 
| 62 | 
            +
              version_requirements: *id003
         | 
| 63 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 64 | 
            +
              name: rack-test
         | 
| 65 | 
            +
              prerelease: false
         | 
| 66 | 
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         | 
| 67 | 
            +
                none: false
         | 
| 68 | 
            +
                requirements: 
         | 
| 69 | 
            +
                - - ">="
         | 
| 70 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 71 | 
            +
                    hash: 3
         | 
| 72 | 
            +
                    segments: 
         | 
| 73 | 
            +
                    - 0
         | 
| 74 | 
            +
                    version: "0"
         | 
| 75 | 
            +
              type: :development
         | 
| 76 | 
            +
              version_requirements: *id004
         | 
| 77 | 
            +
            description: CI Joe is a simple Continuous Integration server.
         | 
| 78 | 
            +
            email: chris@ozmm.org
         | 
| 79 | 
            +
            executables: 
         | 
| 80 | 
            +
            - cijoe
         | 
| 81 | 
            +
            extensions: []
         | 
| 82 | 
            +
             | 
| 83 | 
            +
            extra_rdoc_files: 
         | 
| 84 | 
            +
            - LICENSE
         | 
| 85 | 
            +
            - README.markdown
         | 
| 86 | 
            +
            files: 
         | 
| 87 | 
            +
            - .gitignore
         | 
| 88 | 
            +
            - LICENSE
         | 
| 89 | 
            +
            - README.markdown
         | 
| 90 | 
            +
            - Rakefile
         | 
| 91 | 
            +
            - bin/cijoe
         | 
| 92 | 
            +
            - cijoe.gemspec
         | 
| 93 | 
            +
            - deps.rip
         | 
| 94 | 
            +
            - examples/build-failed
         | 
| 95 | 
            +
            - examples/build-worked
         | 
| 96 | 
            +
            - examples/cijoe.ru
         | 
| 97 | 
            +
            - examples/cijoed
         | 
| 98 | 
            +
            - glennr-cijoe.gemspec
         | 
| 99 | 
            +
            - lib/cijoe.rb
         | 
| 100 | 
            +
            - lib/cijoe/build.rb
         | 
| 101 | 
            +
            - lib/cijoe/campfire.rb
         | 
| 102 | 
            +
            - lib/cijoe/commit.rb
         | 
| 103 | 
            +
            - lib/cijoe/config.rb
         | 
| 104 | 
            +
            - lib/cijoe/public/favicon.ico
         | 
| 105 | 
            +
            - lib/cijoe/public/octocat.png
         | 
| 106 | 
            +
            - lib/cijoe/public/screen.css
         | 
| 107 | 
            +
            - lib/cijoe/server.rb
         | 
| 108 | 
            +
            - lib/cijoe/version.rb
         | 
| 109 | 
            +
            - lib/cijoe/views/template.erb
         | 
| 110 | 
            +
            - test/helper.rb
         | 
| 111 | 
            +
            - test/test_cijoe.rb
         | 
| 112 | 
            +
            - test/test_cijoe_server.rb
         | 
| 113 | 
            +
            has_rdoc: true
         | 
| 114 | 
            +
            homepage: http://github.com/defunkt/cijoe
         | 
| 115 | 
            +
            licenses: []
         | 
| 116 | 
            +
             | 
| 117 | 
            +
            post_install_message: 
         | 
| 118 | 
            +
            rdoc_options: 
         | 
| 119 | 
            +
            - --charset=UTF-8
         | 
| 120 | 
            +
            require_paths: 
         | 
| 121 | 
            +
            - lib
         | 
| 122 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 123 | 
            +
              none: false
         | 
| 124 | 
            +
              requirements: 
         | 
| 125 | 
            +
              - - ">="
         | 
| 126 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 127 | 
            +
                  hash: 3
         | 
| 128 | 
            +
                  segments: 
         | 
| 129 | 
            +
                  - 0
         | 
| 130 | 
            +
                  version: "0"
         | 
| 131 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 132 | 
            +
              none: false
         | 
| 133 | 
            +
              requirements: 
         | 
| 134 | 
            +
              - - ">="
         | 
| 135 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 136 | 
            +
                  hash: 3
         | 
| 137 | 
            +
                  segments: 
         | 
| 138 | 
            +
                  - 0
         | 
| 139 | 
            +
                  version: "0"
         | 
| 140 | 
            +
            requirements: []
         | 
| 141 | 
            +
             | 
| 142 | 
            +
            rubyforge_project: 
         | 
| 143 | 
            +
            rubygems_version: 1.3.7
         | 
| 144 | 
            +
            signing_key: 
         | 
| 145 | 
            +
            specification_version: 3
         | 
| 146 | 
            +
            summary: CI Joe is a simple Continuous Integration server.
         | 
| 147 | 
            +
            test_files: 
         | 
| 148 | 
            +
            - test/helper.rb
         | 
| 149 | 
            +
            - test/test_cijoe.rb
         | 
| 150 | 
            +
            - test/test_cijoe_server.rb
         |