Skip to content

Commit

Permalink
Updates gemspec
Browse files Browse the repository at this point in the history
  • Loading branch information
TitouanVanBelle committed Aug 9, 2019
1 parent e9e37c7 commit b22ff0f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 26 deletions.
2 changes: 1 addition & 1 deletion fastlane-plugin-xchtmlreport.gemspec
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
spec.email = 'titouan.vanbelle@gmail.com'

spec.summary = 'Plugin for XCHTMLReport'
# spec.homepage = "https://github.com/<GITHUB_USERNAME>/fastlane-plugin-xchtmlreport"
spec.homepage = "https://github.com/TitouanVanBelle/fastlane-plugin-xchtmlreport"
spec.license = "MIT"

spec.files = Dir["lib/**/*"] + %w(README.md LICENSE)
Expand Down
35 changes: 15 additions & 20 deletions lib/fastlane/plugin/xchtmlreport/actions/xchtmlreport_action.rb
Expand Up @@ -5,60 +5,55 @@ module Fastlane
module Actions
class XchtmlreportAction < Action
def self.run(params)
binary_path = params[:binary_path]
if !File.file?(binary_path)
UI.user_error!('xchtmlreport binary not installed! https://github.com/TitouanVanBelle/XCTestHTMLReport')
end

result_bundle_path = params[:result_bundle_path]
if result_bundle_path.nil?
result_bundle_path = Scan.cache[:result_bundle_path]
end

result_bundle_paths = params[:result_bundle_paths]
if result_bundle_path and result_bundle_paths.empty?
result_bundle_paths = [result_bundle_path]
end

if result_bundle_paths.nil? or result_bundle_paths.empty?
UI.user_error!("You must pass at least one result_bundle_path")
UI.user_error!('You must pass at least one result_bundle_path')
end

binary_path = params[:binary_path]

if !File.file?(binary_path)
UI.user_error!("xchtmlreport binary not installed! https://github.com/TitouanVanBelle/XCTestHTMLReport")
end
UI.message "Result bundle path: #{result_bundle_path}"

command = "#{binary_path}"

result_bundle_paths.each { |path|
command += " -r #{path}"
}

if params[:enable_junit]
command += " -j"
end
command_comps = [binary_path]
command_comps += result_bundle_paths.map { |path| "-r #{path}" }
command_comps.append '-j' if params[:enable_junit]

sh command
sh command_comps.join ' '
end

def self.description
"Xcode-like HTML report for Unit and UI Tests"
'Xcode-like HTML report for Unit and UI Tests'
end

def self.authors
["XCTestHTMLReport: TitouanVanBelle", "plugin: chrisballinger"]
['XCTestHTMLReport: TitouanVanBelle', 'plugin: chrisballinger']
end

def self.return_value
# If your method provides a return value, you can describe here what it does
end

def self.details
"https://github.com/TitouanVanBelle/XCTestHTMLReport"
'https://github.com/TitouanVanBelle/XCTestHTMLReport'
end

def self.available_options
[
FastlaneCore::ConfigItem.new(
key: :result_bundle_path,
description: "Path to the result bundle from scan. After running scan you can use Scan.cache[:result_bundle_path]",
description: 'Path to the result bundle from scan. After running scan you can use Scan.cache[:result_bundle_path]',
conflicting_options: [:result_bundle_paths],
optional: true,
is_string: true,
Expand Down
6 changes: 1 addition & 5 deletions spec/xchtmlreport_action_spec.rb
@@ -1,9 +1,5 @@
describe Fastlane::Actions::XchtmlreportAction do
describe '#run' do
it 'prints a message' do
expect(Fastlane::UI).to receive(:message).with("The xchtmlreport plugin is working!")

Fastlane::Actions::XchtmlreportAction.run(nil)
end

end
end

0 comments on commit b22ff0f

Please sign in to comment.