Sha256: 7eb05d854803ad52fcbf4872ee2cc987e76c126c20d450a93b24f2223df161a8
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
# frozen_string_literal: true require "colorize" require "json" require "pathname" require "zeitwerk" require "lerb" require_relative "lizarb/version" module Lizarb class Error < StandardError; end # SPEC = Gem::Specification.find_by_name("lizarb") GEM_DIR = SPEC.gem_dir CUR_DIR = Dir.pwd IS_APP_DIR = File.file? "#{CUR_DIR}/app.rb" IS_LIZ_DIR = File.file? "#{CUR_DIR}/lib/lizarb.rb" APP_DIR = IS_APP_DIR ? CUR_DIR : GEM_DIR # module_function def log s puts s.bold end # called from exe/lizarb def call require "app" setup_core_ext setup_gemfile require "#{APP_DIR}/app" versions = {ruby: RUBY_VERSION, bundler: Bundler::VERSION, zeitwerk: Zeitwerk::VERSION, lizarb: VERSION} bugs = SPEC.metadata["bug_tracker_uri"] puts versions.to_s.green puts "Report bugs at #{bugs}" end # called from "#{APP_DIR}/app" def bundle require "bundler/setup" Bundler.require :default bundle_liza check_mode! end # setup def setup_core_ext pattern = IS_LIZ_DIR ? "lib/lizarb/ruby/*.rb" : "#{GEM_DIR}/lib/lizarb/ruby/*.rb" Dir[pattern].each &method(:load) end def setup_gemfile ENV["BUNDLE_GEMFILE"] = IS_APP_DIR ? "#{CUR_DIR}/Gemfile" : "#{GEM_DIR}/exe/Gemfile" end # threads def thread_object_id Thread.current.object_id end @thread_ids = {thread_object_id => 0} @thread_ids_mutex = Mutex.new def thread_id @thread_ids[thread_object_id] ||= @thread_ids_mutex.synchronize do @thread_ids.count end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lizarb-1.0.3 | lib/lizarb.rb |
lizarb-1.0.2 | lib/lizarb.rb |