Skip to content

Commit f53028c

Browse files
committed
Move from single to double quotes
1 parent 0eef937 commit f53028c

File tree

3 files changed

+32
-31
lines changed

3 files changed

+32
-31
lines changed

exe/bundle_report

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ruby
22

33
# Needs to happen first
4-
require 'bundler/setup'
5-
require 'next_rails'
4+
require "bundler/setup"
5+
require "next_rails"
66
NextRails::BundleReport::CLI.new(ARGV).run

lib/next_rails/bundle_report/cli.rb

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# frozen_string_literal: true
22

3-
require 'optparse'
4-
require 'next_rails'
5-
require 'next_rails/bundle_report'
3+
require "optparse"
4+
require "next_rails"
5+
require "next_rails/bundle_report"
6+
67
class NextRails::BundleReport::CLI
78
def initialize(argv)
9+
validate_arguments(argv)
810
@argv = argv
9-
validate_arguments(@argv)
1011
end
1112

1213
def validate_arguments(argv)
@@ -20,12 +21,12 @@ def validate_arguments(argv)
2021
end
2122

2223
argv.each do |arg|
23-
if arg.start_with?('--rails-version') && !arg.match?(/--rails-version=+\d+(\.\d+)*$/)
24-
raise ArgumentError, 'Invalid Rails version format. Example: --rails-version=5.0.7'
24+
if arg.start_with?("--rails-version") && !arg.match?(/--rails-version=+\d+(\.\d+)*$/)
25+
raise ArgumentError, "Invalid Rails version format. Example: --rails-version=5.0.7"
2526
end
2627

27-
if arg.start_with?('--ruby-version') && !arg.match?(/--ruby-version=+\d+(\.\d+)*$/)
28-
raise ArgumentError, 'Invalid Ruby version format. Example: --ruby-version=3.3'
28+
if arg.start_with?("--ruby-version") && !arg.match?(/--ruby-version=+\d+(\.\d+)*$/)
29+
raise ArgumentError, "Invalid Ruby version format. Example: --ruby-version=3.3"
2930
end
3031
end
3132
end
@@ -58,28 +59,28 @@ def parse_options
5859
5960
EOS
6061

61-
opts.separator ''
62-
opts.separator 'Options:'
62+
opts.separator ""
63+
opts.separator "Options:"
6364

64-
opts.on('--rails-version [STRING]',
65-
'Rails version to check compatibility against (defaults to 5.0)') do |rails_version|
65+
opts.on("--rails-version [STRING]",
66+
"Rails version to check compatibility against (defaults to 5.0)") do |rails_version|
6667
options[:rails_version] = rails_version
6768
end
6869

69-
opts.on('--ruby-version [STRING]',
70-
'Ruby version to check compatibility against (defaults to 2.3)') do |ruby_version|
70+
opts.on("--ruby-version [STRING]",
71+
"Ruby version to check compatibility against (defaults to 2.3)") do |ruby_version|
7172
options[:ruby_version] = ruby_version
7273
end
7374

74-
opts.on('--include-rails-gems', 'Include Rails gems in compatibility report (defaults to false)') do
75+
opts.on("--include-rails-gems", "Include Rails gems in compatibility report (defaults to false)") do
7576
options[:include_rails_gems] = true
7677
end
7778

78-
opts.on('--json', 'Output JSON in outdated report (defaults to false)') do
79-
options[:format] = 'json'
79+
opts.on("--json", "Output JSON in outdated report (defaults to false)") do
80+
options[:format] = "json"
8081
end
8182

82-
opts.on_tail('-h', '--help', 'Show this message') do
83+
opts.on_tail("-h", "--help", "Show this message") do
8384
puts opts
8485
exit
8586
end
@@ -98,16 +99,16 @@ def parse_options
9899

99100
def execute_report(report_type, options)
100101
case report_type
101-
when 'ruby_check'
102+
when "ruby_check"
102103
NextRails::BundleReport.compatible_ruby_version(rails_version: options.fetch(:rails_version))
103-
when 'outdated'
104+
when "outdated"
104105
NextRails::BundleReport.outdated(options.fetch(:format, nil))
105106
else
106107
if options[:ruby_version]
107-
NextRails::BundleReport.ruby_compatibility(ruby_version: options.fetch(:ruby_version, '2.3'))
108+
NextRails::BundleReport.ruby_compatibility(ruby_version: options.fetch(:ruby_version, "2.3"))
108109
else
109110
NextRails::BundleReport.rails_compatibility(
110-
rails_version: options.fetch(:rails_version, '5.0'),
111+
rails_version: options.fetch(:rails_version, "5.0"),
111112
include_rails_gems: options.fetch(:include_rails_gems, false)
112113
)
113114
end
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'spec_helper'
1+
require "spec_helper"
22

33
RSpec.describe NextRails::BundleReport::CLI do
44
describe '#initialize' do
@@ -13,24 +13,24 @@
1313
/Invalid report type 'invalid_report_type'. Valid types are: outdated, compatibility, ruby_check./)
1414
end
1515

16-
it 'calls outdated if called with outdated' do
16+
it "calls outdated if called with outdated" do
1717
expect(NextRails::BundleReport).to receive(:outdated)
18-
described_class.new(['outdated']).run
18+
described_class.new(["outdated"]).run
1919
end
2020

21-
it 'calls compatible_ruby_version if called with ruby_check' do
21+
it "calls compatible_ruby_version if called with ruby_check" do
2222
expect(NextRails::BundleReport).to receive(:compatible_ruby_version)
23-
described_class.new(['ruby_check', '--rails-version=8.0.0']).run
23+
described_class.new(["ruby_check", "--rails-version=8.0.0"]).run
2424
end
2525

2626
it 'calls rails_compatibility if called with compatibility with rails-version option' do
2727
expect(NextRails::BundleReport).to receive(:rails_compatibility)
28-
described_class.new(['compatibility', '--rails-version=8.0.0']).run
28+
described_class.new(["compatibility", "--rails-version=8.0.0"]).run
2929
end
3030

3131
it 'calls ruby_compatibility if called with compatibility with ruby-version option' do
3232
expect(NextRails::BundleReport).to receive(:ruby_compatibility)
33-
described_class.new(['compatibility', '--ruby-version=3.4.0']).run
33+
described_class.new(["compatibility", "--ruby-version=3.4.0"]).run
3434
end
3535
end
3636
end

0 commit comments

Comments
 (0)