Module: Tetra::Scriptable
- Included in:
- Package
- Defined in:
- lib/tetra/packages/scriptable.rb
Overview
generates a package build script from bash_history
Instance Method Summary collapse
-
#_to_script(project) ⇒ Object
returns a build script for this package.
-
#aliases(project) ⇒ Object
setup aliases for adjusted versions of the packaging tools.
Instance Method Details
#_to_script(project) ⇒ Object
returns a build script for this package
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tetra/packages/scriptable.rb', line 7 def _to_script(project) project.from_directory do script_lines = [ "#!/bin/bash", "set -xe", "PROJECT_PREFIX=`readlink -e .`", "cd #{project.latest_dry_run_directory}" ] + aliases(project) + project.build_script_lines new_content = script_lines.join("\n") + "\n" result_dir = File.join(project.packages_dir, project.name) FileUtils.mkdir_p(result_dir) result_path = File.join(result_dir, "build.sh") conflict_count = project.merge_new_content(new_content, result_path, "Build script generated", "script") [result_path, conflict_count] end end |
#aliases(project) ⇒ Object
setup aliases for adjusted versions of the packaging tools
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tetra/packages/scriptable.rb', line 29 def aliases(project) kit = Tetra::Kit.new(project) aliases = [] ant_path = kit.find_executable("ant") ant_commandline = Tetra::Ant.commandline("$PROJECT_PREFIX", ant_path) aliases << "alias ant='#{ant_commandline}'" mvn_path = kit.find_executable("mvn") mvn_commandline = Tetra::Mvn.commandline("$PROJECT_PREFIX", mvn_path) aliases << "alias mvn='#{mvn_commandline} -o'" gradle_commandline = Tetra::Gradle.commandline("$PROJECT_PREFIX") aliases << "alias gradlew='#{gradle_commandline} --offline'" aliases end |