class WhosIn::Application
Public Class Methods
open_app()
click to toggle source
# File lib/whos_in.rb, line 69 def self.open_app puts "Opening your application" sleep 2 `open #{@heroku_app}` sleep 3 end
run_app(app_name)
click to toggle source
# File lib/whos_in.rb, line 76 def self.run_app app_name @heroku_app = "http://#{app_name}.herokuapp.com" @heroku_url = @heroku_app + "/people" self.open_app self.run_script end
run_script()
click to toggle source
# File lib/whos_in.rb, line 60 def self.run_script tell_user_and_scan_network scheduler = Rufus::Scheduler.new scheduler.every '2m' do tell_user_and_scan_network end scheduler.join end
tell_user_and_scan_network()
click to toggle source
MAKE RUN SCRIPT
# File lib/whos_in.rb, line 52 def self.tell_user_and_scan_network script = File.expand_path('../../bin/local_scanner', __FILE__) puts "Scanning local network and posting to #{@heroku_url}" puts "Press Ctrl+C to interrupt" `#{script} #{@heroku_url}` end
Public Instance Methods
ask_for_app_id()
click to toggle source
# File lib/whos_in.rb, line 29 def ask_for_app_id puts "What is your app id?" @app_id = STDIN.gets.chomp end
ask_for_app_name()
click to toggle source
# File lib/whos_in.rb, line 14 def ask_for_app_name puts "What is the name of your Heroku application?" @name = STDIN.gets.chomp end
ask_for_pusher_details()
click to toggle source
# File lib/whos_in.rb, line 34 def ask_for_pusher_details ask_for_app_name and ask_for_pusher_key and ask_for_pusher_secret and ask_for_app_id end
ask_for_pusher_key()
click to toggle source
# File lib/whos_in.rb, line 19 def ask_for_pusher_key puts "What is your Pusher app key?" @pusher_key = STDIN.gets.chomp end
ask_for_pusher_secret()
click to toggle source
# File lib/whos_in.rb, line 24 def ask_for_pusher_secret puts "What is your Pusher app secret?" @pusher_secret = STDIN.gets.chomp end
launch_heroku_deploy()
click to toggle source
# File lib/whos_in.rb, line 8 def launch_heroku_deploy puts "Launching deployment setup... come back here when you're done" sleep 2 `open https://heroku.com/deploy?template=https://github.com/jpatel531/whos_in` end
set_config_vars()
click to toggle source
# File lib/whos_in.rb, line 38 def set_config_vars vars = "WHOS_IN_KEY=#{@pusher_key} WHOS_IN_SECRET=#{@pusher_secret} WHOS_IN_ID=#{@app_id}" puts "Setting #{vars} of #{@name}" `heroku config:set #{vars} -a #{@name}` end
setup()
click to toggle source
# File lib/whos_in.rb, line 44 def setup launch_heroku_deploy ask_for_pusher_details set_config_vars end