Class: Hyperfocal::Commands
- Inherits:
-
Thor
- Object
- Thor
- Hyperfocal::Commands
- Defined in:
- lib/hyperfocal/commands.rb
Instance Method Summary collapse
Instance Method Details
#setup(token = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hyperfocal/commands.rb', line 9 def setup(token=nil) return say('A token is required. Please visit http://hyperfocal.io to get a setup token', :red) if token.nil? return say('Invalid app token, please make sure you have it correct', :red) unless valid_token?(token) if File.exists?(initializer_path) say('Initializer already exists', :red) say('You can view your app at http://hyperfocal.io or remove config/initializers/hyperfocal.rb and set it up as a new app', :red) else write_initializer(token) activate_app(token) say('Congratulations, your app is ready to send events to Hyperfocal', :green) end end |
#uninstall ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/hyperfocal/commands.rb', line 24 def uninstall if File.exists?(initializer_path) File.delete(initializer_path) say('The Hyperfocal initializer has been removed.') say('Removing the gem from your Gemfile, and code from your app will complete the installation') say("We're sad to see you go, if there's anything we can do, drop us a line at [email protected]") else say('Hyperfocal does not have a configuration file, there is nothing to uninstall', :red) end end |