Class: Cli::Commands::NewApp::Files::Irbrc

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/commands/new_app/files/irbrc.rb

Class Method Summary collapse

Class Method Details

.callObject



8
9
10
# File 'lib/cli/commands/new_app/files/irbrc.rb', line 8

def self.call
  File.write(".irbrc", content)
end

.contentObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cli/commands/new_app/files/irbrc.rb', line 12

def self.content
  <<~RUBY
    # frozen_string_literal: true

    # Kirei needs to know where the root of the project is
    APP_ROOT = File.expand_path(__dir__)

    ENV["RACK_ENV"] ||= "development"
    ENV["APP_VERSION"] ||= (ENV["GIT_SHA"] ||= `git rev-parse --short HEAD`.to_s.chomp.freeze)
    require("dotenv/load") if %w[test development].include?(ENV["RACK_ENV"])
    require_relative("app")
  RUBY
end