Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rakefile Best Practices (& RuboCop) #72

Merged
merged 10 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .autotest

This file was deleted.

5 changes: 0 additions & 5 deletions .document

This file was deleted.

4 changes: 4 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--format documentation
--require spec_helper
--color
--order random
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
inherit_from: .rubocop_todo.yml

inherit_gem:
rubocop-lts: rubocop-lts1_8.yml
54 changes: 54 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-12-11 23:40:03 +0700 using RuboCop version 0.41.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
Lint/ParenthesesAsGroupedExpression:
Exclude:
- 'spec/os_spec.rb'

# Offense count: 2
Metrics/AbcSize:
Max: 31

# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 234

# Offense count: 2
Metrics/CyclomaticComplexity:
Max: 9

# Offense count: 22
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
# URISchemes: http, https
Metrics/LineLength:
Max: 144

# Offense count: 6
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 26

# Offense count: 3
Metrics/PerceivedComplexity:
Max: 10

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
Style/HashSyntax:
Exclude:
- 'Rakefile'

# Offense count: 2
Style/IfInsideElse:
Exclude:
- 'lib/os.rb'
- 'spec/os_spec.rb'
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source "http://rubygems.org"
# encoding: utf-8
source 'http://rubygems.org'

gemspec
90 changes: 79 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,93 @@
PATH
remote: .
specs:
os (1.0.1)
os (1.1.4)

GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.3)
power_assert (1.0.2)
rake (0.9.6)
test-unit (3.2.3)
ast (2.4.2)
coderay (1.1.3)
diff-lcs (1.5.0)
ffi (1.15.5)
formatador (1.1.0)
guard (2.18.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.13.0)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
lumberjack (1.2.8)
method_source (1.0.0)
nenv (0.3.0)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
parser (2.4.0.2)
ast (~> 2.3)
power_assert (2.0.2)
powerpack (0.1.3)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
rainbow (2.2.2)
rake
rake (10.5.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.0)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (0.41.2)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-lts (2.0.5)
rubocop-ruby1_9 (~> 1.0.5)
rubocop-ruby1_9 (1.0.5)
parser (= 2.4.0.2)
rubocop (= 0.41.2)
ruby-progressbar (1.11.0)
shellany (0.0.1)
test-unit (3.5.5)
power_assert
thor (1.2.1)
unicode-display_width (1.8.0)

PLATFORMS
ruby
x86-mingw32
x86_64-darwin-19

DEPENDENCIES
rake (~> 0.8)
rspec (~> 2.5.0)
test-unit (~> 3)
guard-rspec (~> 4.7)
os!
rake (~> 10.5)
rspec (~> 3.12)
rubocop-lts (~> 2.0)
test-unit (~> 3.5)

BUNDLED WITH
2.1.4
2.3.26
19 changes: 19 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# encoding: utf-8
# More info at https://github.com/guard/guard#readme

guard :rspec, :cmd => 'bundle exec rspec' do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)

# Feel free to open issues for suggestions and improvements

# RSpec files
rspec = dsl.rspec
watch(rspec.spec_helper) { rspec.spec_dir }
watch(rspec.spec_support) { "#{rspec.spec_dir}/config" }
watch(rspec.spec_files)

# Ruby files
ruby = dsl.ruby
dsl.watch_spec_files_for(ruby.lib_files)
end
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
The OS gem allows for some easy telling if you're on windows or not.

## Install

```shell
bundle add os
```

## Usage

```ruby
require 'os'

Expand Down Expand Up @@ -80,7 +88,7 @@ If there are any other features you'd like, let me know, I'll do what I can to a

http://github.com/rdp/os for feedback et al

Related projects:
## Alternatives

rubygems:

Expand All @@ -104,4 +112,15 @@ the ["platform" gem](http://rubydoc.info/github/ffi/ffi/master/FFI/Platform), it
FFI::Platform::OS
```

## Contributing

Develop locally:

```shell
bundle install
bundle exec guard
```

## License

License: MIT (see LICENSE file)
52 changes: 25 additions & 27 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
# encoding: utf-8
# frozen_string_literal: true

# HOW TO DEPLOY
# bump VERSION file manually
# rake release
# Don't forget to run rake gemspec with each release! ... I think...or rake release might be same thing
# then manually edit os.gemspec remove duplicatee rspecs, circular dependency on os? HUH?
# # then gem build os.gemspec
# rake build doesn't work???
# sooo...
# ...gem push os-1.1.2.gem
# !/usr/bin/env rake

require 'bundler/gem_tasks'

begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "os"
gem.summary = %Q{Simple and easy way to know if you're on windows or not (reliably), as well as how many bits the OS is, etc.}
gem.description = %Q{The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"}
gem.email = "rogerpack2005@gmail.com"
gem.homepage = "https://github.com/rdp/os"
gem.authors = ["rdp", "David McCullars"]
gem.license = "MIT"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
# gem.add_development_dependency "fast_require"
# gem.add_development_dependency "rspec", ">= 2.0"
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
desc 'spec task stub'
task :spec do
warn 'rspec is disabled'
end
rescue LoadError => e
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler #{e}"
end
desc 'alias test task to spec'
task :test => :spec

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
begin
require 'rubocop/rake_task'
RuboCop::RakeTask.new do |task|
task.options = ['-D'] # Display the name of the failing cops
end
rescue LoadError
desc 'rubocop task stub'
task :rubocop do
warn 'RuboCop is disabled'
end
end

task default: %i[test rubocop]
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

1 change: 0 additions & 1 deletion autotest/discover.rb

This file was deleted.

Loading