Sha256: 1837a2652692559d962e743bf087b562f2a9982a4213fb64f93716dc7a0e1912

Contents?: true

Size: 1015 Bytes

Versions: 43

Compression:

Stored size: 1015 Bytes

Contents

require 'rbconfig'

module Padrino
  ##
  # This method return the correct location of padrino bin or
  # exec it using Kernel#system with the given args.
  #
  # @param [Array] args
  #   command or commands to execute
  #
  # @return [Boolean]
  #
  # @example
  #   Padrino.bin('start', '-e production')
  #
  def self.bin(*args)
    @_padrino_bin ||= [self.ruby_command, File.expand_path("../../../bin/padrino", __FILE__)]
    args.empty? ? @_padrino_bin : system(args.unshift(@_padrino_bin).join(" "))
  end

  ##
  # Return the path to the ruby interpreter taking into account multiple
  # installations and windows extensions.
  #
  # @return [String]
  #   path to ruby bin executable
  #
  def self.ruby_command
    @ruby_command ||= begin
      ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
      ruby << RbConfig::CONFIG['EXEEXT']

      # escape string in case path to ruby executable contain spaces.
      ruby.sub!(/.*\s.*/m, '"\&"')
      ruby
    end
  end
end

Version data entries

43 entries across 43 versions & 2 rubygems

Version Path
padrino-core-0.13.3 lib/padrino-core/command.rb
padrino-core-0.12.8 lib/padrino-core/command.rb
padrino-core-0.12.7 lib/padrino-core/command.rb
padrino-core-0.12.6 lib/padrino-core/command.rb
padrino-core-0.13.2 lib/padrino-core/command.rb
padrino-core-0.13.1 lib/padrino-core/command.rb
padrino-core-0.13.1.beta1 lib/padrino-core/command.rb
padrino-core-0.13.0 lib/padrino-core/command.rb
padrino-core-0.13.0.beta3 lib/padrino-core/command.rb
padrino-core-0.13.0.beta2 lib/padrino-core/command.rb
padrino-core-0.12.5 lib/padrino-core/command.rb
padrino-core-0.13.0.beta1 lib/padrino-core/command.rb
padrino-core-0.12.4 lib/padrino-core/command.rb
padrino-core-0.12.3 lib/padrino-core/command.rb
padrino-core-0.12.2 lib/padrino-core/command.rb
padrino-core-0.12.1 lib/padrino-core/command.rb
padrino-core-0.12.0 lib/padrino-core/command.rb
middleman-core-3.2.2 lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/command.rb
padrino-core-0.12.0.rc3 lib/padrino-core/command.rb
padrino-core-0.12.0.rc2 lib/padrino-core/command.rb