Sha256: 9b79901a6f6c61273b588176860848fe4dc839c285be6dd8264cdbe08d5d63dd

Contents?: true

Size: 1.11 KB

Versions: 29

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

module RailsAppGenerator
  module Cli
    # Folder Diff
    class Profile < Thor
      desc 'xxx [options]', 'Create a new rails app based on a RAG profile'

      option :profile_path            , type: :string
      option :fallback_profile_path   , type: :string

      # rubocop:disable Metrics/AbcSize
      def profile(name)
        path          = options[:profile_path] || options[:fallback_profile_path]
        profile_name  = name.end_with?('.json') ? name : "#{name}.json"
        profile_file  = File.join(path, profile_name)

        unless File.exist?(profile_file)
          puts "Profile [#{profile_file}] not found"
          exit 1
        end

        puts "Using profile #{profile_file}"

        profile       = JSON.parse(File.read(profile_file), symbolize_names: true)
        args          = profile[:args]
        opts          = RailsAppGenerator::RailsOptions.new(profile[:opts])

        starter       = RailsAppGenerator::Starter.new(args)

        starter.delete_target_folder
        starter.start(opts)
      end
      # rubocop:enable Metrics/AbcSize
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
rails_app_generator-0.1.28 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.27 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.26 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.25 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.24 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.23 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.22 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.21 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.20 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.19 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.18 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.17 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.16 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.15 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.14 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.13 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.12 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.11 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.10 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.1.9 lib/rails_app_generator/cli/profile.rb