heroku-bartender 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Sebastian Arcila-Valenzuela
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,19 @@
1
+ # Heroku Bartender
2
+ Is a simple way to manage releases in heroku
3
+
4
+ # How to bartender
5
+ ## Install
6
+
7
+ ## Run
8
+
9
+ # Feature
10
+ You can rollback your heroku app to a specific commit hash
11
+
12
+ # TODO
13
+ 0. Keep update the repo
14
+ 1. Handle branches/tags
15
+ 2. Parametrization
16
+ 3. DB Rollback
17
+ 4. Styling view
18
+ 5. Async build
19
+ 6. Integration with CI servers
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ file_list = FileList['spec/*_spec.rb']
4
+
5
+ RSpec::Core::RakeTask.new('spec') do |t|
6
+ t.pattern = file_list
7
+ t.rspec_opts = ["--colour", "--format progress", "-p"]
8
+ end
9
+
10
+ desc 'Default: run specs.'
11
+ task :default => 'spec'
@@ -0,0 +1,11 @@
1
+ module Heroku
2
+ module Bartender
3
+ class Command
4
+ # move to an specific commit
5
+ # Pending ada more testing stuff
6
+ def self.move_to release
7
+ `git push -f heroku #{release}:master`
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ module Heroku
2
+ module Bartender
3
+ class Commit
4
+ attr_accessor :sha, :author, :email, :message, :date
5
+ def initialize(stub = {})
6
+ @sha = stub[:sha]
7
+ @author = stub[:author]
8
+ @email = stub[:email]
9
+ @message = stub[:message]
10
+ @date = stub[:date]
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ require "git"
2
+ module Heroku
3
+ module Bartender
4
+ class Log
5
+ def self.get_log(old_commits = 500)
6
+ Git.open('.').log(old_commits)
7
+ end
8
+ def self.generate_commits
9
+ get_log.map do |item|
10
+ Commit.new({ :sha => item.sha , :author => item.author.name,
11
+ :email => item.author.email, :message => item.message,
12
+ :date => item.date
13
+ })
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ require 'sinatra/base'
2
+ require 'erb'
3
+ module Heroku
4
+ module Bartender
5
+ class Server < Sinatra::Base
6
+ dir = File.dirname(File.expand_path(__FILE__))
7
+ set :views, "#{dir}/views"
8
+
9
+ get "/" do
10
+ erb(:template, {}, :commits => Log.generate_commits)
11
+ end
12
+ post "/" do
13
+ if params[:sha]
14
+ Command.move_to params[:sha]
15
+ end
16
+ erb(:template, {}, :commits => Log.generate_commits)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,5 @@
1
+ module Heroku
2
+ module Bartender
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Heroku Bartender</title>
5
+ </head>
6
+ <body>
7
+ <div class='title'>
8
+ <h1> Heroku Bartender </h1>
9
+ </div>
10
+ <div class="site">
11
+ <div id="home">
12
+ <ul class="posts">
13
+ <% commits.each do |commit| %>
14
+ <li>
15
+ <h3> <%= commit.author %> | <%= commit.email %></h3>
16
+ <p>
17
+ <%= commit.sha %>
18
+ </p>
19
+ <p>
20
+ <%= commit.message %>
21
+ <%= commit.date %>
22
+ </p>
23
+ <form method="POST">
24
+ <input type="hidden" value="<%= commit.sha %>" name="sha"/>
25
+ <input type="submit" value="Build"/>
26
+ </form>
27
+
28
+ </li>
29
+ <% end %>
30
+ </ul>
31
+ </div>
32
+ </div>
33
+ </body>
34
+ </html>
@@ -0,0 +1,4 @@
1
+ require "heroku/bartender/commit"
2
+ require "heroku/bartender/log"
3
+ require "heroku/bartender/command"
4
+ require "heroku/bartender/server"
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: heroku-bartender
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Sebastian Arcila-Valenzuela
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-03-08 00:00:00 -05:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rspec
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :development
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: git
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 1.2.5
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: sinatra
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.2.0
47
+ type: :runtime
48
+ version_requirements: *id003
49
+ description: Ruby gem to handle releases in heroku.
50
+ email: sebastianarcila@gmail.com
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files: []
56
+
57
+ files:
58
+ - README.markdown
59
+ - Rakefile
60
+ - LICENSE
61
+ - lib/heroku/bartender/command.rb
62
+ - lib/heroku/bartender/commit.rb
63
+ - lib/heroku/bartender/log.rb
64
+ - lib/heroku/bartender/server.rb
65
+ - lib/heroku/bartender/version.rb
66
+ - lib/heroku/bartender/views/template.erb
67
+ - lib/heroku/bartender.rb
68
+ has_rdoc: false
69
+ homepage: http://github.com/sarcilav/bartende
70
+ licenses: []
71
+
72
+ post_install_message:
73
+ rdoc_options: []
74
+
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: "0"
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: "0"
89
+ requirements: []
90
+
91
+ rubyforge_project:
92
+ rubygems_version: 1.5.0
93
+ signing_key:
94
+ specification_version: 3
95
+ summary: "See example: https://github.com/sarcilav/heroku-bartender/blob/master/README.markdown"
96
+ test_files: []
97
+