Class: Makit::Cli::Generators::Templates::Ruby::Readme

Inherits:
Object
  • Object
show all
Defined in:
lib/makit/cli/generators/templates/ruby/readme.rb

Overview

Template for Ruby gem README file

Instance Method Summary collapse

Constructor Details

#initialize(project_name) ⇒ Readme

Returns a new instance of Readme.



10
11
12
13
# File 'lib/makit/cli/generators/templates/ruby/readme.rb', line 10

def initialize(project_name)
  @project_name = project_name
  @module_name = project_name.split(/[-_]/).map(&:capitalize).join
end

Instance Method Details

#renderObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/makit/cli/generators/templates/ruby/readme.rb', line 15

def render
  <<~README
    # #{@module_name}

    Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/#{@project_name}`. To experiment with that code, run `bin/console` for an interactive prompt.

    TODO: Delete this and the text above, and describe your gem

    ## Installation

    Add this line to your application's Gemfile:

    ```ruby
    gem '#{@project_name}'
    ```

    And then execute:

        $ bundle install

    Or install it yourself as:

        $ gem install #{@project_name}

    ## Usage

    TODO: Write usage instructions here

    ## Development

    After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

    To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).

    ## Contributing

    Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/#{@project_name}.

    ## License

    The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
  README
end