Sha256: 098527199a66409b0f4579bc2fbc26801e06efc2cfada6cbce96a8726af0c8c3

Contents?: true

Size: 1.86 KB

Versions: 6

Compression:

Stored size: 1.86 KB

Contents

require 'bundler'
Bundler::GemHelper.install_tasks

desc 'Default: Run all tests'
task default: [:rspec, :features]

task :features do
  system 'bundle exec cucumber'
end

task :rspec do
  system 'bundle exec rspec'
end

task :readme do
  require File.expand_path('lib/geordi/cli', __dir__)

  readme = File.read('README.md')
  geordi_section_regex = /
    `geordi`\n
    -{3,}   # 3 dashes or more
    .*?     # anything, non-greedy
    (?=     # stop before:
      ^\w+\n-{3,} # the next section
    )
  /xm

  geordi_section = <<-TEXT
`geordi`
--------

The `geordi` binary holds most of the utility commands. For the few other
binaries, see the bottom of this file.

You may abbreviate commands by typing only their first letters, e.g. `geordi
con` will boot a development console, `geordi set -t` will setup a project and
run tests afterwards.

Commands will occasionally print "did you know" hints of other Geordi features.

You can always run `geordi help <command>` to quickly look up command help.
  TEXT

  Geordi::CLI.all_commands.sort.each do |_, command|
    next if command.hidden?

    geordi_section << "\n### `geordi #{command.usage}`\n"
    geordi_section << "#{command.description.sub /(\.)?$/, '.'}\n\n"
    geordi_section << "#{command.long_description.strip}\n\n" if command.long_description

    visible_options = command.options.reject {|_option_name, option_object| option_object.hide }

    if visible_options.any?
      geordi_section << "**Options**\n"
      visible_options.values.each do |option|
        geordi_section << "- `#{option.usage}`"
        geordi_section << ": #{option.description}" if option.description
        geordi_section << "\n"
      end
      geordi_section << "\n"
    end
  end

  updated_readme = readme.sub(geordi_section_regex, geordi_section)
  File.open('README.md', 'w') { |f| f.puts updated_readme.strip }
  puts 'README.md updated.'
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
geordi-11.2.0 Rakefile
geordi-11.1.0 Rakefile
geordi-11.0.0 Rakefile
geordi-10.1.0 Rakefile
geordi-10.0.1 Rakefile
geordi-10.0.0 Rakefile