Skip to content

Commit 23da5f1

Browse files
committed
qwerty
1 parent 2679663 commit 23da5f1

File tree

7 files changed

+30
-16
lines changed

7 files changed

+30
-16
lines changed

lib/skunk/cli/application.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def execute
3131
command = Skunk::CommandFactory.create(@parsed_options)
3232
reporter = command.execute
3333

34-
print(reporter.status_message)
34+
$stdout.puts(reporter.status_message)
3535
if command.sharing?
3636
share_status_message = command.share(reporter)
37-
print(share_status_message)
37+
$stdout.puts(share_status_message)
3838
end
3939

4040
reporter.status
@@ -49,10 +49,6 @@ def warn_coverage_info
4949
warn "warning: Couldn't find coverage info at #{COVERAGE_FILE}."
5050
warn "warning: Having no coverage metrics will make your SkunkScore worse."
5151
end
52-
53-
def print(message)
54-
$stdout.puts(message)
55-
end
5652
end
5753
end
5854
end

lib/skunk/commands/status_sharer.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def share
3535

3636
# :reek:UtilityFunction
3737
def base_url
38-
ENV["SHARE_URL"] || DEFAULT_URL
38+
@base_url ||= ENV["SHARE_URL"] || DEFAULT_URL
3939
end
4040

4141
def json_summary
@@ -73,11 +73,11 @@ def share_enabled?
7373

7474
# @return [Boolean] Check if share URL is empty
7575
def share_url_empty?
76-
share_url == ""
76+
share_url.empty?
7777
end
7878

7979
def share_url
80-
ENV["SHARE_URL"].to_s
80+
@share_url ||= ENV["SHARE_URL"].to_s
8181
end
8282

8383
def payload

lib/skunk/config.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def root
5555
end
5656

5757
def root=(path)
58-
@root = path.nil? || path.to_s.empty? ? nil : File.expand_path(path.to_s)
58+
path_str = path.to_s
59+
@root = path_str.empty? ? nil : File.expand_path(path_str)
5960
end
6061

6162
# Add a format to the existing list
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test output

test/lib/skunk/cli/options/argv_test.rb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,22 @@
1313
it "sets Skunk::Config.root to the provided path" do
1414
parser = Skunk::Cli::Options::Argv.new(["--out=tmp/custom"])
1515
parser.parse
16-
_(Skunk::Config.root).must_match(/tmp\/custom$/)
16+
_(Skunk::Config.root).must_match(%r{tmp/custom$})
1717
end
1818

1919
it "defaults to tmp/rubycritic when not provided" do
20-
parser = Skunk::Cli::Options::Argv.new([])
21-
parser.parse
22-
_(Skunk::Config.root).must_match(/tmp\/rubycritic$/)
20+
begin
21+
prior_root = RubyCritic::Config.root
22+
default_root = File.expand_path("tmp/rubycritic_default", Dir.pwd)
23+
RubyCritic::Config.root = default_root
24+
Skunk::Config.reset
25+
parser = Skunk::Cli::Options::Argv.new([])
26+
parser.parse
27+
_(Skunk::Config.root).must_equal default_root
28+
ensure
29+
RubyCritic::Config.root = prior_root || default_root
30+
Skunk::Config.reset
31+
end
2332
end
2433
end
2534

test/lib/skunk/config_test.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,14 @@ def test_reset
8181
end
8282

8383
def test_default_root
84-
assert_match(/tmp\/rubycritic$/, Config.root)
84+
prior_root = RubyCritic::Config.root
85+
default_root = File.expand_path("tmp/rubycritic_default", Dir.pwd)
86+
RubyCritic::Config.root = default_root
87+
Config.reset
88+
assert_equal default_root, Config.root
89+
ensure
90+
RubyCritic::Config.root = prior_root || default_root
91+
Config.reset
8592
end
8693

8794
def test_set_root_expands_path

test/lib/skunk/generators/html/overview_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ def test_root_directory_uses_skunk_config_root
2323
end
2424
end
2525
end
26-
end
26+
end

0 commit comments

Comments
 (0)