Skip to content

Commit

Permalink
Update to a new gem template
Browse files Browse the repository at this point in the history
Replace `rake` with `toys`, add `remark`, etc.
  • Loading branch information
AlexWayfer committed Aug 2, 2020
1 parent 918408b commit 9752e8a
Show file tree
Hide file tree
Showing 13 changed files with 206 additions and 81 deletions.
48 changes: 40 additions & 8 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,48 @@ bundle_cache: &bundle_cache
- gem install bundler
- bundle update

test_task:
remark_task:
container:
image: ruby:2.6
<<: *bundle_cache
environment:
CODECOV_TOKEN: ENCRYPTED[5bfb9cd3d53a72c8423ce1b84b18cf7d30fbdcf3a56a25f9cd79dbdff1c3552542578272db8088ec27d7de7f2c363d72]
test_script: bundle exec rake
image: node
node_modules_cache:
folder: node_modules
fingerprint_script:
- echo $CIRRUS_OS
- node -v
- cat package.json
install_script: npm install
lint_script: npm run remark
only_if: ($CIRRUS_BRANCH == 'master') ||
changesInclude(
'.cirrus.yml', '.gitignore', 'package.json', '.remarkrc.yaml', '**.md'
)

rubocop_task:
container:
image: ruby:2.6
image: ruby:latest
<<: *bundle_cache
rubocop_script: bundle exec rubocop
lint_script: toys rubocop
only_if: ($CIRRUS_BRANCH == 'master') ||
changesInclude(
'.cirrus.yml', '.gitignore', 'Gemfile', 'Rakefile', '.rubocop.yml', '*.gemspec',
'**.rb', '**.ru'
)

rspec_task:
depends_on:
- remark
- rubocop
container:
matrix:
image: ruby:2.5
image: ruby:2.6
image: ruby:2.7
<<: *bundle_cache
environment:
CODECOV_TOKEN: ENCRYPTED[5bfb9cd3d53a72c8423ce1b84b18cf7d30fbdcf3a56a25f9cd79dbdff1c3552542578272db8088ec27d7de7f2c363d72]
test_script: toys rspec
only_if: ($CIRRUS_BRANCH == 'master') ||
changesInclude(
'.cirrus.yml', '.gitignore', 'Gemfile', 'Rakefile', '.rspec', '*.gemspec', 'lib/**',
'spec/**'
)
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ root = true

[*]
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100

[*.y{a,}ml]
indent_style = space
indent_size = 2

[*.md]
indent_style = space
indent_size = 4
15 changes: 8 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Gemfile.lock
.ruby-version
!template/.ruby-version
/Gemfile.lock
/.ruby-version

# Gem files
*.gem
/node_modules/
/package-lock.json
/yarn.lock

# Tests coverage
coverage/
/coverage/

/pkg/
2 changes: 2 additions & 0 deletions .remarkrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
plugins:
- remark-preset-lint-recommended
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--require spec_helper.rb
--warnings
--color
34 changes: 9 additions & 25 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ require:
- rubocop-performance
- rubocop-rspec

Layout/Tab:
Enabled: false
Layout/IndentationStyle:
EnforcedStyle: tabs
IndentationWidth: 2
Layout/IndentationWidth:
Width: 1
Layout/LineLength:
Max: 100
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
Layout/FirstParameterIndentation:
EnforcedStyle: consistent
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Layout/FirstArgumentIndentation:
EnforcedStyle: consistent
Layout/FirstParameterIndentation:
EnforcedStyle: consistent
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/FirstHashElementIndentation:
Expand All @@ -27,31 +29,13 @@ Layout/MultilineArrayBraceLayout:
EnforcedStyle: new_line
Layout/MultilineHashBraceLayout:
EnforcedStyle: new_line
Layout/FirstArrayElementLineBreak:
Enabled: true
Layout/FirstHashElementLineBreak:
Enabled: true
Layout/FirstMethodArgumentLineBreak:
Enabled: true
Layout/FirstMethodParameterLineBreak:
Enabled: true

Style/ParenthesesAroundCondition:
AllowInMultilineConditions: true
Style/HashEachMethods:
Enabled: true
Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true

Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true

AllCops:
TargetRubyVersion: 2.6
NewCops: enable

Metrics/BlockLength:
Exclude:
Expand Down
27 changes: 27 additions & 0 deletions .toys.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

include :bundler, static: true

subtool_apply do
include :exec, exit_on_nonzero_status: true, log_level: Logger::UNKNOWN unless include? :exec
end

require 'gem_toys'
expand GemToys::Template

alias_tool :g, :gem

tool :rspec do
def run
exec 'rspec'
end
end

alias_tool :spec, :rspec
alias_tool :test, :rspec

tool :rubocop do
def run
exec 'rubocop'
end
end
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## master (unreleased)

* Initial release.
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2020 Alexander Popov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Flame CLI

