Module: Stubify
- Extended by:
- Commander::Methods
- Defined in:
- lib/stubify.rb,
lib/stubify/io.rb,
lib/stubify/server.rb,
lib/stubify/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
'0.1.1'- DESCRIPTION =
'Create stub environments the easy way'
Class Attribute Summary collapse
-
.options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Class Attribute Details
.options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/stubify.rb', line 9 def end |
Class Method Details
.run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/stubify.rb', line 11 def run program :name, 'stubify' program :version, Stubify::VERSION program :description, Stubify::DESCRIPTION program :help, 'Author', 'Carlos Vidal <[email protected]>' command :server do |c| c.syntax = 'server [options]' c.description = 'Runs a local environment that will forward the requests received to the host provided. Responses will be cached' c.option '--host STRING', String, 'Host the requests will be redirected to. i.e. https://easy-peasy.io' c.option '--directory DIR', String, 'Path where fixtures will be stored. i.e. fixtures/' c.option '--port STRING', String, 'Port the local environment will listen to. Default is 4567' c.option '--verbose', 'Increases the amount of information logged' c.action do |args, | # Ensure host is set if .host.nil? raise 'Host must be provided. Run help command for more details' end # Default options .default \ port: '4567', directory: 'fixtures', verbose: false # Set env variables ENV['PORT'] = .port # Set options global attr Stubify. = # Launch Sinatra app require 'stubify/server' end end run! end |