Sha256: 41f5a685ba8cda1ed9c59b1fc9c73a25d2b905c6f6cdc0121a620d3088a8af10

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

#!/usr/bin/env ruby

require "bundler/setup"
require "crystalruby"
require "fileutils"

# Define the actions for the commands
def init
  # Define some dummy content for the YAML file
  yaml_content = <<~YAML
    # crystalruby configuration file
    crystal_src_dir: "./crystalruby/src"
    crystal_lib_dir: "./crystalruby/lib"
    crystal_main_file: "main.cr"
    crystal_lib_name: "crlib"
    crystal_codegen_dir: "generated"
    debug: true
  YAML

  # Create the file at the root of the current directory
  File.write("crystalruby.yaml", yaml_content)
  puts "Initialized crystalruby.yaml file with dummy content."
end

def install
  Dir.chdir("#{CrystalRuby.config.crystal_src_dir}") do
    if system("shards update")
      puts "Shards installed successfully."
    else
      puts "Error installing shards."
    end
  end
  clean
end

def clean
  # This is a stub for the clear command
  FileUtils.rm_rf("#{CrystalRuby.config.crystal_src_dir}/generated")
end

def build
  # This is a stub for the build command
  puts "Build command is not implemented yet."
end

# Main program
if ARGV.empty?
  puts "Usage: crystalruby [command]"
  puts "Commands: init, clear, build"
  exit 1
end

case ARGV[0]
when "init"
  init
when "clean"
  clean
when "install"
  install
when "build"
  build
else
  puts "Invalid command: #{ARGV[0]}"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crystalruby-0.1.12 exe/crystalruby
crystalruby-0.1.11 exe/crystalruby