Permalink
Browse files

Boots in rails 3. Deal with various startup time and config issues.

  • Loading branch information...
1 parent db03ad9 commit 3241c646065bc31a88088ccacd243b55b02d0af7 @sudara committed Sep 6, 2012
Showing with 256 additions and 629 deletions.
  1. +8 −9 Gemfile
  2. +2 −0 Gemfile.lock
  3. +26 −19 README.markdown
  4. +3 −6 Rakefile
  5. +1 −1 app/controllers/application_controller.rb
  6. +0 −7 app/helpers/pages_helper.rb
  7. +1 −1 app/{models/asset_mailer.rb → mailers/asset.rb}
  8. +25 −0 app/mailers/comment.rb
  9. +20 −0 app/mailers/user.rb
  10. +1 −1 app/models/asset.rb
  11. +0 −23 app/models/comment_mailer.rb
  12. +3 −3 app/models/pic.rb
  13. +0 −27 app/models/playlist.rb
  14. +3 −3 app/models/source_file.rb
  15. +1 −1 app/models/topic.rb
  16. +1 −1 app/models/update.rb
  17. +1 −1 app/models/user/profile.rb
  18. +0 −31 app/models/user_mailer.rb
  19. +1 −1 app/views/assets/_big_share.html.erb
  20. +5 −5 app/views/assets/latest.rss.builder
  21. +1 −1 app/views/assets/show.html.erb
  22. +1 −1 app/views/forums/index.html.erb
  23. +1 −1 app/views/layouts/updates.html.erb
  24. +2 −2 app/views/shared/_visit_us.html.erb
  25. +3 −4 config.ru
  26. +8 −1 config/application.rb
  27. +0 −24 config/environment.rb
  28. +1 −1 config/initializers/concerns.rb
  29. +7 −0 config/initializers/secret_token.rb
  30. +8 −25 config/initializers/setup.rb
  31. +100 −71 config/routes.rb
  32. +17 −17 lib/asset_hacks.rb
  33. +0 −86 lib/tasks/facebook.rake
  34. +0 −167 lib/tasks/rspec.rake
  35. +0 −3 script/about
  36. +0 −6 script/autospec
  37. +0 −3 script/breakpointer
  38. +0 −3 script/console
  39. +0 −3 script/dbconsole
  40. +0 −3 script/destroy
  41. +0 −3 script/generate
  42. +0 −3 script/performance/benchmarker
  43. +0 −3 script/performance/profiler
  44. +0 −3 script/performance/request
  45. +0 −3 script/plugin
  46. +0 −3 script/process/inspector
  47. +0 −3 script/process/reaper
  48. +0 −3 script/process/spawner
  49. +5 −18 script/rails
  50. +0 −3 script/runner
  51. +0 −3 script/server
  52. +0 −10 script/spec
  53. +0 −9 script/spec_server
