Sha256: a4750f38ddd757231df317c308080d59b9cd5bf3b908e2ef3ee4f252759915d2

Contents?: true

Size: 1000 Bytes

Versions: 29

Compression:

Stored size: 1000 Bytes

Contents

# frozen_string_literal: true
module Lono
  # Checks to see command is running in a lono project.
  # If not, provide a friendly message and possibly exit.
  class ProjectChecker
    class << self
      @@checked = false
      def check
        return if @@checked

        unless File.exist?("#{Lono.root}/configs/settings.yml")
          puts "ERROR: Could not find configs/settings.yml file. Are you sure you are in lono project?".color(:red)
          quit 1
        end

        @@checked = true
      end

      # Dont exit for this one. It's okay. But show a warning.
      def empty_templates
        if Dir["#{Lono.config.templates_path}/**/*"].empty?
          puts "INFO: The app/templates folder does not contain any lono template definitions.".color(:yellow)
        end
      end

      def quit(signal)
        if ENV['LONO_TEST'] == '1'
          signal == 0 || raise("Not in lono project. pwd: #{Dir.pwd}")
        else
          exit(signal)
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
lono-7.5.2 lib/lono/project_checker.rb
lono-7.5.1 lib/lono/project_checker.rb
lono-7.5.0 lib/lono/project_checker.rb
lono-7.4.11 lib/lono/project_checker.rb
lono-7.4.10 lib/lono/project_checker.rb
lono-7.4.9 lib/lono/project_checker.rb
lono-7.4.8 lib/lono/project_checker.rb
lono-7.4.7 lib/lono/project_checker.rb
lono-7.4.6 lib/lono/project_checker.rb
lono-7.4.5 lib/lono/project_checker.rb
lono-7.4.4 lib/lono/project_checker.rb
lono-7.4.3 lib/lono/project_checker.rb
lono-7.4.2 lib/lono/project_checker.rb
lono-7.4.1 lib/lono/project_checker.rb
lono-7.4.0 lib/lono/project_checker.rb
lono-7.3.2 lib/lono/project_checker.rb
lono-7.3.1 lib/lono/project_checker.rb
lono-7.3.0 lib/lono/project_checker.rb
lono-7.2.3 lib/lono/project_checker.rb
lono-7.2.2 lib/lono/project_checker.rb