Module: Jax::Generators::ScriptJaxLoader
- Defined in:
- lib/jax/generators/script_jax_loader.rb
Overview
Shamelessly lifted from Ruby on Rails
Constant Summary collapse
- RUBY =
- SCRIPT_JAX =
File.join('script', 'jax')
Class Method Summary collapse
- .exec_script_jax! ⇒ Object
- .in_jax_application? ⇒ Boolean
- .in_jax_application_subdirectory?(path = Pathname.new(Dir.pwd)) ⇒ Boolean
Class Method Details
.exec_script_jax! ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jax/generators/script_jax_loader.rb', line 26 def self.exec_script_jax! cwd = Dir.pwd ENV['JAX_CWD'] ||= cwd return unless in_jax_application? || in_jax_application_subdirectory? exec RUBY, SCRIPT_JAX, *ARGV if in_jax_application? Dir.chdir("..") do # Recurse in a chdir block: if the search fails we want to be sure # the application is generated in the original working directory. exec_script_jax! unless cwd == Dir.pwd end rescue SystemCallError # could not chdir, no problem just return end |
.in_jax_application? ⇒ Boolean
40 41 42 |
# File 'lib/jax/generators/script_jax_loader.rb', line 40 def self.in_jax_application? File.exists?(SCRIPT_JAX) end |
.in_jax_application_subdirectory?(path = Pathname.new(Dir.pwd)) ⇒ Boolean
44 45 46 |
# File 'lib/jax/generators/script_jax_loader.rb', line 44 def self.in_jax_application_subdirectory?(path = Pathname.new(Dir.pwd)) File.exists?(File.join(path, SCRIPT_JAX)) || !path.root? && in_jax_application_subdirectory?(path.parent) end |