class Object

Public Instance Methods

app() click to toggle source
# File lib/ramverk/setup.rb, line 29
def app
  Ramverk.rack
end
console() click to toggle source
# File lib/ramverk/cli/commands/console.rb, line 5
def console
  puts "Loading #{env} environment..."

  # Clear ARGV so IRB dont parse it
  ARGV.shift until ARGV.empty?

  # Add reload! helper method to console
  TOPLEVEL_BINDING.eval("self").__send__(:include, Ramverk::Console::CodeReloading)

  require File.expand_path("config/boot", Dir.pwd)

  # Avoid "irb: warn: can't alias context from irb_context."
  RSpec.configuration.disable_monkey_patching! if defined?(RSpec)

  require "irb"
  IRB.start
end
new(project_name) click to toggle source
# File lib/ramverk/cli/commands/new.rb, line 5
def new(project_name)
  project_name = escape(project_name)
  project_name = Ramverk::String.underscore(project_name)
  project_namespace = Ramverk::String.classify(project_name)

  config = {
    project_name: project_name,
    project_namespace: project_namespace
  }

  root = Pathname.new(Dir.pwd).join(project_name)

  template "new/.gitignore.tt", root.join(".gitignore"), config
  template "new/Gemfile.tt", root.join("Gemfile"), config
  template "new/Rakefile.tt", root.join("Rakefile"), config
  template "new/config.ru.tt", root.join("config.ru"), config
  template "new/.env.example.tt", root.join(".env.example"), config
  template "new/.env.test.tt", root.join(".env.test"), config
  template "new/.env.development.tt", root.join(".env.development"), config

  template "new/lib/project.rb.tt", root.join("lib", "#{project_name}.rb"), config
  create_file root.join("lib", project_name, ".gitkeep")

  template "new/config/environment.rb.tt", root.join("config", "environment.rb"), config
  template "new/config/boot.rb.tt", root.join("config", "boot.rb"), config

  template "new/spec/spec_helper.rb.tt", root.join("spec", "spec_helper.rb"), config
  template "new/spec/lib/project_spec.rb.tt", root.join("spec", "lib", "#{project_name}_spec.rb"), config
  create_file root.join("spec", "support", ".gitkeep")
end
server() click to toggle source
# File lib/ramverk/cli/commands/server.rb, line 8
def server
  environment = ENV["APP_ENV"] || ENV["RACK_ENV"] || "development"

  Ramverk::Server.new(
    config: "config.ru",
    Host: "0.0.0.0",
    Port: options[:port],
    AccessLog: [],
    environment: environment
  ).start
end
version() click to toggle source
# File lib/ramverk/cli/commands/version.rb, line 5
def version
  puts Ramverk::VERSION
end