Skip to content
Browse files

added public - private flag for deployment options

  • Loading branch information...
1 parent 64de7a5 commit 1bc59065b08204a3a4a1940d4adfc6a6596a8c32 @chrismatthieu committed
View
4 Gemfile
@@ -6,7 +6,7 @@ gem "rake", "0.8.7"
gem 'mysql2', '~> 0.2.6'
# used for heroku and web app
-# gem "aws-s3", :require => "aws/s3"
-# gem "flickraw"
+gem "aws-s3", :require => "aws/s3"
+gem "flickraw"
View
10 Gemfile.lock
@@ -29,10 +29,17 @@ GEM
activesupport (= 3.0.9)
activesupport (3.0.9)
arel (2.0.10)
+ aws-s3 (0.6.2)
+ builder
+ mime-types
+ xml-simple
builder (2.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
+ flickraw (0.8.4)
+ json (>= 1.1.1)
i18n (0.5.0)
+ json (1.5.3)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
@@ -69,11 +76,14 @@ GEM
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.29)
+ xml-simple (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
+ aws-s3
+ flickraw
mysql2 (~> 0.2.6)
rails (= 3.0.9)
rake (= 0.8.7)
View
5 app/controllers/application_controller.rb
@@ -1,6 +1,11 @@
class ApplicationController < ActionController::Base
# protect_from_forgery
+
def isNumeric(s)
Float(s) != nil rescue false
end
end
+
+class DEPLOY
+ CLOUDTYPE = "public" #private
+end
View
8 app/controllers/conferences_controller.rb
@@ -7,6 +7,9 @@ def offline
# GET /conferences
# GET /conferences.xml
def index
+
+ if DEPLOY::CLOUDTYPE == 'public'
+
@conferences = Conference.where("inprogress = ?", true)
respond_to do |format|
@@ -29,6 +32,11 @@ def index
format.xml { render :xml => @conferences }
format.json { render :json => @conferences }
end
+
+ else
+ redirect_to :action => "offline"
+ end
+
end
# GET /conferences/1
View
32 app/models/data_file.rb
@@ -1,7 +1,7 @@
class DataFile < ActiveRecord::Base
require 'rubygems'
- # require 'aws/s3'
+ require 'aws/s3'
def self.save(upload)
name = upload.original_filename
@@ -9,21 +9,25 @@ def self.save(upload)
if name #.length > 0
- # AWS::S3::Base.establish_connection!(
- # :access_key_id => CONFIG['aws_access_key_id'],
- # :secret_access_key => CONFIG['aws_secret_access_key']
- #
- # )
- # AWS::S3::S3Object.store(name, open(upload), CONFIG['aws_bucket'], :access => :public_read)
+ if DEPLOY::CLOUDTYPE == 'public'
- # local writes
- directory = "public/data"
- # create the file path
- path = File.join(directory, name)
- # write the file
- File.open(path, "wb") { |f| f.write(upload.read) }
- # File.open(path, "wb") { |f| f.write(upload['datafile'].read) }
+ AWS::S3::Base.establish_connection!(
+ :access_key_id => CONFIG['aws_access_key_id'],
+ :secret_access_key => CONFIG['aws_secret_access_key']
+
+ )
+ AWS::S3::S3Object.store(name, open(upload), CONFIG['aws_bucket'], :access => :public_read)
+ else
+ # local writes
+ directory = "public/data"
+ # create the file path
+ path = File.join(directory, name)
+ # write the file
+ File.open(path, "wb") { |f| f.write(upload.read) }
+ # File.open(path, "wb") { |f| f.write(upload['datafile'].read) }
+ end
+
end
end
View
3 app/views/conferences/offline.html.erb
@@ -1 +1,2 @@
-Voice Board is Live!
+<p>Voice Board is Live!</p>
+Cloud: <%= DEPLOY::CLOUDTYPE %>
View
34 app/views/layouts/application.html.erb
@@ -7,6 +7,40 @@
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
+<meta charset='utf-8'>
+<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
+<meta content='width=device-width, initial-scale=1.0' name='viewport'>
+<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
+<!-- <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js' type='text/javascript'></script> -->
+<script src='/fullScreenMusic/soundmanager/script/soundmanager2.js' type='text/javascript'></script>
+<script src='/fullScreenMusic/ttwFullScreenMusic.js' type='text/javascript'></script>
+<link href='/fullScreenMusic/css/style.css' rel='stylesheet' type='text/css'>
+
+
+<script>
+ //<![CDATA[
+ soundManager.flashVersion = 9;
+ soundManager.useHighPerformance = true;
+ soundManager.wmode = 'transparent';
+ soundManager.useFastPolling = true;
+ soundManager.url = '/fullScreenMusic/soundmanager/swf/';
+ soundManager.debugMode = false;
+ soundManager.autoPlay = true;
+ soundManager.autoAdvance = true;
+ // soundManager.showPlaylist = true;
+
+ soundManager.onload = function() {
+ // $('.playlist').ttwFullScreenMusic({style:'page-list'});
+ $('.playlist').ttwFullScreenMusic({style:'fullscreen'});
+ }
+ //]]>
+</script>
+
+<link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/ui-blitzer/jquery-ui.css"/>
+<script type="text/javascript" src="http://s.phono.com/releases/0.2/jquery.phono.js"></script>
+<script type="text/javascript" src="http://s.phono.com/addons/callme/79a53b7/jquery.callme.js"></script>
+
+
</head>
<body>
View
7 config/routes.rb
@@ -1,4 +1,7 @@
Voiceboard::Application.routes.draw do
+
+ match '/offline' => 'conferences#offline'
+
resources :voicememos
resources :conferences
@@ -57,8 +60,8 @@
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
- # root :to => "conferences#index"
- root :to => "conferences#offline"
+ root :to => "conferences#index"
+ # root :to => "conferences#offline"
# See how all your routes lay out with "rake routes"
View
1 tropo_voicememo.rb
@@ -38,6 +38,7 @@
lastmsg = memo["conference"]["id"]
memorec = RestClient.get apiurl + '/conferences/' + memo["conference"]["id"].to_s + '.json?callerid=' + $currentCall.callerID
memorecdata = JSON.parse(memorec)
+
say apiurl + "/data/" + memorecdata["conference"]["filename"]
# say "http://voicememo-uploads.s3.amazonaws.com/" + memorecdata["conference"]["filename"]
end

0 comments on commit 1bc5906

Please sign in to comment.
Something went wrong with that request. Please try again.