class Ronin::CLI::Commands::New::Project
Creates new Ruby project directory.
## Usage
ronin new project [options] DIR
## Options
--git Initializes a git repo --ruby-version VERSION The desired ruby version for the project --rakefile Creates a Rakefile -D, --dockerfile Adds a Dockerfile to the new project -h, --help Print help information
## Arguments
PATH The directory to create
Public Instance Methods
run(path)
click to toggle source
Runs the ‘ronin new project` command.
@param [String] path
The path to the new project directory to create.
# File lib/ronin/cli/commands/new/project.rb, line 81 def run(path) @project_name = File.basename(path) @ruby_version = options[:ruby_version] mkdir path mkdir File.join(path,'lib') erb '.ruby-version.erb', File.join(path,'.ruby-version') erb 'Gemfile.erb', File.join(path,'Gemfile') if options[:rakefile] cp 'Rakefile', path end if options[:dockerfile] erb 'Dockerfile.erb', File.join(path,'Dockerfile') end project_file = File.join(path,"#{@project_name}.rb") erb 'project.rb.erb', project_file chmod '+x', project_file if options[:git] cp '.gitignore', path Dir.chdir(path) do sh 'git', 'init', '-q', '-b', 'main' sh 'git', 'add', '.' sh 'git', 'commit', '-q', '-m', 'Initial commit.' end end end