Sha256: 0696e754f7f0654ee375e2677096cd5747f9944c55adb17a6955e7e35b79462f

Contents?: true

Size: 1.42 KB

Versions: 6

Compression:

Stored size: 1.42 KB

Contents

require 'thor'

module Daigaku
  module Terminal

    require_relative 'courses'
    require_relative 'solutions'
    require_relative 'setup'
    require_relative 'output'

    class CLI < Thor
      include Terminal::Output

      desc 'courses [COMMAND]', 'Handle daigaku courses'
      subcommand 'courses', Terminal::Courses

      desc 'solutions [COMMAND]', 'Handle your solutions'
      subcommand 'solutions', Terminal::Solutions

      desc 'setup [COMMAND]', 'Change daigaku setup'
      subcommand 'setup', Terminal::Setup

      def self.start
        Daigaku.config.import!
        super
      end

      desc 'about', 'About daigaku'
      def about
        Welcome.about
      end

      desc 'welcome', 'Setup daigaku the first time and learn some important commands.'
      def welcome
        Welcome.run
      end

      desc 'scaffold', 'Scaffold solution files for your courses.'
      def scaffold
        generator = Generator.new
        generator.prepare

        courses_path = Daigaku.config.courses_path
        solutions_path = Daigaku.config.solutions_path

        generator.scaffold(courses_path, solutions_path)

        say_info "You will find your solution files in\n#{solutions_path}."
      end

      desc 'learn', 'Go to daigaku to learn Ruby!'
      def learn
        courses = Loading::Courses.load(Daigaku.config.courses_path)
        courses.empty? ? Courses.new.list : Daigaku.start
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
daigaku-0.3.0 lib/daigaku/terminal/cli.rb
daigaku-0.2.0 lib/daigaku/terminal/cli.rb
daigaku-0.1.1 lib/daigaku/terminal/cli.rb
daigaku-0.1.0 lib/daigaku/terminal/cli.rb
daigaku-0.0.2 lib/daigaku/terminal/cli.rb
daigaku-0.0.1 lib/daigaku/terminal/cli.rb