Class: Picky::Generators::Server::Sinatra

Inherits:
Base
  • Object
show all
Defined in:
lib/picky-generators/generators/server/sinatra.rb

Overview

Generates a new Picky Sinatra/Unicorn Server Example.

Example:

> picky-generate sinatra_server my_sinatra_directory

Instance Attribute Summary

Attributes inherited from Base

#identifier, #name, #prototype_basedir

Instance Method Summary collapse

Methods inherited from Base

#all_prototype_files, #copy_all_files, #copy_single_file, #create_target_directory, #created, #exclaim, #exists, #expand_prototype_path, #generate_for, #smart_copy, #target_directory, #target_filename_for

Constructor Details

#initialize(identifier, name, *args) ⇒ Sinatra

Returns a new instance of Sinatra



14
15
16
# File 'lib/picky-generators/generators/server/sinatra.rb', line 14

def initialize identifier, name, *args
  super identifier, name, 'server/sinatra', *args
end

Instance Method Details

#generateObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/picky-generators/generators/server/sinatra.rb', line 20

def generate
  generate_for "Sinatra Server",
  [
    'shared/server',
    'shared/both'
  ],
  [
    "cd #{name}",
    "bundle install",
    "bundle exec rake index",
    "bundle exec unicorn -c unicorn.rb",
    "curl http://localhost:8080/books?query=turing",
    "rake todo # (optional) Shows you where Picky needs input from you."
  ]
end