Sha256: e6031619eca39e31c8ff8b10bdcfbc482145edde0a6cfda1f8a9ea4d88f97220

Contents?: true

Size: 1 KB

Versions: 49

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require "rails/generators"
require File.expand_path("../plutonium_generators", __dir__)

module PlutoniumGenerators
  class CLI < Thor
    map "i" => :install
    map "g" => :generate
    map "ls" => :list
    map %w[--version -v] => :__print_version

    # desc "install", "Install Plutonium"
    # def install
    #   Rails::Generators.invoke("pu:install")
    # end

    desc "generate, g GENERATOR [options]", "Run plutonium generator"
    def generate(generator, *options)
      Rails::Generators.invoke("pu:#{generator}", options)
    end

    desc "list, ls", "View list of available generators"
    def list
      generators = Rails::Generators.sorted_groups.to_h["pu"]
      puts
      generators.each { |gen| puts gen.sub(/^pu:/, "") }
      puts
    end

    desc "--version, -v", "Print gem version"
    def __print_version
      puts "Plutonium generators #{PlutoniumGenerators::VERSION}"
    end

    class << self
      def exit_on_failure?
        true
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
plutonium-0.15.22 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.21 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.20 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.19 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.18 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.17 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.16 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.15 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.14 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.13 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.12 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.11 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.10 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.9 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.8 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.7 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.6 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.5 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.4 lib/generators/pu/lib/plutonium_generators/cli.rb
plutonium-0.15.3 lib/generators/pu/lib/plutonium_generators/cli.rb