lib/puck/jar.rb
# Create the Jar file using the instance's configuration.
#
Create the Jar file using the instance's configuration.
Create the Jar file using the instance ' s configuration .
def create!
      FileUtils.mkdir_p(@configuration[:build_dir])
      Dir.mktmpdir do |tmp_dir|
        output_path = File.join(@configuration[:build_dir], @configuration[:jar_name])
        project_dir = Pathname.new(@configuration[:app_dir])
        extra_files = @configuration[:extra_files] || []
        jruby_complete_path = @configuration[:jruby_complete]
        if !(defined? JRubyJars) && !(jruby_complete_path && File.exists?(jruby_complete_path))
          raise PuckError, 'Cannot build Jar: jruby-jars must be installed, or :jruby_complete must be specified'
        end
        gem_dependencies = resolve_gem_dependencies
        create_jar_bootstrap!(tmp_dir, gem_dependencies)
        ant = Ant.new(output_level: 1)
        ant.jar(destfile: output_path) do
          manifest do
            attribute name: 'Main-Class', value: 'org.jruby.JarBootstrapMain'
            attribute name: 'Created-By', value: "Puck v#{Puck::VERSION}"
          end
          zipfileset dir: tmp_dir, includes: 'jar-bootstrap.rb'
          if jruby_complete_path
            zipfileset src: jruby_complete_path
          else
            zipfileset src: JRubyJars.core_jar_path
            zipfileset src: JRubyJars.stdlib_jar_path
          end
          %w[bin lib].each do |sub_dir|
            zipfileset dir: project_dir + sub_dir, prefix: File.join(JAR_APP_HOME, sub_dir)
          end
          extra_files.each do |ef|
            path = Pathname.new(ef).expand_path.cleanpath
            prefix = File.join(JAR_APP_HOME, path.relative_path_from(project_dir).dirname.to_s)
            zipfileset dir: path.dirname, prefix: prefix, includes: path.basename
          end
          gem_dependencies.each do |spec|
            zipfileset dir: spec[:base_path], prefix: spec[:jar_path]
          end
        end
      end
    end
def create! FileUtils . mkdir_p ( @configuration [ :build_dir ] ) Dir . mktmpdir do | tmp_dir | output_path = File . join ( @configuration [ :build_dir ] , @configuration [ :jar_name ] ) project_dir = Pathname . new ( @configuration [ :app_dir ] ) extra_files = @configuration [ :extra_files ] || [ ] jruby_complete_path = @configuration [ :jruby_complete ] if ! ( defined? JRubyJars ) && ! ( jruby_complete_path && File . exists? ( jruby_complete_path ) ) raise PuckError , 'Cannot build Jar: jruby-jars must be installed, or :jruby_complete must be specified' end gem_dependencies = resolve_gem_dependencies create_jar_bootstrap! ( tmp_dir , gem_dependencies ) ant = Ant . new ( output_level : 1 ) ant . jar ( destfile : output_path ) do manifest do attribute name : 'Main-Class' , value : 'org.jruby.JarBootstrapMain' attribute name : 'Created-By' , value : "Puck v#{Puck::VERSION}" end zipfileset dir : tmp_dir , includes : 'jar-bootstrap.rb' if jruby_complete_path zipfileset src : jruby_complete_path else zipfileset src : JRubyJars . core_jar_path zipfileset src : JRubyJars . stdlib_jar_path end %w[ bin lib ] . each do | sub_dir | zipfileset dir : project_dir + sub_dir , prefix : File . join ( JAR_APP_HOME , sub_dir ) end extra_files . each do | ef | path = Pathname . new ( ef ) . expand_path . cleanpath prefix = File . join ( JAR_APP_HOME , path . relative_path_from ( project_dir ) . dirname . to_s ) zipfileset dir : path . dirname , prefix : prefix , includes : path . basename end gem_dependencies . each do | spec | zipfileset dir : spec [ :base_path ] , prefix : spec [ :jar_path ] end end end end
Create the Jar file using the instance's configuration.
Create the Jar file using the instance ' s configuration .