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

Update release script to update spec/dummy/package.json and fix Ruby 2.1 issues #867

Merged
merged 5 commits into from
Jun 9, 2017
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Starts SimpleCov for code coverage.

if ENV["COVERAGE"]
if ENV["COVERAGE"] == "true"
require "simplecov"

# Using a command name prevents results from getting clobbered by other test suites
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/git_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module ReactOnRails
module GitUtils
def self.uncommitted_changes?(message_handler)
return false if ENV["COVERAGE"]
return false if ENV["COVERAGE"] == "true"
status = `git status --porcelain`
return false if status.empty?
error = "You have uncommitted code. Please commit or stash your changes before continuing"
Expand Down
24 changes: 15 additions & 9 deletions lib/react_on_rails/prerender_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,30 @@ def initialize(component_name: nil, err: nil, props: nil,
js_code: nil, console_messages: nil)
message = "ERROR in SERVER PRERENDERING\n".dup
if err
message << <<~MSG
Encountered error: \"#{err}\"
# rubocop:disable Layout/IndentHeredoc
message << <<-MSG
Encountered error: \"#{err}\"
MSG
# rubocop:enable Layout/IndentHeredoc
backtrace = err.backtrace.join("\n")
else
backtrace = nil
end
message << <<~MSG
when prerendering #{component_name} with props: #{props}
js_code was:
#{js_code}
# rubocop:disable Layout/IndentHeredoc
message << <<-MSG
when prerendering #{component_name} with props: #{props}
js_code was:
#{js_code}
MSG
# rubocop:enable Layout/IndentHeredoc

if console_messages
message << <<~MSG
console messages:
#{console_messages}
# rubocop:disable Layout/IndentHeredoc
message << <<-MSG
console messages:
#{console_messages}
MSG
# rubocop:enable Layout/IndentHeredoc
end

super([message, backtrace].compact.join("\n"))
Expand Down
5 changes: 5 additions & 0 deletions rakelib/release.rake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ which are installed via `bundle install` and `yarn`

Example: `rake release[2.1.0,false]`")

# rubocop:disable Metrics/BlockLength
task :release, %i[gem_version dry_run tools_install] do |_t, args|
class MessageHandler
def add_error(error)
Expand Down Expand Up @@ -66,4 +67,8 @@ task :release, %i[gem_version dry_run tools_install] do |_t, args|

# Release the new gem version
sh_in_dir(gem_root, "gem release") unless is_dry_run

# Update master with new npm version
sh_in_dir(Path.join(gem_root, "spec", "dummy", "client"), "yarn add react-on-rails@#{npm_version}")
sh_in_dir(gem_root, "git commit -am 'Updated spec/dummy/client/package.json latest version'") unless is_dry_run
end
7 changes: 4 additions & 3 deletions rakelib/run_rspec.rake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace :run_rspec do

desc "(HACK) Run RSpec on spec/empty_spec in order to have SimpleCov generate a coverage report from cache"
task :empty do
sh %(COVERAGE=true rspec spec/empty_spec.rb)
sh %(#{ENV['USE_COVERALLS'] ? 'COVERAGE=true' : ''} rspec spec/empty_spec.rb)
end

Coveralls::RakeTask.new if ENV["USE_COVERALLS"] == "TRUE"
Expand All @@ -70,7 +70,7 @@ task :js_tests do
sh "yarn run test"
end

msg = <<~DESC
msg = <<-DESC.strip_heredoc
Runs all tests, run `rake -D run_rspec` to see all available test options.
"rake run_rspec:example_basic" is a good way to run only one generator test.
DESC
Expand Down Expand Up @@ -101,7 +101,8 @@ def run_tests_in(dir, options = {})

command_name = options.fetch(:command_name, path.basename)
rspec_args = options.fetch(:rspec_args, "")
env_vars = %(#{options.fetch(:env_vars, '')} COVERAGE=true TEST_ENV_COMMAND_NAME="#{command_name}")
env_vars = %(#{options.fetch(:env_vars, '')} TEST_ENV_COMMAND_NAME="#{command_name}").dup
env_vars << "COVERAGE=true" if ENV["USE_COVERALLS"]
sh_in_dir(path.realpath, "#{env_vars} bundle exec rspec #{rspec_args}")
end

Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/spec/simplecov_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Starts SimpleCov for code coverage.

if ENV["COVERAGE"]
if ENV["COVERAGE"] == "true"
require "simplecov"

# Using a command name along with the test_env_number prevents results from
Expand Down
2 changes: 1 addition & 1 deletion spec/react_on_rails/simplecov_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Starts SimpleCov for code coverage.

if ENV["COVERAGE"]
if ENV["COVERAGE"] == "true"
require "simplecov"
# Using a command name prevents results from getting clobbered by other test
# suites
Expand Down