Sha256: 450a980df6c549c4b918d1e77a72edd6cad54ab2da8300ce428b6e83479cb6a1

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require 'cybertron/options'
require 'cybertron/version'
require 'cybertron/generate_command'
require 'thor'
require 'fileutils'
require 'rspec/core/rake_task'

module Cybertron
  # CLI class
  class CLI < Thor
    include Thor::Actions
    include Thor::RakeCompat

    RSpec::Core::RakeTask.new(:spec) do |t|
      t.rspec_opts = ['--options', './.rspec']
    end

    desc 'spec', 'Run RSpec tests for your transforms'
    def spec
      Rake::Task['spec'].invoke
    end

    def self.source_root
      File.expand_path('../templates', __dir__)
    end

    desc 'new <project-name>', 'Create a new Codemod project'
    def new(name)
      puts "Creating new project: #{name}"
      FileUtils.mkdir_p "#{name}/transforms"
      FileUtils.mkdir_p "#{name}/spec"
      template 'rspec.tt', File.absolute_path("#{name}/.rspec")
      template 'spec_helper.tt',
        File.absolute_path("#{name}/spec/spec_helper.rb")
      template 'Rakefile.tt',
        File.absolute_path("#{name}/Rakefile")
      template 'README.tt',
        File.absolute_path("#{name}/README.md")
    end

    desc 'generate', 'Generate fixtures and transforms'
    subcommand 'generate', Generate
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cybertron-0.2.5 lib/cybertron/cli.rb
cybertron-0.2.4 lib/cybertron/cli.rb