View
17 Gemfile
@@ -7,13 +7,11 @@ gem "unicorn"
gem "paperclip"
gem "authlogic"
-
gem "geokit"
-gem "defensio"
+gem "defensio"
gem "nokogiri"
-
gem "has_permalink"
gem "acts_as_list"
gem "redcarpet"
@@ -22,16 +20,18 @@ gem 'will_paginate'
gem "mime-types"
gem "ruby-mp3info", "~>0.7.1", :require => 'mp3info'
-# todo: remove
+# todo: remove haml, sudara hates it (requires translating about pages)
gem 'haml'
-
gem 'newrelic_rpm'
+# allows for great console printing, easiest to specify here
+gem "awesome_print", :require => 'ap'
-# replace with
+# Remove both of these once code is relpaced with redcarpet
gem 'BlueCloth', :require => 'bluecloth'
-
gem 'hpricot' # for comment processing / markdown fixing
+
+# this will need to be relpaced or updated, it's crufty, but used on about/stats
gem 'reportable', :git => 'http://github.com/saulabs/reportable.git', :require => 'saulabs/reportable'
group :assets do
@@ -44,10 +44,9 @@ end
group :development do
# bundler requires these gems in development
# gem "rails-footnotes"
-
end
-## Bundle gems used only in certain environments:
+## Who loves tests! You do? You do!
group :test, :development do
gem "rspec-rails"
gem "capybara"
View
@@ -47,6 +47,7 @@ GEM
authlogic (3.1.3)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
+ awesome_print (1.0.2)
builder (3.0.0)
capybara (1.1.2)
mime-types (>= 1.16)
@@ -212,6 +213,7 @@ DEPENDENCIES
BlueCloth
acts_as_list
authlogic
+ awesome_print
capybara
coffee-rails
country-select
View
@@ -1,48 +1,55 @@
## The future is bright
-[alonetone](http://alonetone.com) is a growing independent music platform, providing free services for musicians wanting to host and distribute their music in a non-commercial easy-to-use environment.
+[alonetone](http://alonetone.com) is at independent music platform, providing free services for musicians wanting to host and distribute their music in a non-commercial easy-to-use environment.
-alonetone was launched in January 2008. As of September 2011 it hosts over 30,000 songs from 2500 musicians and has delivered over 2 million mp3s to real listeners.
+alonetone was launched in January 2008. As of September 2012 it hosts over 40,000 songs from over 3000 musicians and has delivered over 2.5 million mp3s (to real listeners, not google and spambots!)
## Give us some dev love
-Warm the hearts of musicians worldwide by working the *only* open-source rails app that provides musicians with a free home, a connection to each other, to their listeners, and to a source of inspiration.
+Warm the hearts of musicians worldwide by working the *only* open-source rails app that provides musicians with a free home, a connection to each other and their friends/listeners.
### Bug reporting
We use [Github Issues](http://github.com/sudara/alonetone/issues) to submit bugs and keep track of our work.
### Our goal?
-To create and run the best online home a musician could want to have, providing them with the tools they need to reach their listeners and network with other artists, without the stank of commercialism or startup flava. Yup, we're half hippie communists.
+To create and run the best online home a musician could want to have. To provide them with the tools they need to reach listeners and network with other artistswithout the stank of commercialism, startup flava, ads, etc. Yup, we're half hippie communists.
-How do we reach this goal?
+Here is what we strive to build:
-* It must be easy to use, straightforward, intuitive, and consistent (grandma-friendly)
-* It must be attractive to look at
-* It provides musicians with practical, useful and inspiring tools and services
-* It provides listeners and first time site visitors with a 'hook' into their first taste of alonetone music and helps them explore the site in an intelligent and guided way
-* It encourages artist exploration and the feeling to stick around
-* It does not overwhelm folks with TMI (too much information) or TMO (too many options) or TMF (too many features)
+* An easy to use, straightforward, intuitive, and consistent interface. Grandma friendly.
+* Attractive to look at. UI-first feature building. Designer always involved.
+* Provides musicians with practical, useful tools and services—without too much junk (no facebook integration, etc)
+* Provides listeners and first time site visitors with a 'hook' into their first taste of alonetone music and helps them explore the site in an intelligent and guided way
+* Encourage artist exploration and the feeling to stick around
+* It does not overwhelm folks with TMI (too much information) or TMO (too many options) or TMF (too many features).
+* New Features must prove themselves and obey the above principles — not just be built because it sounds cool or would be fun to hack on.
For more info, visit [the alonetone faq](http://alonetone.com/about)
+### Current tech
+
+* Rails 3.2.8
+* jQuery
+* SoundManager 2 (for flash + html5 playback)
+
+
### Current feature set
* Unlimited mp3 uploads for musicians
* Creation of playlists / albums
-* MP3 streaming and download (powered by s3)
+* MP3 streaming and download (powered by amazon s3)
* Artist browsing
+* Track browsing by popularity, who you are following, most favorited, etc.
* Tracking of listens and providing useful feedback and statistics to artists
-* Commenting system
+* One-way commenting system (No inline relpies. No private messaging. No threaded comments.)
* Feeds for iTunes podcasts and offsite flash players
-### Current tech
-
-* Rails 2.3.11
-* jQuery and LowPro
-* SoundManager 2 (for flash mp3 playback)
-* SASS
+### What needs work
+* so
+* so
+* much
### Want to help us?
View
@@ -1,13 +1,10 @@
+#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
-require(File.join(File.dirname(__FILE__), 'config', 'boot'))
+require File.expand_path('../config/application', __FILE__)
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-require 'tasks/rails'
+Alonetone::Application.load_tasks
# Borrow & modified from spot-us project
desc "Copy application sample config for dev/test purposes"
@@ -24,7 +24,7 @@ class ApplicationController < ActionController::Base
# all errors end up here
def show_error(exception)
- if RAILS_ENV == 'production'
+ if Rails.env.production?
# show something decent for visitors
flash[:error] = "Whups! That didn't work out. We've logged it, but feel free to let us know (bottom right) if something is giving you trouble"
redirect_to (session[:return_to] || root_path)
@@ -1,11 +1,4 @@
module PagesHelper
-
- def basecamp_session
- config = YAML.load_file(File.join(RAILS_ROOT,'config','basecamp.yml'))['basecamp']
- @session = Basecamp.new(config['url'],config['user'],config['pass'])
- @completed = @session.lists(config['project_id'], true).collect{|list| @session.get_list(list.id)}
- @uncompleted = @session.lists(config['project_id'], false).collect{|list| @session.get_list(list.id)}
- end
# proper date format for google sitemaps
def w3c_date(date)
@@ -18,7 +18,7 @@ def upload_notification(asset, emails, sent_at = Time.now)
protected
def user_link_for(asset)
- 'http://' + ALONETONE.url + '/' + asset.user.login
+ 'http://' + Alonetone.url + '/' + asset.user.login
end
def play_link_for(asset)
View
@@ -0,0 +1,25 @@
+# -*- encoding : utf-8 -*-
+class Comment < ActionMailer::Base
+ default :from => Alonetone.email
+
+
+ def new_comment(comment, asset)
+ @comment = comment[:body]
+ @name = comment.user.name
+ @commenter = person_who_made(comment)
+ @song = asset.name
+ @number_of_comments = asset.comments_count
+ @login = comment.user.login
+
+ mail :to => comment.user.emaill, :subject => "[alonetone] Comment on '#{asset.name}' from #{person_who_made(comment)}"
+ end
+
+
+
+ protected
+
+ def person_who_made(comment)
+ comment.commenter ? comment.commenter.name : 'Guest'
+ end
+
+end
View
@@ -0,0 +1,20 @@
+# -*- encoding : utf-8 -*-
+class User < ActionMailer::Base
+ default :from => Alonetone.email
+
+ def forgot_password(user)
+ @url = "http://#{Alonetone.url}/activate/#{user.activation_code}"
+ mail :to => user.email, :subject => "[#{Alonetone.url}] Change your password"
+ end
+
+ def signup(user)
+ @url = "http://#{Alonetone.url}/activate/#{user.activation_code}"
+ mail :to => user.email, :subject => "[#{Alonetone.url}] Welcome!"
+ end
+
+ def activation(user)
+ @url = "http://#{Alonetone.url}/#{user.login}"
+ mail :to => user.email, :subject => "[#{Alonetone.url}] Your account has been activated!"
+
+ end
+end
View
@@ -118,7 +118,7 @@ def clean_permalink
end
def full_permalink
- "http://#{ALONETONE.url}/#{user.login}/#{permalink}"
+ "http://#{Alonetone.url}/#{user.login}/#{permalink}"
end
# allows classes outside Asset to use the same format
@@ -1,23 +0,0 @@
-class CommentMailer < ActionMailer::Base
-
-
- def new_comment(comment, asset, sent_at = Time.now)
- subject "[alonetone] Comment on '#{asset.name}' from #{person_who_made(comment)}"
- recipients comment.user.email
- from 'noreply@alonetone.com'
- sent_on sent_at
- body :comment => comment[:body],
- :name => comment.user.name,
- :commenter => person_who_made(comment),
- :song => asset.name,
- :number_of_comments => asset.comments_count,
- :login => comment.user.login
- end
-
- protected
-
- def person_who_made(comment)
- comment.commenter ? comment.commenter.name : 'Guest'
- end
-
-end
View
@@ -6,9 +6,9 @@ class Pic < ActiveRecord::Base
:max_size => 2048.kilobytes,
:resize_to => 'x400',
:content_type => :image,
- :storage => ALONETONE.storage,
- :path_prefix => File.join(ALONETONE.path_prefix, "pics"),
- :processor => ALONETONE.image_processor,
+ :storage => Alonetone.storage,
+ :path_prefix => File.join(Alonetone.path_prefix, "pics"),
+ :processor => Alonetone.image_processor,
:thumbnails => {
:tiny => [ 25, 25],
:small => [ 50, 50],
View
@@ -70,33 +70,6 @@ def play_time
Asset.formatted_time(total_track_length)
end
- def zip(name = self.permalink, set = self.artist.permalink)
- bundle_filename = "#{RAILS_ROOT}/public/uploads/#{set}-#{name}.zip"
-
-
-
- # set the bundle_filename attribute of this object
- self.bundle_filename = "/uploads/#{set}-#{name}.zip"
-
- # open or create the zip file
- Zip::ZipFile.open(bundle_filename, Zip::ZipFile::CREATE) {
- |zipfile|
- # collect the album's tracks
- self.tracks.collect {
- |track|
- # add each track to the archive, names using the track's attributes
- zipfile.add( "#{set}/#{track.num}-#{track.filename}",
- "#{RAILS_ROOT}/public#{track.public_filename}" )
- }
- }
-
- # set read permissions on the file
- File.chmod(0644, bundle_filename)
-
- # save the object
- self.save
- end
-
def self.latest(limit=5)
self.find(:all,
:conditions => 'playlists.tracks_count > 0',
@@ -1,12 +1,12 @@
class SourceFile < ActiveRecord::Base
belongs_to :user
- has_attachment :storage => ALONETONE.storage,
+ has_attachment :storage => Alonetone.storage,
:content_type => ['audio/x-aiff','audio/x-wav','application/zip'],
:max_size => 400.megabytes,
- :path_prefix => File.join(ALONETONE.path_prefix, "source_files"),
+ :path_prefix => File.join(Alonetone.path_prefix, "source_files"),
:s3_access => :authenticated_read,
- :processor => ALONETONE.image_processor
+ :processor => Alonetone.image_processor
validates_as_attachment
end
View
@@ -48,7 +48,7 @@ def author_name
end
def full_permalink
- "http://#{ALONETONE.url}/forums/#{permalink}"
+ "http://#{Alonetone.url}/forums/#{permalink}"
end
def sticky?
sticky == 1
View
@@ -20,7 +20,7 @@ def name
end
def full_permalink
- "http://#{ALONETONE.url}/blog/#{permalink}"
+ "http://#{Alonetone.url}/blog/#{permalink}"
end
alias :unique_id :id
@@ -50,7 +50,7 @@ def has_pic?
end
def site
- "#{ALONETONE.url}/#{login}"
+ "#{Alonetone.url}/#{login}"
end
def printable_bio
View
@@ -1,31 +0,0 @@
-class UserMailer < ActionMailer::Base
- include ActionController::UrlWriter
- @@mail_from = "support@alonetone.com"
- mattr_accessor :mail_from
-
- def forgot_password(user)
- setup_email(user)
- @subject += 'Change your alonetone password'
- @body[:url] = "http://#{ALONETONE.url}/activate/#{user.activation_code}"
- end
-
- def signup(user)
- setup_email(user)
- @body[:url] = "http://#{ALONETONE.url}/activate/#{user.activation_code}"
- end
-
- def activation(user)
- setup_email(user)
- @subject += 'Your alonetone account has been activated!'
- @body[:url] = "http://#{ALONETONE.url}/#{user.login}"
- end
-
- protected
- def setup_email(user)
- @recipients = "#{user.email}"
- @from = "#{ALONETONE.email}"
- @subject = "[#{ALONETONE.url}] "
- @sent_on = Time.now
- @body[:user] = user
- end
-end
@@ -14,6 +14,6 @@
</div>
<div class="static_content">
- <%= render :partial => 'add_to_facebook', :object => @asset if ALONETONE.enable_facebook %>
+ <%= render :partial => 'add_to_facebook', :object => @asset if Alonetone.enable_facebook %>
</div>
</div>
Oops, something went wrong.

0 comments on commit 3241c64

Please sign in to comment.