GithubHelp home page GithubHelp logo

colindean / fillertext Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 3.0 117 KB

A filler text generation gem with an intuitive interface

Home Page: https://rubygems.org/gems/fillertext

License: Other

Ruby 99.51% Shell 0.49%
hacktoberfest

fillertext's Introduction

FillerText

by @colindean

Testing Build Status Release Build Status Gem Version

Introduction

FillerText is a gem useful for generating, well, filler text. It can do the standard "lorem ipsum" text or a variety of other clever substitute texts.

Installing FillerText

Install using:

gem install fillertext

or add the gem to your project's Gemfile:

gem 'fillertext'

Using FillerText

Here's how you use FillerText.

There are two main ways. One is cleaner because it keeps FillerText within its own namespace. The other method will add Fixnum#filler to keep some tasty syntactical sugar.

FillerText::FillerText.sentences 5
FillerText::FillerText.words 2
FillerText::FillerText.characters 5
FillerText::FillerText.bytes 4
FillerText::FillerText.paragraphs 1

or the much easier and intended method:

2.filler.sentences
1.filler.paragraphs

You can also change the style from the default "lorem ipsum" to something else.

# the old favorite
FillerText::FillerText.style = FillerText::Style::LoremIpsum
# a mash of words
FillerText::FillerText.style = FillerText::Style::HipsterIpsum
# handmade just like grandma's pierogies
FillerText::FillerText.style = FillerText::Style::YinzerIpsum
# homage to the great Pittsburgh Penguins announcer
FillerTest::FillerText.style = FillerText::Style::MikeLange

Contributing to FillerText

Setting up the project

  1. Create a fork of the GitHub project repo.
  2. git clone the forked repository to your local system.
  3. Make sure that the version of Ruby you're using meets the minimum requirement in the gemspec.
  4. Run bundle install to install dependencies. It should tell you at this point if you don't have an adequate Ruby version installed.
  5. Check basic sanity by running bundle exec rake to run tests and checks before you make any changes.
  6. Make your changes and commit them to a feature branch. If you're picking a particular GitHub issue, please put gh-##-topic in the branch where ## is the ticket number and topic is a few words about it.
  7. Push to your own repo and then submit a pull request to this one!

Testing the project

FillerText uses RSpec for unit testing and SimpleCov for code coverage. New specifications can be added inside the spec/ directory.

  1. Make sure that the project is set up properly (see Setting up the project)
    1. Run rspec to run all the tests by default
    2. To run only a selected few tests, run rspec spec/<test_you're_interested_in>_spec.rb
  2. To access code coverage details, run xdg-open coverage/index.html (on Linux) or open coverage/index.html (on Mac)

Patches welcome. Please file using Github issues.

I sincerely thank Ashvith Shetty for modernizing the build system for this software in 2022. Things are a lot easier to handle now than they were in 2011!

Releases

As of 0.2.3, FillerText uses release-please along with release-please-action for release automation in GitHub Actions.

Following Conventional Commits v1.0 standard, prefix a commit with fix: to increment the patch version in a future release, prefix with feat: to increment the minor version, and prefix with feat!: or fix!: or refactor!: to mark a breaking change and a major version increment.

For more information, read the release-please-action documentation on releasing.

License

FillerText is licensed under the MIT license. Copyright (C) 2011-2022 by Colin Dean. See LICENSE.txt for more.

fillertext's People

Contributors

ashvith10 avatar colindean avatar dependabot[bot] avatar github-actions[bot] avatar m3xq avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fillertext's Issues

Restore testing on jruby

I know that it "works" but when added to travis:

$ bundle exec rake
bundler: failed to load command: rake (/home/travis/build/colindean/fillertext/vendor/bundle/jruby/2.5.0/bin/rake)
Gem::Exception: can't find executable rake for gem rake. rake is not currently included in the bundle, perhaps you meant to add it to your Gemfile?
  /home/travis/.rvm/gems/jruby-9.2.0.0/gems/bundler-1.16.6/lib/bundler/rubygems_integration.rb:462:in `block in find_spec_for_exe'
  /home/travis/.rvm/gems/jruby-9.2.0.0/gems/bundler-1.16.6/lib/bundler/rubygems_integration.rb:482:in `block in activate_bin_path'
  /home/travis/build/colindean/fillertext/vendor/bundle/jruby/2.5.0/bin/rake:23:in `<main>'
  org/jruby/RubyKernel.java:994:in `load'
