Sha256: c5a39e6dbb059c7e57b0956fcfa5b252de41c00f85287bbf7342bbb9a8dd6314
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require "fileutils" module RailsInteractive class CLI class Utils def self.humanize(value) return nil if value.nil? value .gsub(/^[\s_]+|[\s_]+$/, "") .gsub(/[_\s]+/, " ") .gsub(/^[a-z]/, &:upcase) end def self.remove_templates(_project_name) FileUtils.rm_rf("templates") end def self.go_to_project_directory(project_name) Dir.chdir "./#{project_name}" end def self.copy_templates_to_project(project_name) FileUtils.cp_r "#{__dir__}/templates", "./#{project_name}" go_to_project_directory(project_name) end def self.handle_multi_options(multi_options) multi_options.each do |value| system("bin/rails app:template LOCATION=templates/setup_#{value}.rb") end end def self.handle_option(option) system("bin/rails app:template LOCATION=templates/setup_#{option}.rb") end def self.sign_project file = "README.md" msg = "\n> This project was generated by [Rails Interactive CLI](https://github.com/oguzsh/rails-interactive)" File.write(file, msg, mode: "a+") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails-interactive-2.0.0 | lib/cli/utils.rb |