heroku-bartender 0.1.4.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,10 +11,15 @@ Server options:
11
11
  -h, --host=HOST The hostname or ip of the host to bind to (default 0.0.0.0)
12
12
  -p, --port=PORT The port to listen on (default 4567)
13
13
  -t, --target=TARGET The target is the git remote in which you want to deploy (default heroku)
14
+ --user=USER The user to login using HTTP Basic Auth
15
+ --password=PASSWORD The password to login using HTTP Basic Auth
16
+
14
17
 
15
18
  For now you must run `heroku-bartender` inside your repo dir
16
- # Feature
17
- You can rollback your heroku app to a specific commit hash
19
+ # Features
20
+ 1. You can rollback your heroku app to a specific commit hash
21
+ 2. You can secure your heroku-bartender server using HTTP Basic Auth
22
+ 3. You can use a custom heroku remote target to deploy your app
18
23
 
19
24
  # TODO
20
25
  1. Keep update the repo
@@ -25,10 +25,22 @@ Choice.options do
25
25
  cast Integer
26
26
  default d
27
27
  end
28
+
29
+ option :user do
30
+ d = ''
31
+ long '--user=USER'
32
+ desc "The user to login using HTTP Basic Auth"
33
+ default d
34
+ end
35
+ option :password do
36
+ d = ''
37
+ long '--password=PASSWORD'
38
+ desc "The password to login using HTTP Basic Auth"
39
+ end
28
40
 
29
41
  separator ''
30
42
  separator 'Common options: '
31
-
43
+
32
44
  option :target do
33
45
  d = "heroku"
34
46
  short '-t'
@@ -55,4 +67,8 @@ end
55
67
  options = Choice.choices
56
68
 
57
69
 
58
- Heroku::Bartender::Server.start(options[:host], options[:port], options[:target])
70
+ Heroku::Bartender::Server.start(options[:host],
71
+ options[:port],
72
+ options[:target],
73
+ options[:user],
74
+ options[:password])
@@ -4,6 +4,8 @@ module Heroku
4
4
  module Bartender
5
5
  class Server < Sinatra::Base
6
6
  @@heroku_remote
7
+ @@user
8
+ @@pass
7
9
  dir = File.dirname(File.expand_path(__FILE__))
8
10
  set :views, "#{dir}/views"
9
11
  get "/" do
@@ -15,10 +17,19 @@ module Heroku
15
17
  end
16
18
  erb(:template, {}, :commits => Log.generate_commits)
17
19
  end
18
- def self.start(host, port, heroku_remote)
20
+ def self.start(host, port, heroku_remote, user, pass)
19
21
  @@heroku_remote = heroku_remote
22
+ authorize(user, pass)
20
23
  Heroku::Bartender::Server.run!(:host => host, :port => port)
21
24
  end
25
+
26
+ def self.authorize(user, pass)
27
+ if user != '' && pass != ''
28
+ use Rack::Auth::Basic, "Restricted Area" do |username, password|
29
+ [username, password] == [user, pass]
30
+ end
31
+ end
32
+ end
22
33
  end
23
34
  end
24
35
  end
@@ -1,5 +1,5 @@
1
1
  module Heroku
2
2
  module Bartender
3
- VERSION = '0.1.4.2'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: heroku-bartender
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.4.2
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sebastian Arcila-Valenzuela
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-10 00:00:00 -05:00
13
+ date: 2011-03-11 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency