Sha256: fe0a8d07274b419444e2ab96014bfd41c4c2548bd9ed9a0d889334aa56a52bdc

Contents?: true

Size: 978 Bytes

Versions: 4

Compression:

Stored size: 978 Bytes

Contents

module Potassium::CLI
  desc "Create a new Potassium Rails project."
  arg 'app_path'
  command :create do |c|
    c.default_desc "Create a new project."
    c.switch "version-check", default_value: true,
                              desc: "Performs a version check before running.",
                              negatable: true

    c.action do |global_options, options, args|
      require "potassium/newest_version_ensurer"

      begin_creation = -> do
        require "potassium/templates/application/generator"
        require "potassium/template_finder"

        template_finder = Potassium::TemplateFinder.new
        template = template_finder.default_template
        template.source_paths << Rails::Generators::AppGenerator.source_root
        template.start
      end

      if options["version-check"]
        ensurer = Potassium::NewestVersionEnsurer.new
        ensurer.ensure(&begin_creation)
      else
        begin_creation.call
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
potassium-1.3.4 lib/potassium/cli/commands/create.rb
potassium-1.3.3 lib/potassium/cli/commands/create.rb
potassium-1.3.2 lib/potassium/cli/commands/create.rb
potassium-1.3.0 lib/potassium/cli/commands/create.rb