Reputation: 79
when i deploy to a new server for the first time i am getting this error. I have included the file that it references. as well as the error that is shown in the deployment process.
Any help would be appreciated.
servers: ["108.235.52.160"]
[108.235.52.160] executing command
** [out :: 108.235.52.160] rake aborted!
** [out :: 108.235.52.160] SyntaxError: unexpected INDENT
** [out :: 108.235.52.160] (in /home/deployer/loadmax/releases/20140328165152/a
pp/assets/javascripts/subscriptions.js.coffee)
** [out :: 108.235.52.160]
** [out :: 108.235.52.160] Tasks: TOP => assets:precompile:primary
File:
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
$(document).ready ->
if window.location.search.substring(1) == "demo=true"
$("select#sub").val("6")
$(".price").hide()
$('#package').change ->
if $('#package option:selected').val() == "4" or $('#package option:selected').val() == "6"
$(".price option[value='299']").remove()
$(".price option[value='59.99']").remove()
else
$(".price").append("<option value='299'>299 Annually</option>")
$(".price").append("<option value='59.99'>59.99 Monthly</option>")
$('.recurrence').change ->
if $('.recurrence option:selected').val() == 'Annual'
$(".price").append("<option value='299'>299</option>")
$(".price").append("<option value='239'>239</option>")
$(".price").append("<option value='199'>199</option>")
$(".price option[value='39.99']").remove()
else
$(".price").append("<option value='39.99'>39.99</option>")
$(".price option[value='299']").remove()
$(".price option[value='239']").remove()
$(".price option[value='199']").remove()
$('#subscription_tier').change ->
if $('#subscription_tier option:selected').val() == '4'
$("label[for='recurrence_recurrence']").hide()
$(".recurrence").hide()
$("label[for='price_point_Price point']").hide()
$(".price").hide()
else
$("label[for='recurrence_recurrence']").show()
$(".recurrence").show()
$("label[for='price_point_Price point']").show()
$(".price").show()
$('#sub').change ->
if $('#sub option:selected').val() == "6"
$(".price").hide()
$(".recurrence").hide()
else
$(".price").show()
$(".recurrence").show()
$('.email').change ->
email = $(this).val()
$.get "/users/?email="+email, (user) ->
if user.length == 0
$('#alert_placeholder').hide()
$('.submit').show()
else
error_message = "This email address is already in use."
$('#alert_placeholder').show()
$('#alert_placeholder').
html("<div class='alert alert-error alert-block'><h4 class='alert-heading'>Duplicate Email!</h4><span>#{error_message}</span></div>")
$('.submit').hide()
$('.name').change ->
name = $(this).val() ->
name = name.replaceAll("[^A-Za-z0-9]", "");
if $(this).name.val() ->
$('#alert_placeholder').hide()
$('.submit').show()
else
error_message = "No comma's allowed in form."
$('#alert_placeholder').show()
$('#alert_placeholder').
html("<div class='alert alert-error alert-block'><h4 class='alert-heading'>Comma Error!</h4><span>#{error_message}</span></div>")
$('.submit').hide()
$('.mc').change ->
mc = $(this).val()
unless mc==''
$.get "/companies/?mc="+mc, (companies) ->
unless companies.length == 0
for company in companies
if company['status'] == true
#if there is an active company with this mc number, then we throw
#an error instructing the Sales Agent to refer the customer to an
#Account Manager.
error_message="This company has an active account in loadmax. Please refer the customer to an Account Manager"
$('#alert_placeholder').
html("<div class='alert alert-error alert-block'><h4 class='alert-heading'>Active Company Error!</h4><span>#{error_message}</span></div>")
active_company_exists = true
unless active_company_exists
popover_text = 'There exist inactive account(s) in our system with the
same MC number:<table class="table table-striped">'
li = []
for company in companies
#If we've reached here, then there exists an inactive account with
#the same MC number. The get request bellow will always return
#one company, as should be obvious.
temp = ''
$.ajax
url: "/subscriptions?company_id=#{company['id']}"
type: "GET"
async: false
success: (subscription) ->
href = "http://secure.loadmax.com/subscriptions/dashboard/"+
subscription[0]['id']+"?paysysid="+subscription[0]['paysysid']
temp += '<tr><td><b>'+company['name']+'</b><td>'
temp += "<td><a href="+href+"> Use </a></td></tr>"
.done ->
li.push temp
popover_text += li.join " "
popover_text += "</table>"
$('.mc-popover').popover(html: true, placement: 'right', content: popover_text )
$('.mc-popover').popover("show")
else
Coffeescript website Helped a ton Thanks guys..
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
$(document).ready ->
if window.location.search.substring(1) == "demo=true"
$("select#sub").val("6")
$(".price").hide()
$('#package').change ->
if $('#package option:selected').val() == "4" or $('#package option:selected').val() == "6"
$(".price option[value='299']").remove()
$(".price option[value='59.99']").remove()
else
$(".price").append("<option value='299'>299 Annually</option>")
$(".price").append("<option value='59.99'>59.99 Monthly</option>")
$('.recurrence').change ->
if $('.recurrence option:selected').val() == 'Annual'
$(".price").append("<option value='299'>299</option>")
$(".price").append("<option value='239'>239</option>")
$(".price").append("<option value='199'>199</option>")
$(".price option[value='39.99']").remove()
else
$(".price").append("<option value='39.99'>39.99</option>")
$(".price option[value='299']").remove()
$(".price option[value='239']").remove()
$(".price option[value='199']").remove()
$('#subscription_tier').change ->
if $('#subscription_tier option:selected').val() == '4'
$("label[for='recurrence_recurrence']").hide()
$(".recurrence").hide()
$("label[for='price_point_Price point']").hide()
$(".price").hide()
else
$("label[for='recurrence_recurrence']").show()
$(".recurrence").show()
$("label[for='price_point_Price point']").show()
$(".price").show()
$('#sub').change ->
if $('#sub option:selected').val() == "6"
$(".price").hide()
$(".recurrence").hide()
else
$(".price").show()
$(".recurrence").show()
$('.email').change ->
email = $(this).val()
$.get "/users/?email="+email, (user) ->
if user.length == 0
$('#alert_placeholder').hide()
$('.submit').show()
else
error_message = "This email address is already in use."
$('#alert_placeholder').show()
$('#alert_placeholder').
html("<div class='alert alert-error alert-block'><h4 class='alert-heading'>Duplicate Email!</h4><span>#{error_message}</span></div>")
$('.submit').hide()
$('.name').change ->
name = $(this).val() ->
name = name.replaceAll("[^A-Za-z0-9]", "");
if $(this).name.val()
$('#alert_placeholder').hide()
$('.submit').show()
else
error_message = "No comma's allowed in form."
$('#alert_placeholder').show()
$('#alert_placeholder').
html("<div class='alert alert-error alert-block'><h4 class='alert-heading'>Comma Error!</h4><span>#{error_message}</span></div>")
$('.submit').hide()
$('.mc').change ->
mc = $(this).val()
unless mc==''
$.get "/companies/?mc="+mc, (companies) ->
unless companies.length == 0
for company in companies
if company['status'] == true
#if there is an active company with this mc number, then we throw
#an error instructing the Sales Agent to refer the customer to an
#Account Manager.
error_message="This company has an active account in loadmax. Please refer the customer to an Account Manager"
$('#alert_placeholder').
html("<div class='alert alert-error alert-block'><h4 class='alert-heading'>Active Company Error!</h4><span>#{error_message}</span></div>")
active_company_exists = true
unless active_company_exists
popover_text = 'There exist inactive account(s) in our system with the
same MC number:<table class="table table-striped">'
li = []
for company in companies
#If we've reached here, then there exists an inactive account with
#the same MC number. The get request bellow will always return
#one company, as should be obvious.
temp = ''
$.ajax
url: "/subscriptions?company_id=#{company['id']}"
type: "GET"
async: false
success: (subscription) ->
href = "http://secure.loadmax.com/subscriptions/dashboard/"+
subscription[0]['id']+"?paysysid="+subscription[0]['paysysid']
temp += '<tr><td><b>'+company['name']+'</b><td>'
temp += "<td><a href="+href+"> Use </a></td></tr>"
.done ->
li.push temp
popover_text += li.join " "
popover_text += "</table>"
$('.mc-popover').popover(html: true, placement: 'right', content: popover_text )
$('.mc-popover').popover("show")
else
Upvotes: 1
Views: 468
Reputation: 1190
The direct meaning of UNEXPECTED INDENT
is that a line of code is indented too much, but it may also be observed as the result of a syntax error having occurred on the previous line.
In order to locate this error, you should start by cleaning up the code. For CoffeeScript (and all languages, in my opinion, but that is up for debate) to remain readable and maintainable, it should be broken up into small functions. The fact that you have what looks to be approximately 8 levels of indentation near the bottom of the attached snippet would make any error difficult to identify.
If the error persists after you have broken the highly nested code above into smaller functions (which I doubt it will; the problem will likely reveal itself as you clean up), you can begin replacing the content of those functions with stubs.
Once you have found the offending 5 lines of code, stare at the code intently until the problem reveals itself.
If necessary, add coffee.
P.S.
I have also encountered this issue in the past if a discrepancy existed in the code file between \tab
characters and two spaces
indentation. So if your IDE allows it, either enable whitespace display or perform whatever whitespace cleanup option it has available.
Upvotes: 1