1
0
Fork 0

Color fixes, deploy task

This commit is contained in:
magnolia-fan 2011-11-27 22:17:09 +04:00
parent 9032e8380b
commit 16c25afaef
7 changed files with 97 additions and 8 deletions

View File

@ -47,9 +47,9 @@ class window.Ajax
_page.render response
_ajax.hideSpinner()
if _session.getUser().id?
$('.button-container').show()
$('.authorized-action').show()
else
$('.button-container').hide()
$('.authorized-action').hide()
false
false

View File

@ -20,9 +20,9 @@ class window.Search
_page.render data
_search.hideSpinner()
if _session.getUser().id?
$('.button-container').show()
$('.authorized-action').show()
else
$('.button-container').hide()
$('.authorized-action').hide()
if data.status is 'loading'
setTimeout () ->
_search.loadArtistData name

View File

@ -41,9 +41,11 @@ class window.Session
displayAuthorizedContent: ->
$('.playlist, .player').show()
$('.ad_here, #login').hide()
$('.authorized-action').show()
$('#authorized').css display: 'block'
hideAuthorizedContent: ->
$('.playlist, .player, #authorized').hide()
$('.ad_here').show()
$('.authorized-action').hide()
$('#login').css display: 'block'

View File

@ -33,4 +33,11 @@ table.stats {
.data.artist {
color: inherit;
cursor: pointer;
}
.page-link {
color: inherit;
&:hover {
color: inherit;
}
}

View File

@ -24,15 +24,16 @@
%table.zebra-striped
%tr
%td
%span.label.success.set-playlist{ href: "", 'data-playlist' => "lastfm-top50/#{@data[:url_name]}" }= t('player.set_playlist')
%span.label.success.authorized-action.set-playlist{ href: "", 'data-playlist' => "lastfm-top50/#{@data[:url_name]}" }
= t('player.set_playlist')
%a.page-link.playlist-name{ href: "/playlist/lastfm-top50/#{@data[:url_name]}" }= "#{@data[:name]}: Last.fm TOP"
- @data[:albums].each do |album|
.row.album
.span4.columns.art
%img{ src: album[:pic_url] }
.button-container
%a.btn.add-album{ 'data-tracks' => album[:tracks].map{|_|_[:id]}.join(",") }= t('player.add')
.button-container.authorized-action
%a.btn.success.add-album{ 'data-tracks' => album[:tracks].map{|_|_[:id]}.join(",") }= t('player.add')
.span7.columns.tracks
%h3
= album[:name]

View File

@ -3,7 +3,7 @@
- unless @data[:pic_url].nil?
%img{ src: @data[:pic_url] }
.button-container
%a.btn.add-album{ 'data-tracks' => @data[:tracks].map{|_|_[:id]}.join(",") }= t('player.play_all')
%a.btn.success.authorized-action.add-album{ 'data-tracks' => @data[:tracks].map{|_|_[:id]}.join(",") }= t('player.play_all')
.span8.columns.tracks
%h3= @data[:name]
%table.zebra-striped.tracklist

79
lib/tasks/deploy.rake Normal file
View File

@ -0,0 +1,79 @@
namespace :deploy do
desc "Deploys our application on heroku"
task :run => [:test, :off, :push, :migrate, :restart, :on, :tag]
desc "Rolls previous deploy revision back"
task :rollback => [:off, :push_previous, :restart, :on]
task :test do
puts "Running tests ..." # and look in $?.exitstatus
throw "Tests failed!" if `cucumber`.match /\d+ scenarios \(.*?\d+ failed.*?\)/
end
task :push do
puts 'Deploying site to Heroku ...'
system('git push heroku master')
end
task :restart do
puts 'Restarting app servers ...'
system('heroku restart')
end
task :tag do
release_name = "heroku-build-#{Time.now.utc.strftime("%Y%m%d%H%M%S")}"
puts "Tagging release as '#{release_name}'"
system('git tag -a #{release_name} -m "Tagged release"')
system('git push --tags heroku')
end
task :migrate do
puts 'Running database migrations ...'
system('heroku run rake db:migrate')
end
task :off do
puts 'Putting the app into maintenance mode ...'
system('heroku maintenance:on')
end
task :on do
puts 'Taking the app out of maintenance mode ...'
system('heroku maintenance:off')
end
task :push_previous do
releases = `git tag`.split("\n").select{ |t| t[0..7] == 'heroku-build-' }.sort
current_release = releases.last
previous_release = releases[-2] if releases.length >= 2
if previous_release
puts "Rolling back to '#{previous_release}' ..."
puts "Checking out '#{previous_release}' in a new branch on local git repo ..."
system('git checkout #{previous_release}')
system('git checkout -b #{previous_release}')
puts "Removing tagged version '#{previous_release}' (now transformed in branch) ..."
system('git tag -d #{previous_release}')
system('git push heroku :refs/tags/#{previous_release}')
puts "Pushing '#{previous_release}' to Heroku master ..."
system('git push heroku +#{previous_release}:master --force')
puts "Deleting rollbacked release '#{current_release}' ..."
system('git tag -d #{current_release}')
system('git push heroku :refs/tags/#{current_release}')
puts "Retagging release '#{previous_release}' in case to repeat this process (other rollbacks)..."
system('git tag -a #{previous_release} -m "Tagged release"')
system('git push --tags heroku')
puts "Turning local repo checked out on master ..."
system('git checkout master')
puts "All done!"
else
puts "No release tags found - can't roll back!"
puts releases
end
end
end