[![Cirrus CI - Base Branch Build Status](https://img.shields.io/cirrus/github/AlexWayfer/flame-cli?style=flat-square)](https://cirrus-ci.com/github/AlexWayfer/flame-cli)
[![Codecov branch](https://img.shields.io/codecov/c/github/AlexWayfer/flame-cli/master.svg?style=flat-square)](https://codecov.io/gh/AlexWayfer/flame-cli)
[![Code Climate](https://img.shields.io/codeclimate/maintainability/AlexWayfer/flame-cli.svg?style=flat-square)](https://codeclimate.com/github/AlexWayfer/flame-cli)
[![Depfu](https://img.shields.io/depfu/AlexWayfer/flame-cli?style=flat-square)](https://depfu.com/repos/github/AlexWayfer/flame-cli)
[![Inline docs](https://inch-ci.org/github/AlexWayfer/flame-cli.svg?branch=master)](https://inch-ci.org/github/AlexWayfer/flame-cli)
[![license](https://img.shields.io/github/license/AlexWayfer/flame-cli.svg?style=flat-square)](https://github.com/AlexWayfer/flame-cli/blob/master/LICENSE.txt)
[![Gem](https://img.shields.io/gem/v/flame-cli.svg?style=flat-square)](https://rubygems.org/gems/flame-cli)

CLI for [Flame web framework](https://github.com/AlexWayfer/flame).

## Installation

Install it globally as:

```shell
gem install flame-cli
```

## Usage

```ruby
flame --help
```

## Development

After checking out the repo, run `bundle install` to install dependencies.

Then, run `toys rspec` to run the tests.

To install this gem onto your local machine, run `toys gem install`.

To release a new version, run `toys gem release %version%`.
See how it works [here](https://github.com/AlexWayfer/gem_toys#release).

## Contributing

Bug reports and pull requests are welcome on [GitHub](https://github.com/AlexWayfer/flame-cli).

## License

The gem is available as open source under the terms of the
[MIT License](https://opensource.org/licenses/MIT).
11 changes: 0 additions & 11 deletions Rakefile

This file was deleted.

63 changes: 33 additions & 30 deletions flame-cli.gemspec
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
# frozen_string_literal: true

Gem::Specification.new do |s|
s.name = 'flame-cli'
s.version = '0.0.0'
Gem::Specification.new do |spec|
spec.name = 'flame-cli'
spec.version = '0.0.0'

s.summary = 'CLI for Flame Web-framework'
s.description = 'Generate new application and maybe something else.'
spec.summary = 'CLI for Flame web framework'
spec.description = 'Generate new application and maybe something else.'

s.authors = ['Alexander Popov']
s.email = ['alex.wayfer@gmail.com']
s.homepage = 'https://github.com/AlexWayfer/flame-cli'
s.license = 'MIT'
spec.authors = ['Alexander Popov']
spec.email = ['alex.wayfer@gmail.com']
spec.homepage = 'https://github.com/AlexWayfer/flame-cli'
spec.license = 'MIT'

s.metadata = {
spec.metadata = {
'bug_tracker_uri' => 'https://github.com/AlexWayfer/flame-cli/issues',
'documentation_uri' =>
"http://www.rubydoc.info/gems/flame-cli/#{s.version}",
"http://www.rubydoc.info/gems/flame-cli/#{spec.version}",
'homepage_uri' => 'https://github.com/AlexWayfer/flame-cli',
'source_code_uri' => 'https://github.com/AlexWayfer/flame-cli',
'wiki_uri' => 'https://github.com/AlexWayfer/flame-cli/wiki'
}

s.required_ruby_version = '>= 2.6'

s.add_runtime_dependency 'clamp', '~> 1.3'
s.add_runtime_dependency 'gorilla_patch', '~> 3.0'

s.add_development_dependency 'bundler', '~> 2.1'
s.add_development_dependency 'codecov', '~> 0.1'
s.add_development_dependency 'pry', '~> 0.12'
s.add_development_dependency 'pry-byebug', '~> 3.5'
s.add_development_dependency 'rake', '~> 13.0'
s.add_development_dependency 'rspec', '~> 3.7'
s.add_development_dependency 'rubocop', '~> 0.81.0'
s.add_development_dependency 'rubocop-performance', '~> 1.5'
s.add_development_dependency 'rubocop-rspec', '~> 1.38'
s.add_development_dependency 'simplecov', '~> 0.16'

s.files = Dir.glob('{lib,template}/**/*', File::FNM_DOTMATCH)
s.bindir = 'exe'
s.executables = ['flame']
spec.required_ruby_version = '>= 2.6'

spec.add_runtime_dependency 'clamp', '~> 1.3'
spec.add_runtime_dependency 'gorilla_patch', '~> 4.0'

spec.add_development_dependency 'pry-byebug', '~> 3.9'

spec.add_development_dependency 'bundler', '~> 2.0'
spec.add_development_dependency 'gem_toys', '~> 0.3.0'
spec.add_development_dependency 'toys', '~> 0.10.4'

spec.add_development_dependency 'codecov', '~> 0.2.0'
spec.add_development_dependency 'rspec', '~> 3.9'
spec.add_development_dependency 'simplecov', '~> 0.18.0'

spec.add_development_dependency 'rubocop', '~> 0.88.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.0'
spec.add_development_dependency 'rubocop-rspec', '~> 1.0'

spec.files = Dir.glob('{lib,template}/**/*', File::FNM_DOTMATCH)
spec.bindir = 'exe'
spec.executables = ['flame']
end
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"scripts": {
"remark": "remark ."
},
"devDependencies": {
"remark-cli": "^8.0.0",
"remark-preset-lint-recommended": "^4.0.0"
}
}

0 comments on commit 9752e8a

Please sign in to comment.