The command "bundle exec rake" exited with 1.
Done. Your build exited with 1.

Address deprecated use of must_equal

In tests:

DEPRECATED: global use of must_equal from /home/runner/work/fillertext/fillertext/spec/fillertext_spec.rb:93. Use _(obj).must_equal instead. This will fail in Minitest 6.

Could move up to Minitest 6, too...

Code coverage isn't implemented properly

The code coverage implementation is wrong, and checks for specification files instead of library files.

How can this be fixed?

  1. Rewrite spec_helper.rb to exclude require "fillertext"
  2. Add require "fillertext" separately to each spec file
  3. In spec_helper.rb, use filters to exclude all files inside spec/ (Check this to understand how to use add_filter)

How to access code coverage details?

  1. Run the rspec command
  2. Follow this with the xdg-open coverage/index.html (On Linux) or open coverage/index.html (On Mac).

Add instructions to README for contribution

This can be simply included in the README.md file. Here are some starter ideas I have come up with, which could be included.

  • How to start with the project?: Fork the project and run bundle install to install all the required dependencies
  • How to install the gem: Run gem install fillertext
  • How to test the project?: Simply run rspec. To run a specific test, run rspec spec/<test_you're_interested_in>_spec.rb
  • How to access code coverage details: First run rspec, then xdg-open coverage/index.html (Linux) or open coverage/index.html (Mac)

Resolve inability to test on jruby

#25 switched to GitHub Actions but I still can't get jruby to work so I disabled it in d3187b1.

  Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
  
  current directory:
  /home/runner/work/fillertext/fillertext/vendor/bundle/jruby/2.6.0/gems/racc-1.6.0/ext/racc/cparse
  /home/runner/.rubies/jruby-9.3.1.0/bin/jruby -I
  /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib -r
  ./siteconf20211023-2020-1g1tg61.rb extconf.rb
  checking for rb_block_call()... *** extconf.rb failed ***
  Could not create Makefile due to some reason, probably lack of necessary
  libraries and/or headers.  Check the mkmf.log file for more details.  You may
  need configuration options.
  
  Provided configuration options:
  	--with-opt-dir
  	--without-opt-dir
  	--with-opt-include
  	--without-opt-include=${opt-dir}/include
  	--with-opt-lib
  	--without-opt-lib=${opt-dir}/lib
  	--with-make-prog
  	--without-make-prog
  	--srcdir=.
  	--curdir
  	--ruby=/home/runner/.rubies/jruby-9.3.1.0/bin/jruby
  RuntimeError: The compiler failed to generate an executable file.
  You have to install development tools first.
  
          try_do at /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:456
       try_link0 at /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:541
        try_link at /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:556
        try_func at /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:765
  have_func at
  /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:1051
    checking_for at /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:942
        postpone at /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:350
            open at /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:320
        postpone at /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:350
            open at /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:320
        postpone at /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:346
    checking_for at /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:941
  have_func at
  /home/runner/.rubies/jruby-9.3.1.0/lib/ruby/stdlib/mkmf.rb:1050
          <main> at extconf.rb:6
  
  To see why this extension failed to compile, please check the mkmf.log which can
  be found here:
  
  /home/runner/work/fillertext/fillertext/vendor/bundle/jruby/2.6.0/extensions/universal-java-11/2.6.0/racc-1.6.0/mkmf.log
  
  extconf failed, exit code 1
  
  Gem files will remain installed in
  /home/runner/work/fillertext/fillertext/vendor/bundle/jruby/2.6.0/gems/racc-1.6.0
  for inspection.
  Results logged to
  /home/runner/work/fillertext/fillertext/vendor/bundle/jruby/2.6.0/extensions/universal-java-11/2.6.0/racc-1.6.0/gem_make.out
  
  An error occurred while installing racc (1.6.0), and Bundler cannot continue.
  Make sure that `gem install racc -v '1.6.0' --source 'http://rubygems.org/'`
  succeeds before bundling.
  
  In Gemfile:
    juwelier was resolved to 2.4.9, which depends on
      nokogiri was resolved to 1.12.5, which depends on
        racc
  Took  30.37 seconds

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.