Class: Brightly::Provider::Exec
- Inherits:
-
Object
- Object
- Brightly::Provider::Exec
- Defined in:
- lib/brightly/provider/exec.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Exec
constructor
A new instance of Exec.
Constructor Details
#initialize(argv) ⇒ Exec
Returns a new instance of Exec.
8 9 10 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 48 49 50 |
# File 'lib/brightly/provider/exec.rb', line 8 def initialize(argv) = {} OptionParser.new do |opts| opts. { "Usage: brightly [options]" } # Sinatra params opts.on('-x') { [:lock] = true } opts.on('-s server') { |val| [:server] = val } opts.on('-e env') { |val| [:environment] = val.to_sym } opts.on('-p port') { |val| [:port] = val.to_i } opts.on('-r', '--rack-file', 'Prints the path to the builtin rack file and the contents of the file.') do config = rack_file puts "#{config}:" puts File.read(config) exit end opts.on('-p path', '--passenger path', 'Generate an apache passenger config and directory structure.') do |val| config = rack_file FileUtils.mkdir_p(File.join(val)) FileUtils.mkdir_p(File.join(val, 'tmp')) FileUtils.mkdir_p(File.join(val, 'public')) FileUtils.cp(config, File.join(val)) puts "You apache conf should look something like:" puts <<-CONF <VirtualHost *:80> ServerName brightly.local DocumentRoot #{File.(File.join(val, 'public'))} </VirtualHost> CONF exit end opts.on_tail('-h', '--help', "Show this message") { puts opts ; exit } end.parse! Brightly::Provider::Base.run! end |