Xcode run phase script in Ruby wrong encoding
In the end the solution seems to be to force UTF8 onto ruby
LC_ALL= LANG=en_US.UTF-8 ruby -e 'p Encoding.default_external'
export LANG=en_US.UTF-8
What is a proper way to execute ruby script from xcode build phase script?
Build phase -> Shell: change /bin/sh
to /bin/bash -l
Bash login is required, in order to load ruby variables/paths/etc.
Force .rb file running under specific ruby versions
Use the gem semantic to handle parsing the current Ruby version:
require 'semantic'
# Require >= 2.7 < 3
exit unless Semantic::Version.new(RUBY_VERSION).satisfies?('~> 2.7')
# Require >= 2.7, including 3 and above
exit unless Semantic::Version.new(RUBY_VERSION).satisfies?('>= 2.7')
This requires you to use bundler and a Gemfile with your app.
Other comparators are listed in the source code for the gem:
if ['<', '>', '<=', '>='].include?(comparator)
satisfies_comparator? comparator, pad_version_string(other_version_string)
elsif comparator == '~>'
pessimistic_match? other_version_string
else
tilde_matches? other_version_string
end
This will allow you to fine-tune your version requirements.
What permissions are required for Run Script during a build phase?
You can simplify your Xcode project file a little further and not require the "bin/sh " in front of the script name.
To avoid this, you need to turn on "execute" permissions for users (Xcode in this case) of the file.
Steps
- Go into terminal
- Navigate to where your script is
- run
chmod 755 yourScriptName.sh
How do I get ctrl-c to interrupt a script running via rvm do?
try:
rvm-shell 1.9.3 -c "ruby myscript.rb"
if you can not get it running in any way open rvm issue => https://github.com/wayneeseguin/rvm/issues
Installing rvm on cygwin
As the error says, you're missing tput
. Run the cygwin setup, look for the ncurses
package, and install it.
Related Topics
How to Use Rspec to Mock Stdin/Stdout to Test Console Reads & Writes
Using Rbenv Doesn't Work with Sudo
Ruby Modulo 3 with Negative Numbers Is Unintuitive
Assign/Replace Params Hash in Rails
Finding If a Sentence Contains a Specific Phrase in Ruby
Check If an Array Is Subset of Another Array in Ruby
Sinatra Clears Session on Post
Why Is Gets Throwing an Error When Arguments Are Passed to My Ruby Script
Heroku App Crash H10 - Bash: Bin/Rails: No Such File or Directory
What Does "Shadowing" Mean in Ruby
Differencebetween 'Try' and '&.' (Safe Navigation Operator) in Ruby
Ruby Variable (Array) Assignment Misunderstanding (With Push Method)