Permalink
Browse files

Big update to enable Cloudfuji help

  • Loading branch information...
1 parent b43bfe7 commit baf0fc7309c2f935e50dceafb1bcfba13892dd89 @sgrove sgrove committed May 9, 2012
@@ -11,7 +11,7 @@ class Kandan.Views.Chatbox extends Backbone.View
postMessageOnEnter: (event)->
- if event.keyCode== 13
+ if event.keyCode == 13
@postMessage(event)
event.preventDefault()
@@ -7,4 +7,10 @@ def active_users
format.json { render :json => ActiveUsers.all }
end
end
+
+ def me
+ respond_to do |format|
+ format.json { render :json => current_user }
+ end
+ end
end
@@ -20,9 +20,7 @@ def index
end
respond_to do |format|
- format.json do
- render :text => nested_channel_data.to_json
- end
+ format.json { render :text => nested_channel_data.to_json }
end
end
@@ -40,7 +38,7 @@ def create
end
def show
- @channel = Channel.find params[:id]
+ @channel = Channel.where("LOWER(name) = ?", params[:id].downcase).first || Channel.find(params[:id])
respond_to do |format|
format.json { render :json => @channel }
end
@@ -39,5 +39,17 @@
<audio class="audio_private"></audio>
<audio class="audio_common"></audio>
</ul>
+
+ <%- if user_signed_in? && Cloudfuji::Platform.on_cloudfuji? %>
+ <%= javascript_tag do %>
+ <%- cloudfuji_help_vars = {
+ "HUBOT_KANDAN_TOKEN" => User.find_by_email("hubot@cloudfuji.com").try(:authentication_token),
+ "HUBOT_KANDAN_HOST" => ENV['CLOUDFUJI_DOMAIN']
+ }
+ %>
+
+ window._cloudfuji_help = <%= cloudfuji_help_vars.to_json.html_safe %>;
+ <%- end %>
+ <%- end %>
</body>
</html>
View
@@ -37,5 +37,14 @@ namespace :cloudfuji do
a.save!
end
end
+
+ # Create Hubot
+ Rake::Task['kandan:boot_hubot'].invoke
+ end
+
+ desc "Run on update for a Busido app. Copies config files and seeds db."
+ task :update => :environment do
+ # Create Hubot if not already present
+ Rake::Task['kandan:boot_hubot'].invoke
end
end
View
@@ -39,4 +39,34 @@ namespace :kandan do
end
end
end
+
+ desc "Creates the default hubot account."
+ task :boot_hubot => :environment do
+ user = User.find_by_email("hubot@cloudfuji.com")
+
+ if user.nil?
+ puts "Creating hubot user..."
+
+ password = ""
+ 128.times { password << (('a'..'z').to_a + ('A'..'Z').to_a + ['!','@','#','$','%','^','&','*','(',')'].to_a).sample }
+
+ hubot = User.new
+ hubot.email = "hubot@cloudfuji.com"
+ hubot.first_name = "Hubot"
+ hubot.last_name = "vonGithubben"
+ hubot.ido_id = "a-bot-lives-in-solitude"
+ hubot.password = password if hubot.respond_to?("password=".to_sym)
+ hubot.password_confirmation = password if hubot.respond_to?("password_confirmation=".to_sym)
+ hubot.save!
+ end
+ end
+
+ desc "Output the hubot access key"
+ task :hubot_access_key => :environment do
+ if authentication_token = User.find_by_email("hubot@cloudfuji.com").try(:authentication_token)
+ puts "Your hubot access key is #{ authentication_token }"
+ else
+ puts "There's not hubot account. Run rake kandan:boot_hubot to create a bot account."
+ end
+ end
end

0 comments on commit baf0fc7

Please sign in to comment.