├── .rspec ├── lib ├── react-rails-benchmark_renderer.rb └── react │ ├── rails │ ├── benchmark_renderer │ │ └── version.rb │ └── benchmark_renderer.rb │ └── server_rendering │ ├── benchmark_renderer.rb │ └── concerns │ └── instrumentation.rb ├── .travis.yml ├── spec ├── spec_helper.rb └── react │ └── rails │ └── benchmark_renderer_spec.rb ├── bin ├── setup └── console ├── Gemfile ├── .gitignore ├── LICENSE.txt ├── react-rails-benchmark_renderer.gemspec ├── CODE_OF_CONDUCT.md ├── README.md └── Rakefile /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | --format documentation 4 | -------------------------------------------------------------------------------- /lib/react-rails-benchmark_renderer.rb: -------------------------------------------------------------------------------- 1 | require "react/rails/benchmark_renderer" 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 2.1.2 4 | before_install: gem install bundler -v 1.10.4 5 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) 2 | require 'react/rails/benchmark_renderer' 3 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | bundle install 6 | 7 | # Do any other automated setup that you need to do here 8 | -------------------------------------------------------------------------------- /lib/react/rails/benchmark_renderer/version.rb: -------------------------------------------------------------------------------- 1 | module React 2 | module Rails 3 | module BenchmarkRenderer 4 | VERSION = "0.1.0" 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in react-rails-benchmark_renderer.gemspec 4 | gemspec 5 | 6 | gem "react-rails", github: "reactjs/react-rails" 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | *.bundle 11 | *.so 12 | *.o 13 | *.a 14 | mkmf.log 15 | -------------------------------------------------------------------------------- /spec/react/rails/benchmark_renderer_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe React::Rails::BenchmarkRenderer do 4 | it 'has a version number' do 5 | expect(React::Rails::BenchmarkRenderer::VERSION).not_to be nil 6 | end 7 | 8 | end 9 | -------------------------------------------------------------------------------- /lib/react/rails/benchmark_renderer.rb: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | require "active_support" 3 | require "react-rails" 4 | 5 | # This library 6 | require "react/rails/benchmark_renderer/version" 7 | require "react/server_rendering/concerns/instrumentation" 8 | require "react/server_rendering/benchmark_renderer" 9 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "bundler/setup" 4 | require "react/rails/benchmark_renderer" 5 | 6 | # You can add fixtures and/or initialization code here to make experimenting 7 | # with your gem easier. You can also use a different console, if you like. 8 | 9 | # (If you use this, don't forget to add pry to your Gemfile!) 10 | # require "pry" 11 | # Pry.start 12 | 13 | require "irb" 14 | IRB.start 15 | -------------------------------------------------------------------------------- /lib/react/server_rendering/benchmark_renderer.rb: -------------------------------------------------------------------------------- 1 | require "react/server_rendering/concerns/instrumentation" 2 | 3 | # Extends SprocketsRenderer for benchmarking in the Rails environment 4 | # - benchmarks rendering in the same manner as Rails view rendering is benchmarked by Rails 5 | module React 6 | module ServerRendering 7 | class BenchmarkRenderer < SprocketsRenderer 8 | include Concerns::Instrumentation 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Trumaker, Inc & Peter Boling 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /react-rails-benchmark_renderer.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'react/rails/benchmark_renderer/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "react-rails-benchmark_renderer" 8 | spec.version = React::Rails::BenchmarkRenderer::VERSION 9 | spec.authors = ["Peter Boling"] 10 | spec.email = ["peter.boling@gmail.com"] 11 | 12 | spec.summary = %q{Concern::Instrumentation Plugin for React::Rails Render Benchmarking with a reference implementation} 13 | spec.description = %q{Concern::Instrumentation Plugin for React::Rails Render Benchmarking with a reference implementation} 14 | spec.homepage = "https://github.com/pboling/react-rails-benchmark_renderer" 15 | 16 | spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 17 | spec.bindir = "exe" 18 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } 19 | spec.require_paths = ["lib"] 20 | 21 | spec.add_dependency "tilt" 22 | spec.add_dependency "activesupport", ">= 3.2" 23 | spec.add_dependency "react-rails", ">= 1.0" 24 | spec.add_development_dependency "bundler", "~> 1.10" 25 | spec.add_development_dependency "rake", "~> 13.0" 26 | spec.add_development_dependency "rspec" 27 | end 28 | -------------------------------------------------------------------------------- /lib/react/server_rendering/concerns/instrumentation.rb: -------------------------------------------------------------------------------- 1 | module React 2 | module ServerRendering 3 | module Concerns 4 | module Instrumentation 5 | extend ActiveSupport::Concern 6 | 7 | included do 8 | attr_reader :view_runtime 9 | prepend RenderWithBenchmark 10 | end 11 | 12 | module RenderWithBenchmark 13 | # Ripped mostly from actionpack/lib/action_controller/metal/instrumentation.rb 14 | def render(*args) 15 | render_output = nil 16 | self.view_runtime = cleanup_view_runtime do 17 | Benchmark.ms { render_output = super } 18 | end 19 | ::Rails.logger.info("#{self.class}#render(#{args.join(", ")} in %.1fms" % view_runtime.to_f) 20 | render_output 21 | end 22 | 23 | # Ripped directly from actionpack/lib/action_controller/metal/instrumentation.rb 24 | # A hook which allows you to clean up any time taken into account in 25 | # views wrongly, like database querying time. 26 | # 27 | # def cleanup_view_runtime 28 | # super - time_taken_in_something_expensive 29 | # end 30 | # 31 | # :api: plugin 32 | def cleanup_view_runtime #:nodoc: 33 | yield 34 | end 35 | end 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 4 | 5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion. 6 | 7 | Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. 8 | 9 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. 10 | 11 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. 12 | 13 | This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/) 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React::Rails::BenchmarkRenderer 2 | 3 | This gem is a plugin to react-rails providing two things: 4 | 5 | 1. `React::ServerRendering::Concern::Instrumentation` 6 | - benchmarking instrumentation of the sort found in rails view rendering 7 | - can be included into any Renderer to add Benchmarking to it 8 | 2. `React::ServerRendering::BenchmarkRenderer` 9 | - a reference implementation of `React::ServerRendering::Concern::Instrumentation` 10 | 11 | | Project | React::Rails::BenchmarkRenderer | 12 | |------------------------ | ----------------- | 13 | | gem name | react-rails-benchmark_renderer | 14 | | license | MIT | 15 | | expert support | [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github) | 16 | | download rank | [![Total Downloads](https://img.shields.io/gem/rt/react-rails-benchmark_renderer.svg)](https://rubygems.org/gems/react-rails-benchmark_renderer) | 17 | | version | [![Gem Version](https://badge.fury.io/rb/react-rails-benchmark_renderer.png)](http://badge.fury.io/rb/react-rails-benchmark_renderer) | 18 | | dependencies | [![Dependency Status](https://gemnasium.com/pboling/react-rails-benchmark_renderer.png)](https://gemnasium.com/pboling/react-rails-benchmark_renderer) | 19 | | code quality | [![Code Climate](https://codeclimate.com/github/pboling/react-rails-benchmark_renderer.png)](https://codeclimate.com/github/pboling/react-rails-benchmark_renderer) | 20 | | inline documenation | [![Inline docs](http://inch-ci.org/github/pboling/react-rails-benchmark_renderer.png)](http://inch-ci.org/github/pboling/react-rails-benchmark_renderer) | 21 | | continuous integration | [![Build Status](https://secure.travis-ci.org/pboling/react-rails-benchmark_renderer.png?branch=master)](https://travis-ci.org/pboling/react-rails-benchmark_renderer) | 22 | | test coverage | [![Coverage Status](https://coveralls.io/repos/pboling/react-rails-benchmark_renderer/badge.png)](https://coveralls.io/r/pboling/react-rails-benchmark_renderer) | 23 | | homepage | [on Github.com][homepage] | 24 | | documentation | [on Rdoc.info][documentation] | 25 | | live chat | [![Join the chat at https://gitter.im/pboling/react-rails-benchmark_renderer](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pboling/react-rails-benchmark_renderer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | 26 | | Spread ~♡ⓛⓞⓥⓔ♡~ | [🌏](https://about.me/peter.boling), [👼](https://angel.co/peter-boling), [:shipit:](http://coderwall.com/pboling), [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](http://twitter.com/galtzo), [🌹](https://nationalprogressiveparty.org) | 27 | 28 | [semver]: http://semver.org/ 29 | [pvc]: http://docs.rubygems.org/read/chapter/16#page74 30 | [railsbling]: http://www.railsbling.com 31 | [peterboling]: http://www.peterboling.com 32 | [coderbits]: https://coderbits.com/pboling 33 | [coderwall]: http://coderwall.com/pboling 34 | [documentation]: http://rdoc.info/github/pboling/react-rails-benchmark_renderer/frames 35 | [homepage]: https://github.com/pboling/react-rails-benchmark_renderer 36 | 37 | 38 | This idea started with [a PR I sent](https://github.com/reactjs/react-rails/pull/101/files) to [actual react-rails](https://github.com/reactjs/react-rails) before it hit 1.0 release. I didn't have time to finish it then, and the structure of the react-rails codebase has changed considerably in latest master, so it is now 39 | quite easy to write a renderer as a plugin. Rewriting it as a modular plugin also allowed me to 40 | * Not be beholden to the Apache 2 license on react-rails 41 | * Not be beholden to the Facebook CLA 42 | * Own the code myself! 43 | * Kudos to Facebook for making react-rails more modular so I could easily write this plugin! 44 | 45 | ## Installation 46 | 47 | Add this line to your application's Gemfile: 48 | 49 | ```ruby 50 | gem 'react-rails-benchmark_renderer' 51 | ``` 52 | 53 | And then execute: 54 | 55 | $ bundle 56 | 57 | Or install it yourself as: 58 | 59 | $ gem install react-rails-benchmark_renderer 60 | 61 | ## Usage 62 | 63 | To simply use the reference implementation, just edit your application.rb with: 64 | 65 | ``` 66 | config.react.server_renderer = React::ServerRendering::BenchmarkRenderer 67 | ``` 68 | 69 | To roll your own renderer: 70 | 71 | Use `Concern::Implementation` to enhance any React ServerRendering Renderer with benchmarking. 72 | 73 | Usage is just like you can see in the reference implementation: 74 | 75 | ```ruby 76 | require "react/server_rendering/concerns/instrumentation" 77 | # Extends SprocketsRenderer for benchmarking in the Rails environment 78 | # - benchmarks rendering in the same manner as Rails view rendering is benchmarked by Rails 79 | module React 80 | module ServerRendering 81 | class BenchmarkRenderer < SprocketsRenderer 82 | include Concerns::Instrumentation 83 | end 84 | end 85 | end 86 | ``` 87 | 88 | ## Development 89 | 90 | After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment. 91 | 92 | To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). 93 | 94 | ## Maintenance 95 | 96 | To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). 97 | 98 | ## Versioning 99 | 100 | This library aims to adhere to [Semantic Versioning 2.0.0](http://semver.org/). 101 | Violations of this scheme should be reported as bugs. Specifically, 102 | if a minor or patch version is released that breaks backward 103 | compatibility, a new version should be immediately released that 104 | restores compatibility. Breaking changes to the public API will 105 | only be introduced with new major versions. 106 | 107 | As a result of this policy, you can (and should) specify a 108 | dependency on this gem using the [Pessimistic Version Constraint](http://docs.rubygems.org/read/chapter/16#page74) with two digits of precision. 109 | 110 | For example: 111 | 112 | spec.add_dependency 'react-rails-benchmark_renderer', '~> 0.0' 113 | 114 | ## Contributing 115 | 116 | 1. Fork it ( https://github.com/[my-github-username]/react-rails-benchmark_renderer/fork ) 117 | 2. Create your feature branch (`git checkout -b my-new-feature`) 118 | 3. Commit your changes (`git commit -am 'Add some feature'`) 119 | 4. Push to the branch (`git push origin my-new-feature`) 120 | 5. Make sure to add tests! 121 | 6. Create a new Pull Request 122 | 123 | ## Contributors 124 | 125 | See the [Network View](https://github.com/pboling/react-rails-benchmark_renderer/network) 126 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Galtzo FLOSS Rakefile v1.0.2 - 2025-08-12 4 | # 5 | # MIT License (see License.txt) 6 | # 7 | # Copyright (c) 2025 Peter H. Boling (galtzo.com) 8 | # 9 | # Expected to work in any project that uses Bundler. 10 | # 11 | # Sets up tasks for rspec, minitest, rubocop, reek, yard, and stone_checksums. 12 | # 13 | # rake build # Build my_gem-1.0.0.gem into the pkg directory 14 | # rake build:checksum # Generate SHA512 checksum of my_gem-1.0.0.gem into the checksums directory 15 | # rake build:generate_checksums # Generate both SHA256 & SHA512 checksums into the checksums directory, and git commit them 16 | # rake bundle:audit:check # Checks the Gemfile.lock for insecure dependencies 17 | # rake bundle:audit:update # Updates the bundler-audit vulnerability database 18 | # rake clean # Remove any temporary products 19 | # rake clobber # Remove any generated files 20 | # rake coverage # Run specs w/ coverage and open results in browser 21 | # rake install # Build and install my_gem-1.0.0.gem into system gems 22 | # rake install:local # Build and install my_gem-1.0.0.gem into system gems without network access 23 | # rake reek # Check for code smells 24 | # rake reek:update # Run reek and store the output into the REEK file 25 | # rake release[remote] # Create tag v1.0.0 and build and push my_gem-1.0.0.gem to rubygems.org 26 | # rake rubocop # alias rubocop task to rubocop_gradual 27 | # rake rubocop_gradual # Run RuboCop Gradual 28 | # rake rubocop_gradual:autocorrect # Run RuboCop Gradual with autocorrect (only when it's safe) 29 | # rake rubocop_gradual:autocorrect_all # Run RuboCop Gradual with autocorrect (safe and unsafe) 30 | # rake rubocop_gradual:check # Run RuboCop Gradual to check the lock file 31 | # rake rubocop_gradual:force_update # Run RuboCop Gradual to force update the lock file 32 | # rake spec # Run RSpec code examples 33 | # rake test # Run tests / run spec task with test task 34 | # rake yard # Generate YARD Documentation 35 | 36 | require "bundler/gem_tasks" 37 | 38 | defaults = [] 39 | 40 | is_ci = ENV.fetch("CI", "false").casecmp("true") == 0 41 | 42 | ### DEVELOPMENT TASKS 43 | # Setup Kettle Soup Cover 44 | begin 45 | require "kettle-soup-cover" 46 | 47 | Kettle::Soup::Cover.install_tasks 48 | # NOTE: Coverage on CI is configured independent of this task. 49 | # This task is for local development, as it opens results in browser 50 | defaults << "coverage" unless Kettle::Soup::Cover::IS_CI 51 | rescue LoadError 52 | desc("(stub) coverage is unavailable") 53 | task("coverage") do 54 | warn("NOTE: kettle-soup-cover isn't installed, or is disabled for #{RUBY_VERSION} in the current environment") 55 | end 56 | end 57 | 58 | # Setup Bundle Audit 59 | begin 60 | require "bundler/audit/task" 61 | 62 | Bundler::Audit::Task.new 63 | defaults.push("bundle:audit:update", "bundle:audit") 64 | rescue LoadError 65 | desc("(stub) bundle:audit is unavailable") 66 | task("bundle:audit") do 67 | warn("NOTE: bundler-audit isn't installed, or is disabled for #{RUBY_VERSION} in the current environment") 68 | end 69 | desc("(stub) bundle:audit:update is unavailable") 70 | task("bundle:audit:update") do 71 | warn("NOTE: bundler-audit isn't installed, or is disabled for #{RUBY_VERSION} in the current environment") 72 | end 73 | end 74 | 75 | # Setup RSpec 76 | begin 77 | require "rspec/core/rake_task" 78 | 79 | RSpec::Core::RakeTask.new(:spec) 80 | # This takes the place of `coverage` task when running as CI=true 81 | defaults << "spec" if !defined?(Kettle::Soup::Cover) || Kettle::Soup::Cover::IS_CI 82 | rescue LoadError 83 | desc("spec task stub") 84 | task(:spec) do 85 | warn("NOTE: rspec isn't installed, or is disabled for #{RUBY_VERSION} in the current environment") 86 | end 87 | end 88 | 89 | # Setup MiniTest 90 | begin 91 | require "rake/testtask" 92 | 93 | Rake::TestTask.new(:test) do |t| 94 | t.test_files = FileList["tests/**/test_*.rb"] 95 | end 96 | rescue LoadError 97 | desc("test task stub") 98 | task(:test) do 99 | warn("NOTE: minitest isn't installed, or is disabled for #{RUBY_VERSION} in the current environment") 100 | end 101 | end 102 | 103 | # rubocop:disable Rake/DuplicateTask 104 | if Rake::Task.task_defined?("spec") && !Rake::Task.task_defined?("test") 105 | desc "run spec task with test task" 106 | task test: :spec 107 | elsif !Rake::Task.task_defined?("spec") && Rake::Task.task_defined?("test") 108 | desc "run test task with spec task" 109 | task spec: :test 110 | else 111 | # Add spec as pre-requisite to 'test' 112 | Rake::Task[:test].enhance(["spec"]) 113 | end 114 | # rubocop:enable Rake/DuplicateTask 115 | 116 | # Setup RuboCop-LTS 117 | begin 118 | require "rubocop/lts" 119 | 120 | Rubocop::Lts.install_tasks 121 | # Make autocorrect the default rubocop task 122 | defaults << "rubocop_gradual:autocorrect" 123 | rescue LoadError 124 | desc("(stub) rubocop_gradual is unavailable") 125 | task(:rubocop_gradual) do 126 | warn("NOTE: rubocop-lts isn't installed, or is disabled for #{RUBY_VERSION} in the current environment") 127 | end 128 | end 129 | 130 | # Setup Reek 131 | begin 132 | require "reek/rake/task" 133 | 134 | Reek::Rake::Task.new do |t| 135 | t.fail_on_error = true 136 | t.verbose = false 137 | t.source_files = "{lib,spec,tests}/**/*.rb" 138 | end 139 | 140 | # Store current Reek output into REEK file 141 | require "open3" 142 | desc("Run reek and store the output into the REEK file") 143 | task("reek:update") do 144 | # Run via Bundler if available to ensure the right gem version is used 145 | cmd = [Gem.bindir ? File.join(Gem.bindir, "bundle") : "bundle", "exec", "reek"] 146 | 147 | output, status = Open3.capture2e(*cmd) 148 | 149 | File.write("REEK", output) 150 | 151 | # Mirror the failure semantics of the standard reek task 152 | unless status.success? 153 | abort("reek:update failed (reek reported smells). Output written to REEK") 154 | end 155 | end 156 | defaults << "reek:update" unless is_ci 157 | rescue LoadError 158 | desc("(stub) reek is unavailable") 159 | task(:reek) do 160 | warn("NOTE: reek isn't installed, or is disabled for #{RUBY_VERSION} in the current environment") 161 | end 162 | end 163 | 164 | # Setup Yard 165 | begin 166 | require "yard" 167 | 168 | YARD::Rake::YardocTask.new(:yard) do |t| 169 | t.files = [ 170 | # Source Splats (alphabetical) 171 | "lib/**/*.rb", 172 | "-", # source and extra docs are separated by "-" 173 | # Extra Files (alphabetical) 174 | "*.cff", 175 | "*.md", 176 | "*.txt", 177 | "REEK", 178 | ] 179 | end 180 | defaults << "yard" 181 | rescue LoadError 182 | desc("(stub) yard is unavailable") 183 | task(:yard) do 184 | warn("NOTE: yard isn't installed, or is disabled for #{RUBY_VERSION} in the current environment") 185 | end 186 | end 187 | 188 | ### RELEASE TASKS 189 | # Setup stone_checksums 190 | begin 191 | require "stone_checksums" 192 | 193 | GemChecksums.install_tasks 194 | rescue LoadError 195 | desc("(stub) build:generate_checksums is unavailable") 196 | task("build:generate_checksums") do 197 | warn("NOTE: stone_checksums isn't installed, or is disabled for #{RUBY_VERSION} in the current environment") 198 | end 199 | end 200 | 201 | task default: defaults 202 | --------------------------------------------------------------------------------