Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Some fixes, some patches, some modifications, this should fix general use #11

Merged
merged 3 commits into from

3 participants

@batmio

Some fixes, some patches, some modifications, this should fix general users issues with git@ urls and diff being broken

Ryan Lewon added some commits
lib/app.rb
@@ -155,9 +155,16 @@ module Deployinator
stack = params[:stack].to_sym
if Deployinator::Helpers.respond_to?(stack.to_s + "_git_repo_url")
repo_url = Deployinator::Helpers.send(stack.to_s + "_git_repo_url")
- parts = repo_url.split("/")
- user = parts[3]
- repo = parts[4].gsub(/\.git$/, "")
+ if repo_url == /https:\/\//
@kastner
kastner added a note

this regex should be anchord - /^htt...

and something's up with the whitespace on this line... hard tab by chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@kastner kastner merged commit f465168 into etsy:master
@nkammah
Collaborator

I believe it should actually be if repo_url =~ /^https:\/\//

@benburry benburry referenced this pull request from a commit
@benburry benburry Issue #11 - move lib/app.rb into gem 42cdd73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 29, 2011
  1. Some fixes, some patches, some modifications, this should fix general…

    Ryan Lewon authored
    … users issues with git@ urls and diff being broken
  2. Fixed anchor issue and weird tab issue

    Ryan Lewon authored
This page is out of date. Refresh to see the latest.
View
5 config/test.rb
@@ -2,4 +2,7 @@
Deployinator.issue_tracker = proc do |issue|
"https://github.com/example/repo/issues/#{issue}"
-end
+end
+
+Deployinator.default_stack = "demo"
+Deployinator.default_stack = "http"
View
8 deployinator.rb
@@ -14,6 +14,12 @@ class << self
# New Relic logging of deploys
attr_accessor :new_relic_options
+ # The default stack name
+ attr_accessor :default_stack
+
+ # The default protocol, http/https
+ attr_accessor :protocol
+
# Hostname where deployinator runs
attr_accessor :hostname
@@ -62,4 +68,4 @@ def root(path = nil)
path ? File.join(base, path) : base
end
end
-end
+end
View
3  helpers.rb
@@ -133,7 +133,7 @@ def log_and_shout(options={})
# Actual helper methods
def diff_url(stack, old_build, new_build)
- "http://#{Deployinator.hostname}/diff/#{stack}/#{old_build}/#{new_build}"
+ "#{Deployinator.protocol}://#{Deployinator.hostname}/diff/#{stack}/#{old_build}/#{new_build}"
end
def stack
@@ -182,7 +182,6 @@ def head_build
def use_github(stack, rev1, rev2)
# Hackery
- raise self.send("#{stack.to_s}_git_repo_url")
return true if self.respond_to?(stack.to_s + "_git_repo_url")
return false if [rev1, rev2].all? {|r| r.match(/^\d{5}$/)}
return true if github_info_for_stack.key?(stack)
View
23 lib/app.rb
@@ -18,7 +18,11 @@ class App < Sinatra::Base
end
get '/' do
- @stack = "demo"
+ if Deployinator.default_stack
+ @stack = Deployinator::default_stack
+ else
+ @stack = "demo"
+ end
mustache @stack
end
@@ -56,10 +60,6 @@ class App < Sinatra::Base
inst.push_order.collect {|env| [env, inst.send(meth % env)]}.to_json
end
- get '/last_chef' do
- chef_commits.gsub(/\n/, "<br>\n")
- end
-
get '/last_pushes' do
@stack = params[:stack] || "web"
@dep_env = params[:env] || "production"
@@ -155,9 +155,16 @@ def version_for_and_before(stack, env)
stack = params[:stack].to_sym
if Deployinator::Helpers.respond_to?(stack.to_s + "_git_repo_url")
repo_url = Deployinator::Helpers.send(stack.to_s + "_git_repo_url")
- parts = repo_url.split("/")
- user = parts[3]
- repo = parts[4].gsub(/\.git$/, "")
+ if repo_url == /^https:\/\//
+ parts = repo_url.split("/")
+ user = parts[3]
+ repo = parts[4].gsub(/\.git$/, "")
+ elsif repo_url == /git@github/
+ user_actual = parts[0].split(":")
+ user = user_actual[1]
+ repo = parts[1].gsub(/\.git$/, "")
+ end
+
redirect "#{github_url}#{user}/#{repo}/compare/#{params[:r1]}...#{params[:r2]}"
else
gh_info = github_info_for_stack[stack]
View
4 templates/layout.mustache
@@ -6,8 +6,8 @@
<link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" href="/css/highlight.css" type="text/css" media="screen">
<link rel="stylesheet" href="/css/style.css" type="text/css" media="screen">
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
- <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
</head>
<body>
<div id="content" class="clearfix">
View
10 views/view_helpers.rb
@@ -5,6 +5,10 @@ module ViewHelpers
HEADER_URL_EXCLUDE_STACKS = %w[web stats atlas api]
+ def protocol
+ Deployinator.protocol
+ end
+
def push_order
%w[production]
end
@@ -18,11 +22,11 @@ def groups
end
def my_url
- "http://#{@host}"
+ "#{protocol}://#{@host}"
end
def logout_url
- "http://#{auth_url}?logout=true&return=#{my_url}"
+ "#{protocol}://#{auth_url}?logout=true&return=#{my_url}"
end
def current_stack_url
@@ -31,7 +35,7 @@ def current_stack_url
else
destination = ""
end
- "http://#{@host}/#{destination}"
+ "#{protocol}://#{@host}/#{destination}"
end
def allowed_to_push_to_prod?
Something went wrong with that request. Please try again.