rootstrap / rsgem Goto Github PK
View Code? Open in Web Editor NEWRootstrap way ® to generate gems
Home Page: https://rootstrap.com
License: MIT License
Rootstrap way ® to generate gems
Home Page: https://rootstrap.com
License: MIT License
Gemspec authors config will be empty if the user has not set their git config user.name
(or email) , hence making executables (like rubocop) to fail at runtime
Raise a warning when the user does not have a git user name, and update the gemspec with a temporary author name, so that the tasks can continue to work properly
We want to provide CI configuration out of the box
Update the CI configuration file to provide the basic structure needed.
Make sure to leave a comment in the file to update with the correct Code Climate ID
We want to follow our tech guides about developing gems https://github.com/rootstrap/tech-guides/blob/master/open-source/developing_gems.md#gemfilegemfilelockgemspec
Add the Gemfile.lock to the gitignore
Is your feature request related to a problem? Please describe.
.DS_Store
files are not ignored by git
Describe the solution you'd like
Add the line
.DS_Store
to the .gitignore
file in the project generated by rsgem
All CLI gems have a proper CLI output to allow users know what's going on while executing a command.
Update the output of the new
command to better display information of what's going on.
Nice to have, some colors.
Maybe is a good idea to add this files too:
Contributing like this https://github.com/rootstrap/exception_hunter/blob/bdf8cf396192dde7489beab4d316ebd2bfb3cb3e/CONTRIBUTING.md
Code of conduct> https://github.com/rootstrap/active_admin_chat/blob/master/CODE_OF_CONDUCT.md
We want to leverage from Github Actions configurations and cache all dependencies.
Update both this project GH Actions config and the one delivered in the support folder so that Github Actions can cache the dependencies when running the tests.
Add the following configurations to the default rubocop file:
When using flag --ci=github_actions
, the generated file .github/workflows/ci.yml
uses bundler:1.17.3.
In Bundler 2, they removed support for Ruby < 2.3. And ruby-versions
matrix for Github Actions starts from Ruby 2.5, so maybe this could be a nice update for new gems generated.
We want to provide a clean output to the final user but allow him to see the steps if he desires so
Create a configuration attribute in the context object. That attribute should be used to check whether to print something into the standard output or not
We want to build top quality projects with static code analysis tools in place by default
Add the rake task to run both Reek and Rubocop
We want to have a real and rememberable name for the gem. It's usage would be:
$ rsgem new NAME
Update the gem's name to be RSGem
We want to generate the gem with the default configuration for code coverage in the spec helper file.
Add the code coverage call in the main spec helper file, so that running the tests also generate the coverage.
We want to have Rootstrap legal name by default in license files, as we do in every other OSS project.
Update the license file to have Rootstrap name in the copyright section.
The MIT License (MIT)
Copyright (c) 2020 Rootstrap
Permission is hereby granted, ...
We want users to be able to call this gem's functionality via a command line interface app
Create the CLI app to use this gem.
The gem Thor looks promising
We want to let the user know that bundler was not found in the system when trying to create the gem.
Add the exception: true
option to the Kernel#system
call and rescue the error to display a message to the end user.
We don't want final users to have all the files from the project
Update the gemspec file to have a minimal config like:
s.files = Dir["{app,config,lib}/**/*", "CHANGELOG.md", "MIT-LICENSE", "README.md"]
s.require_paths = ["lib"]
Given we want to ease the start of the development of a gem, we also want to provide the more appropriate defaults for gems that target Rails applications.
Investigate the basic structure of a gem targeting a Rails application.
Add the option to the CLI and the tasks needed to fulfil this.
You can also include a link in the readme if there's a good guide to develop gems for Rails apps.
We don't want the project to have both CI configuration files.
Remove the travis.yml file when using Github Actions
Add support for Ruby 3.0
Let's start by including it in our test matrix
We want to follow the tech guides regarding gem development
Remove the gems specified in the Gemfile after the project is created
We want to allow new gems to use Factory Bot when requested
Add the FactoryBot
dependency to the Rootstrap::Gem#create
method. Make sure it's only added when specified by the user
We want to allow users to pass bundle gem
options https://bundler.io/v2.0/man/bundle-gem.1.html#OPTIONS when running the generator
Pass the options provided to the bundle gem
command
foo
gem folder is created correctly
Process is frozen without any output
We want to provide the final user a clean project
Run code analysis task and make sure it passes right after the project has been created. If it does not, try to automatically fix the issues.
gem install bundler
gem install rsgem
rsgem new some_name
Works correctly
Traceback (most recent call last):
9: from /usr/local/bin/rsgem:23:in `<main>'
8: from /usr/local/bin/rsgem:23:in `load'
7: from /var/lib/gems/2.7.0/gems/rsgem-0.1.2/exe/rsgem:7:in `<top (required)>'
6: from /var/lib/gems/2.7.0/gems/dry-cli-0.6.0/lib/dry/cli.rb:67:in `call'
5: from /var/lib/gems/2.7.0/gems/dry-cli-0.6.0/lib/dry/cli.rb:114:in `perform_registry'
4: from /var/lib/gems/2.7.0/gems/rsgem-0.1.2/lib/rsgem/cli/commands/new.rb:29:in `call'
3: from /var/lib/gems/2.7.0/gems/rsgem-0.1.2/lib/rsgem/gem.rb:12:in `create'
2: from /var/lib/gems/2.7.0/gems/rsgem-0.1.2/lib/rsgem/gem.rb:59:in `create_gem'
1: from /var/lib/gems/2.7.0/gems/rsgem-0.1.2/lib/rsgem/tasks/create_gem.rb:13:in `create'
/var/lib/gems/2.7.0/gems/rsgem-0.1.2/lib/rsgem/tasks/create_gem.rb:13:in ``': No such file or directory - bundle (Errno::ENOENT)
We want to allow users select their preferred CI provider
Add an argument to the CLI new command to receive the CI provider option
Add the latest version available to the dependencies in the gemspec
Verify the reporter works in Github Actions
gem install rsgem
rsgem new testing
testing
gem is created successfully
An error appears:
Could not find gem 'reek' in any of the gem sources listed in your Gemfile. (Bundler::GemNotFound)
Install local dependencies before running rubocop in the new project
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.