Inject Script phase in your Xcode project easily.
gem install spinjector
First, create a YAML configuration file under ./Configuration/spinjector_configuration.yaml
(default path where spinjector looks for a configuration file).
scripts:
foo:
name: "Foo"
script: |
echo Foo
execution_position: :after_compile
targets:
TargetNameA:
- foo
- "helloworld.yaml"
- "helloworld_explicit_script.yaml"
TargetNameB:
- "helloworld_short.yaml"
- foo
Then, for each script you want to inject in your Xcode project:
-
You can use
scripts
section in the global configuration file to define your script directly (eg.foo
)... -
...Or create a script configuration file (eg.
helloworld.yaml
)
name: "Hello World" # required. Script phase name.
# One and only one :script_path or :script may appear.
# For now, it makes no sense to have 2 differents script sources.
script_path: "Script/helloworld.sh" # required. Script file path.
script: | # required. Script.
<some code lines>
<other code lines>
input_paths: # optional.
- ""
output_paths: # optional.
- ""
input_file_list_paths: # optional.
- ""
output_file_list_paths: # optional.
- ""
dependency_file: # optional.
execution_position: # optional. [:before_compile | :after_compile | :before_headers | :after_headers | :after_all].
show_env_vars_in_log: # optional. Set to '0' if you want to hide environment variables, any other values will allow them.
always_out_of_date: # optional. Set to '1' if the script should always run without dependency analysis.
- If you use the
script_path option
, create the script file
echo Hello World
Finally, inject script phases
spinjector [-c] <path-to-your-global-configuration-file>
- After all your changes are reviewed and merged
- Create a
release
branch - Update the version in field
s.version
from filespinjector.gemspec
- Execute
make publish
You may need to configure your account at step 4.
if you've never pushed any gem. You can find all the informations you need on the official documentation.
To run the tests, simply run:
rake test