Skip to content

Commit

Permalink
Update settings and documentation for various environment variables a…
Browse files Browse the repository at this point in the history
…vailable.
  • Loading branch information
gavinlaking committed Oct 10, 2015
1 parent dc17160 commit ff2f766
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 41 deletions.
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ docs/events/menu.md
docs/events/movement.md
docs/events/refresh.md
docs/events/system.md
docs/events/view.md
docs/events/visibility.md
3 changes: 1 addition & 2 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ guard :rubocop do
end

guard :minitest, all_after_pass: true,
focus_on_failed: true,
env: { 'NO_SIMPLECOV' => true } do
focus_on_failed: true do
watch(%r{^test/(.*)_test\.rb})
watch(%r{^lib/(.+)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" }
watch(%r{^test/test_helper\.rb}) { 'test' }
Expand Down
54 changes: 50 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,63 @@ Pull requests are very welcome! Please try to follow these simple rules if
* Make sure your patches are well tested.
* Update the [Yard](http://yardoc.org/) documentation.
(Use `yard stats --list-undoc` to locate undocumented code)
* Update the [README](https://github.com/gavinlaking/vedeu/blob/master/README.md).
* Update the
[README](https://github.com/gavinlaking/vedeu/blob/master/README.md),
if appropriate.
* Please **do not change** the version number.

Raising issues and finding bugs, updating documentation and improving
the code are all welcome contributions. I may also have left some TODO
items lying around, which you're quite welcome to and can find
with either Yard, or git:

yard list --query '@todo'

git grep --line-number '@todo'


Any branch on the repository that is not `master` is probably experimental; do
not rely on anything in these branches. Typically, `twerks` will be merged
into `master` before a release, and branches prefixed with `spike/` are me
playing with ideas.
playing with ideas- they aren't guaranteed to work at all.

I may have left some TODO items lying around, which you can find with:
Various environment variables are available to you to help with testing, all of
which can be used in combination, prefaced to `rake`:

- Produce statistics on the slowest performing parts of the
application/tests. Useful when used multiple times. See
`test/test_helper.rb` for configuration.

PERFORMANCE=1 rake

- Produce a 'SimpleCov' test coverage report in the `coverage/`
directory.

SIMPLECOV=1 rake

- Produces a 'SimpleCov' test coverage report with output to the
console.

CONSOLE_COVERAGE=1 rake

- Enable Ruby's warnings mode (this can usually be quote verbose, but
thankfully more so with gem dependencies rather than Vedeu itself).

WARNINGS=1 rake

- Disable Ruby's garbage collection for this test run.

DISABLE_GC=1 rake

- Use Rubocop to catch coding misdemeanours for this test run. (Or
use `rake rubocop`).

RUBOCOP=1 rake

- Build the Yard documentation for the project. (Or use `rake yard`).

YARD=1 rake

yard list --query '@todo'

### General contribution help

Expand Down
20 changes: 16 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,27 @@ Rake::TestTask.new(:test) do |task|
task.libs.push 'test'
task.pattern = 'test/**/*_test.rb'
task.verbose = false
task.warning = false # set to true for Ruby warnings (ruby -w)
task.warning = true if ENV['WARNINGS']
end

YARD::Rake::YardocTask.new(:yard) do |task|
task.files = [
'lib/**/*.rb',
'-',
'docs/api.md',
'docs/border.md',
'docs/buffer.md',
'docs/configuration.md',
'docs/cursor.md',
'docs/dsl.md',
'docs/events.md',
'docs/geometry.md',
'docs/getting_started.md',
'docs/group.md',
'docs/interfaces.md',
'docs/keymaps.md',
'docs/object_graph.md',
'docs/view.md',
'docs/events/application.md',
'docs/events/document.md',
'docs/events/drb.md',
Expand All @@ -32,14 +40,18 @@ YARD::Rake::YardocTask.new(:yard) do |task|
'docs/events/view.md',
'docs/events/visibility.md',
]
task.options = ['--highlight']
task.options = ['highlight']
task.stats_options = ['--list-undoc']
end

RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ['lib/**/*.rb']
task.formatters = ['progress']
task.formatters = ['simple']
task.fail_on_error = false
end

task default: :test
tasks_to_run = [:test]
tasks_to_run << :rubocop if ENV['RUBOCOP']
tasks_to_run << :yard if ENV['YARD']

task default: tasks_to_run
9 changes: 0 additions & 9 deletions test/support/all_seeds.sh

This file was deleted.

44 changes: 22 additions & 22 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
unless ENV['NO_SIMPLECOV']
if ENV['SIMPLECOV'] || ENV['CONSOLE_COVERAGE']
require 'simplecov'
require 'simplecov-console' if ENV['CONSOLE_COVERAGE']
end

require 'pry'
require 'minitest/autorun'
require 'minitest/pride' unless ENV['NO_COLOR']
require 'minitest/hell'

# GC.disable # Uncomment to remove ~20ms from test run speed; left uncommented
# though makes tests slower over time with 'guard'.

unless ENV['NO_SIMPLECOV']
SimpleCov.start do
formatter SimpleCov::Formatter::Console if ENV['CONSOLE_COVERAGE']
command_name 'MiniTest::Spec'
Expand Down Expand Up @@ -45,6 +35,16 @@
end
end

require 'pry'
require 'minitest/autorun'
require 'minitest/pride'
require 'minitest/hell'

# Appears to remove ~20ms from test run speed.
if ENV['DISABLE_GC']
GC.disable
end

module VedeuMiniTestPlugin
# def before_setup
# # Vedeu::Repositories.reset!
Expand Down Expand Up @@ -90,17 +90,17 @@ class << self
require 'vedeu'
require 'support/helpers/model_test_class'

require 'minitest/reporters'
require 'minitest/reporters/mean_time_reporter'
Minitest::Reporters.use!(
# # commented out by default (makes tests slower)
Minitest::Reporters::MeanTimeReporter.new({
previous_runs_filename: "/tmp/durations",
report_filename: "/tmp/durations_results"})
# Minitest::Reporters::DefaultReporter.new({ color: true,
# slow_suite_count: 15 }),
# Minitest::Reporters::SpecReporter.new
)
if ENV['PERFORMANCE']
require 'minitest/reporters'
require 'minitest/reporters/mean_time_reporter'

Minitest::Reporters.use!(
Minitest::Reporters::MeanTimeReporter.new({
previous_runs_filename: "/tmp/durations",
report_filename: "/tmp/durations_results"
})
)
end

def test_configuration
Vedeu::Configuration.reset!
Expand Down

0 comments on commit ff2f766

Please sign in to comment.