Class: HerokuWhiz

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku_whiz.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir: '.', template: 'rack', appname: 'myapp', verbose: true, debug: false) ⇒ HerokuWhiz



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/heroku_whiz.rb', line 225

def initialize(dir: '.', template: 'rack', appname: 'myapp',
      verbose: true, debug: false)

  @dir, @template, @appname, @verbose = dir, template, appname, verbose

  @app_path = File.join(@dir, @appname)

  case @template.to_sym
  when :rack
    @tapp = WhizBase.new @app_path, debug: debug
  when :sinatra
    @tapp = SinatraWhiz.new @app_path, debug: debug
  end

end

Instance Method Details

#app_openObject



252
253
254
# File 'lib/heroku_whiz.rb', line 252

def app_open()
  `heroku open`
end

#app_urlObject



241
242
243
244
245
246
247
248
249
250
# File 'lib/heroku_whiz.rb', line 241

def app_url()

  s = "https://#{heroku_app()}.herokuapp.com/"

  Clipboard.copy s
  puts 'app URL copied to clipboard.'

  return s

end

#createObject



256
257
258
259
260
261
262
263
264
265
266
# File 'lib/heroku_whiz.rb', line 256

def create()

  return unless @tapp

  @tapp.create

  # build
  `bundle install`
  sleep 1

end

#deployObject



289
290
291
292
293
294
295
# File 'lib/heroku_whiz.rb', line 289

def deploy()

  return unless @tapp

  @tapp.deploy

end

#goto(target) ⇒ Object



268
269
270
271
272
273
274
275
276
277
# File 'lib/heroku_whiz.rb', line 268

def goto(target)

  case target.to_sym
  when :apps
    Launchy.open("https://dashboard.heroku.com/apps")
  when :docs
    Launchy.open('https://devcenter.heroku.com/articles/rack')
  end

end

#local_runObject



297
298
299
300
301
302
303
# File 'lib/heroku_whiz.rb', line 297

def local_run()

  return unless @tapp

  @tapp.local_run

end

#local_testrunObject



305
306
307
308
309
310
311
# File 'lib/heroku_whiz.rb', line 305

def local_testrun()

  return unless @tapp

  @tapp.local_testrun()

end

#wipe_clean(setup = :local) ⇒ Object

currently only removes a file directory if there are no user created files



281
282
283
284
285
286
287
# File 'lib/heroku_whiz.rb', line 281

def wipe_clean(setup=:local)

  return unless @tapp

  @tapp.wipe_clean

end