Module: Kettle::Dev

Defined in:
lib/kettle/dev.rb,
lib/kettle/dev.rb,
lib/kettle/dev/version.rb,
lib/kettle/dev/ci_helpers.rb,
lib/kettle/dev/ci_monitor.rb,
lib/kettle/dev/commit_msg.rb,
lib/kettle/dev/versioning.rb,
lib/kettle/dev/git_adapter.rb,
lib/kettle/dev/release_cli.rb,
lib/kettle/dev/exit_adapter.rb,
lib/kettle/dev/input_adapter.rb,
lib/kettle/dev/tasks/ci_task.rb,
lib/kettle/dev/readme_backers.rb,
lib/kettle/dev/template_helpers.rb,
lib/kettle/dev/git_commit_footer.rb,
lib/kettle/dev/tasks/install_task.rb,
lib/kettle/dev/tasks/template_task.rb

Defined Under Namespace

Modules: CIHelpers, CIMonitor, CommitMsg, ExitAdapter, InputAdapter, Tasks, TemplateHelpers, Version, Versioning Classes: Error, GitAdapter, GitCommitFooter, ReadmeBackers, ReleaseCLI

Constant Summary collapse

DEBUGGING =

Whether debug logging is enabled for kettle-dev internals.

Returns:

  • (Boolean)
ENV.fetch("DEBUG", "false").casecmp("true").zero?
IS_CI =

Whether we are running on CI.

Returns:

  • (Boolean)
ENV.fetch("CI", "false").casecmp("true") == 0
REQUIRE_BENCH =

Whether to benchmark requires with require_bench.

Returns:

  • (Boolean)
ENV.fetch("REQUIRE_BENCH", "false").casecmp("true").zero?
RUNNING_AS =

Whether to load rake tasks at the bottom of this file.
Normally they would be loaded in the project’s Rakefile,
but if we do that in this project then we can’t get accurate code coverage.

Returns:

  • (Boolean)
File.basename($PROGRAM_NAME)

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.defaultsArray<String> (readonly)

Registry for tasks that should be prerequisites of the default task

Returns:

  • (Array<String>)


46
47
48
# File 'lib/kettle/dev.rb', line 46

def defaults
  @defaults
end

Class Method Details

.install_tasksvoid

This method returns an undefined value.

Install Rake tasks useful for development and tests.

Adds RuboCop-LTS tasks, coverage tasks, and loads the
gem-shipped rakelib directory so host projects get tasks from this gem.



38
39
40
41
42
# File 'lib/kettle/dev.rb', line 38

def install_tasks
  linting_tasks
  coverage_tasks
  load("kettle/dev/tasks.rb")
end

.register_default(task_name) ⇒ Array<String>

Register a task name to be run by the default task.
Also enhances the :default task immediately if it exists.

Parameters:

  • task_name (String, Symbol)

Returns:

  • (Array<String>)

    the updated defaults registry



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/kettle/dev.rb', line 52

def register_default(task_name)
  task_name = task_name.to_s
  unless defaults.include?(task_name)
    defaults << task_name
    if defined?(Rake) && Rake::Task.task_defined?(:default)
      begin
        Rake::Task[:default].enhance([task_name])
      rescue StandardError => e
        Kernel.warn("kettle-dev: failed to enhance :default with #{task_name}: #{e.message}") if DEBUGGING
      end
    end
  end
  defaults
end