-
Notifications
You must be signed in to change notification settings - Fork 58
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
Gemfile #28
Gemfile #28
Conversation
rakelib/output.rake
Outdated
task :compile => :modules do |task| | ||
Utils.print_info 'Compiling template output files' | ||
|
||
exit Dir.glob('Tests/Expected/**/*.swift').map { |f| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exit
typically takes an integer (the exit code) as argument, right?
So if one of the compile_file(f, task)
returns false
, the reduce
will return false
and exit false
would be interpreted as exit(0)
… generally meaning no error?
While if all compile_file(f, task)
return true
, thereduce
will return true
and exit true
would be interpreted as exit(1)
… meaning an error?
I think it would be better if compile_file
returned the return code / status code of the execution of the Utils.run
call (line 87), and doing a exit_codes = Dir.glob(…).map { compile_file(…) }
first, then do a return exit_codes.find { |c| c != 0 } || 0
to globally return the first non-zero exit code, or exit(0) if all exit codes are 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument can be a boolean or an integer. If it's boolean, then true means success. If it's an integer than 0 means success.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL 👍
rakelib/output.rake
Outdated
subtask = File.basename(f, '.*') | ||
|
||
begin | ||
Utils.run(commands, task, subtask, xcrun: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As stated above, Utils.run
should hopefully return the status code of the ran command, so the same way as it's done on line 63, the function here should just end with the call to Utils.run(…)
without the need of a begin/rescue
block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem with that is that it can fail so we need to catch the exception.
rakelib/pod.rake
Outdated
task :lint do |task| | ||
Utils.print_info 'Linting the pod spec' | ||
Utils.run(%Q(pod lib lint "#{POD_NAME}.podspec" --quick), task) | ||
if File.file?('Podfile') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the nature of the task, we should rather test the presence of a #{PODNAME}.podspec
rather than the presence of a Podfile
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
Rakefile
Outdated
@@ -6,7 +6,6 @@ WORKSPACE = 'StencilSwiftKit' | |||
TARGET_NAME = 'Tests' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we document somewhere (comment at the top of each rakelib/*.rake
file? Elsewhere?) what global variables are used by various tasks, and thus which variables are expected to be defined in each repo's Rakefile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides, SCHEME_NAME
would be a better name for that variable 😉
switch to using a gemfile and calling via bundle