Class: WhosIn::Application
- Inherits:
-
Object
- Object
- WhosIn::Application
- Defined in:
- lib/whos_in.rb
Class Method Summary collapse
- .open_app ⇒ Object
- .run_app(app_name) ⇒ Object
- .run_script ⇒ Object
-
.tell_user_and_scan_network ⇒ Object
MAKE RUN SCRIPT.
Instance Method Summary collapse
- #ask_for_app_id ⇒ Object
- #ask_for_app_name ⇒ Object
- #ask_for_pusher_details ⇒ Object
- #ask_for_pusher_key ⇒ Object
- #ask_for_pusher_secret ⇒ Object
- #launch_heroku_deploy ⇒ Object
- #set_config_vars ⇒ Object
- #setup ⇒ Object
Class Method Details
.open_app ⇒ Object
67 68 69 70 71 72 |
# File 'lib/whos_in.rb', line 67 def self.open_app puts "Opening your application" sleep 2 `open #{@heroku_app}` sleep 3 end |
.run_app(app_name) ⇒ Object
74 75 76 77 78 79 |
# File 'lib/whos_in.rb', line 74 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 ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/whos_in.rb', line 58 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 ⇒ Object
MAKE RUN SCRIPT
52 53 54 55 56 |
# File 'lib/whos_in.rb', line 52 def self.tell_user_and_scan_network puts "Scanning local network and posting to #{@heroku_url}" puts "Press Ctrl+C to interrupt" `bin/local_scanner.sh #{@heroku_url}` end |
Instance Method Details
#ask_for_app_id ⇒ Object
29 30 31 32 |
# 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 ⇒ Object
14 15 16 17 |
# 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 ⇒ Object
34 35 36 |
# 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 ⇒ Object
19 20 21 22 |
# 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 ⇒ Object
24 25 26 27 |
# 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 ⇒ Object
8 9 10 11 12 |
# 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 ⇒ Object
38 39 40 41 42 |
# 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 ⇒ Object
44 45 46 47 48 |
# File 'lib/whos_in.rb', line 44 def setup launch_heroku_deploy ask_for_pusher_details set_config_vars end |