lib/jarbler/config.rb in jarbler-0.2.1 vs lib/jarbler/config.rb in jarbler-0.2.2

- old
+ new

@@ -1,11 +1,11 @@ require 'rubygems' require 'json' module Jarbler class Config - attr_accessor :jar_name, :includes, :excludes, :jruby_version, :executable, :executable_params, :compile_ruby_files, :include_gems_to_compile + attr_accessor :jar_name, :includes, :excludes, :jruby_version, :executable, :executable_params, :compile_ruby_files, :include_gems_to_compile, :excludes_from_compile CONFIG_FILE = 'config/jarble.rb' # create instance of Config class with defaults or from config file # Should be called from rails/ruby root directory def self.create @@ -27,10 +27,11 @@ end def initialize @compile_ruby_files = false @excludes = %w(tmp/cache tmp/pids tmp/sockets vendor/bundle vendor/cache vendor/ruby) + @excludes_from_compile = %w(config) @executable = 'bin/rails' @executable_params = %w(server -e production -p 8080) @include_gems_to_compile = false @includes = %w(app bin config config.ru db Gemfile Gemfile.lock lib log public Rakefile script vendor tmp) @jar_name = File.basename(Dir.pwd) + '.jar' @@ -70,10 +71,13 @@ # config.compile_ruby_files = #{compile_ruby_files} # Compile also the .rb files of the gems of the project to Java .class files? # config.include_gems_to_compile = #{include_gems_to_compile} +# Directories or files to exclude from the compilation if compile_ruby_files = true +# config.excludes_from_compile = #{excludes_from_compile} + ".split("\n")) end # write a config file with the given lines # if the file exists, it is overwritten @@ -135,8 +139,9 @@ raise "Invalid config value for includes: #{includes}" unless includes.is_a?(Array) raise "Invalid config value for excludes: #{excludes}" unless excludes.is_a?(Array) raise "Invalid config value for compile_ruby_files: #{compile_ruby_files}" unless [true, false].include?(compile_ruby_files) raise "compile_ruby_files = true is supported only with JRuby! Current runtime is '#{RUBY_ENGINE}'" if compile_ruby_files && (defined?(RUBY_ENGINE) && RUBY_ENGINE != 'jruby') raise "include_gems_to_compile = true is supported only if compile_ruby_files = true!" if include_gems_to_compile && !compile_ruby_files + raise "Invalid config value for excludes_from_compile: #{excludes_from_compile}" unless excludes_from_compile.is_a?(Array) end end end \ No newline at end of file