Skip to content

Commit

Permalink
update project structure, add coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzo4711 committed Nov 16, 2022
1 parent 4ade0e9 commit 5e304b2
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 26 deletions.
27 changes: 15 additions & 12 deletions .gitignore
@@ -1,22 +1,25 @@
# defaults
/.bundle/
/tmp/
Gemfile.lock

# testing
.rspec_status
/spec/reports/

# documentation & coverage
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
/docs/yard
/.coveralls.yml

# rspec failure tracking
.rspec_status
# builds
/pkg/
/*.gem

# IDE related files
/.idea
/.ruby-version
/.bundle-version

# Github testing
Gemfile.lock

# builds
/*.gem
/.bundle-version
5 changes: 5 additions & 0 deletions .yardopts
@@ -0,0 +1,5 @@
./lib/**/*.rb
--embed-mixins
--markup=markdown
-
./docs/*.*
1 change: 1 addition & 0 deletions README.md
@@ -1,6 +1,7 @@
# RubySmart::Support

[![Gem Version](https://badge.fury.io/rb/ruby_smart-support.svg)](https://badge.fury.io/rb/ruby_smart-support)
[![Coverage Status](https://coveralls.io/repos/github/ruby-smart/support/badge.svg?branch=main)](https://coveralls.io/github/ruby-smart/support?branch=main)
[![Test](https://github.com/ruby-smart/support/actions/workflows/ruby.yml/badge.svg)](https://github.com/ruby-smart/support/actions/workflows/ruby.yml)
[![RubySmart::Support Build Status](https://shields.io/github/workflow/status/ruby-smart/support/Test)](https://github.com/ruby-smart/support/actions)

Expand Down
21 changes: 16 additions & 5 deletions Rakefile
Expand Up @@ -5,12 +5,23 @@ require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task default: :spec

# ----- Documentation tasks ---------------------------------------------------

require 'yard'
YARD::Rake::YardocTask.new(:doc) do |t|
t.options = %w| --embed-mixins --markup=markdown|
t.files = ['lib/**/*.rb','-','docs/*.*']
end
end

desc 'Release new version'
task :release do
version = RubySmart::Support::VERSION
puts "Releasing #{version}, y/n?"
exit(1) unless $stdin.gets.chomp == 'y'
sh "git commit -am 'tagged #{version}' && " \
"git tag #{version} && " \
"gem build -o pkg/release-#{version}.gem && " \
"gem push pkg/release-#{version}.gem && " \
'git push && ' \
'git push --tags'
end

task default: :spec
16 changes: 10 additions & 6 deletions lib/ruby_smart/support/gem_info.rb
Expand Up @@ -15,8 +15,10 @@ module GemInfo

# returns a hash of all installed gems with it's versions
#
# @example
#
# GemInfo.installed
# > {'bundler' => ['2.2.30', '1.2.3']}
# # > {'bundler' => ['2.2.30', '1.2.3']}
#
# @return [Hash{<name> => Array[<version>]}] gem name-versions hash
def self.installed
Expand All @@ -27,10 +29,10 @@ def self.installed
# the optional version requirement matches against any available version
#
# GemInfo.installed?('bundler')
# > true
# # > true
#
# GemInfo.installed?('bundler', '~> 3.0')
# > false
# # > false
#
# @param [String] name - the gem name
# @param [nil, String] version - optional version requirement
Expand All @@ -41,8 +43,10 @@ def self.installed?(name, version = nil)

# returns a hash of all loaded gems with its current version
#
# @example
#
# GemInfo.loaded
# > {'bundler' => '2.2.30'}
# # > {'bundler' => '2.2.30'}
#
# @return [Hash{<name> => <version>}] gem name-version hash
def self.loaded
Expand All @@ -53,10 +57,10 @@ def self.loaded
# the optional version requirement matches against the loaded version
#
# GemInfo.loaded?('bundler')
# > true
# # > true
#
# GemInfo.loaded?('bundler', '~> 3.0')
# > false
# # > false
#
# @param [String] name - the gem name
# @param [nil, String] version - optional version requirement
Expand Down
2 changes: 1 addition & 1 deletion ruby_smart-support.gemspec
Expand Up @@ -32,8 +32,8 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']

spec.add_development_dependency 'activesupport', '>= 4.0'
spec.add_development_dependency 'coveralls_reborn', '~> 0.25'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'simplecov', '~> 0.21'
spec.add_development_dependency 'yard', '~> 0.9'
end
6 changes: 4 additions & 2 deletions spec/support/simplecov.rb → spec/support/coveralls.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require 'simplecov'

SimpleCov.start do
require 'coveralls'
Coveralls.wear! do
# exclude specs
add_filter %r{^/spec/}
# exclude gem related files
Expand All @@ -27,4 +27,6 @@
add_group "Modules" do |file|
file.filename.match(/\/(?:gem_info|thread_info)\.rb/)
end

self.formatter = SimpleCov::Formatter::HTMLFormatter unless ENV.fetch('CI', nil)
end

0 comments on commit 5e304b2

Please sign in to comment.