class Cavendish::CLI

Public Instance Methods

run() click to toggle source
# File lib/cavendish/cli.rb, line 5
def run
  config = Cavendish::Config.new
  define_program
  define_create_command(config)
  run!
end

Private Instance Methods

create_command_steps() click to toggle source
# File lib/cavendish/cli.rb, line 31
def create_command_steps
  [
    Cavendish::Commands::CreateExpoProject,
    Cavendish::Commands::AddTailwind,
    Cavendish::Commands::AddReactNavigation,
    Cavendish::Commands::AddEslint,
    Cavendish::Commands::AddTesting,
    Cavendish::Commands::AddCiConfig,
    Cavendish::Commands::AddReadme,
    Cavendish::Commands::ConfigureGit
  ]
end
define_create_command(config) click to toggle source
# File lib/cavendish/cli.rb, line 20
def define_create_command(config)
  command('create') do |c|
    c.syntax = 'cavendish create'
    c.description = 'Create a new React Native + Expo project'
    c.action do |args|
      setup_config(config, args)
      create_command_steps.each { |command| command.for(config: config) }
    end
  end
end
define_program() click to toggle source
# File lib/cavendish/cli.rb, line 14
def define_program
  program :name, 'Cavendish'
  program :version, Cavendish::VERSION
  program :description, 'React Native + Expo project generator for Platanus'
end
setup_config(config, args) click to toggle source
# File lib/cavendish/cli.rb, line 44
def setup_config(config, args)
  config.project_name = args.first
  config.testing_library = choose(
    'Which testing library would you like to use?',
    'Enzyme (unit orientated library)',
    '@testing-library/react-native (integration orientated library)'
  )
end