Skip to content

Commit

Permalink
Merge pull request #4 from liaogz82/feature/check-writable
Browse files Browse the repository at this point in the history
check for non-existent folder
  • Loading branch information
mosesliao authored Feb 20, 2018
2 parents 410e175 + 77b36cc commit af7c558
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Metrics/ModuleLength:
Enabled: false

# certificate_1 is an okay variable name
Style/VariableNumber:
Naming/VariableNumber:
Enabled: false

# This is used a lot across the fastlane code base for config files
Expand Down Expand Up @@ -209,7 +209,7 @@ Lint/ParenthesesAsGroupedExpression:

# This would reject is_ in front of methods
# We use `is_supported?` everywhere already
Style/PredicateName:
Naming/PredicateName:
Enabled: false

# We allow the $
Expand All @@ -222,15 +222,15 @@ Layout/SpaceAroundOperators:
- '**/spec/actions_specs/xcodebuild_spec.rb'

AllCops:
TargetRubyVersion: 2.0
TargetRubyVersion: 2.4
Include:
- '**/fastlane/Fastfile'
Exclude:
- '**/lib/assets/custom_action_template.rb'
- './vendor/**/*'

# They have not to be snake_case
Style/FileName:
Naming/FileName:
Exclude:
- '**/Dangerfile'
- '**/Brewfile'
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-lizard)
[![Gem Version](https://badge.fury.io/rb/fastlane-plugin-lizard.svg)](https://badge.fury.io/rb/fastlane-plugin-lizard)
[![CircleCI](https://circleci.com/gh/liaogz82/fastlane-plugin-lizard.svg?style=svg&circle-token=6d2bc552098ad6c8955ddecc9b058827e91e25cf)](https://circleci.com/gh/liaogz82/fastlane-plugin-lizard)

## Getting Started

Expand Down
6 changes: 3 additions & 3 deletions fastlane-plugin-lizard.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ Gem::Specification.new do |spec|

# spec.add_dependency 'your-dependency', '~> 1.0.0'

spec.add_development_dependency 'pry'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'fastlane'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rspec_junit_formatter'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'fastlane'
end
7 changes: 6 additions & 1 deletion lib/fastlane/plugin/lizard/actions/lizard_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ def self.run(params)
if params[:show_warnings]
Fastlane::Actions.sh_control_output("lizard #{params[:source_folder]} | sed -n -e '/^$/,$p'", print_command: true, print_command_output: true)
end
Fastlane::Actions.sh_control_output(command.join(" "), print_command: false, print_command_output: false)
if File.directory?(params[:report_file])
Fastlane::Actions.sh_control_output(command.join(" "), print_command: false, print_command_output: false)
else
# throws user_error
UI.user_error!("Please ensure #{params[:report_file]} is writable")
end
end

def self.description
Expand Down
2 changes: 1 addition & 1 deletion lib/fastlane/plugin/lizard/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Fastlane
module Lizard
VERSION = "0.1.1"
VERSION = "0.1.2"
end
end
9 changes: 0 additions & 9 deletions spec/lizard_action_spec.rb

This file was deleted.

17 changes: 17 additions & 0 deletions spec/test_file_writable_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## TODO:
# 1) set show_warnings to true, expect sh_control_output
# 2) set show_warnings to default, no output
describe Fastlane::Actions::LizardAction do
describe 'write to non-existent folder' do
it 'fails with user error' do
expect do
Fastlane::FastFile.new.parse("lane :test do
lizard(
source_folder: 'lib',
export_type: 'xml',
report_file: 'no-such-folder/lizard-report.xml')
end").runner.execute(:test)
end.to raise_error("Please ensure no-such-folder/lizard-report.xml is writable")
end
end
end

0 comments on commit af7c558

Please sign in to comment.