Sha256: 98695be68c0c391c5042de9a813a4c14024e4526c5e8529236f73f9dafc14f2d
Contents?: true
Size: 1.88 KB
Versions: 8
Compression:
Stored size: 1.88 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require "pathname" require 'rainbow' source_path = (Pathname.new(__FILE__).dirname + "../lib").expand_path $LOAD_PATH << source_path activate_rails_version = ->(rails_version) do rails_bin_path = Gem.activate_bin_path("railties", "rails", rails_version) rails_path = File.expand_path("../..", rails_bin_path) $LOAD_PATH.unshift(rails_path) end if (str = ARGV.first) str = str.b[/\A_(.*)_\z/, 1] if str && Gem::Version.correct?(str) rails_version = str ARGV.shift begin activate_rails_version.call(rails_version) rescue Gem::GemNotFoundException abort("Hephaestus error: Unable to find Rails version #{rails_version}") end else require "hephaestus/version" spec = Gem::Specification.find_by_name("rails", Hephaestus::RAILS_VERSION) activate_rails_version.call(spec.version.to_s) end end require "hephaestus" if ARGV.empty? puts "Please provide a path for the new application" puts puts "See --help for more info" exit 0 elsif ["-v", "--version"].include?(ARGV[0]) puts Hephaestus::VERSION exit 0 end path = ARGV.first if File.exist?(path) puts Rainbow("\nError: The directory #{path} already exists.").red exit 1 end unless path.start_with?("plug-") puts Rainbow("\nError: The directory name must start with 'plug-'").red exit 1 end unless path.length > "plug-".length puts Rainbow("\nError: The directory name must start with 'plug-'").red exit 1 end templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__)) Hephaestus::AppGenerator.source_root(templates_root) Hephaestus::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root ARGV.push("--minimal") ARGV.push("--no-skip-active-job") ARGV.push("--skip-asset-pipeline") ARGV.push("--skip-active-record") ARGV.push("--skip-docker") Hephaestus::AppGenerator.start
Version data entries
8 entries across 8 versions & 1 rubygems