Sha256: 8acaecaf54093bb2e29ea148dc1cb5bce9081fde0f747ec7596d692614619cd8

Contents?: true

Size: 1.19 KB

Versions: 14

Compression:

Stored size: 1.19 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])

        RailsAppGenerator::Util.write_last_run('rails_options_data.json', opts.to_h)

        starter = RailsAppGenerator::Starter.new(args)

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rails_app_generator-0.2.13 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.12 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.11 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.10 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.9 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.8 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.7 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.6 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.5 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.4 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.3 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.2 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.1 lib/rails_app_generator/cli/profile.rb
rails_app_generator-0.2.0 lib/rails_app_generator/cli/profile.rb