Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.9.8 is missing the version 0.9.7 changes #70

Open
BrianHawley opened this issue Feb 22, 2023 · 8 comments
Open

Version 0.9.8 is missing the version 0.9.7 changes #70

BrianHawley opened this issue Feb 22, 2023 · 8 comments

Comments

@BrianHawley
Copy link

BrianHawley commented Feb 22, 2023

This github repo didn't have the changes past 0.9.6, so the recent 0.9.8 update here doesn't have them either.

@mojavelinux
Copy link

Here's the sum of the commits that seem to have been lost:

diff -Nuar rghost-0.9.6/lib/rghost/merge_pdfs.rb rghost-0.9.7/lib/rghost/merge_pdfs.rb
--- rghost-0.9.6/lib/rghost/merge_pdfs.rb	1969-12-31 17:00:00.000000000 -0700
+++ rghost-0.9.7/lib/rghost/merge_pdfs.rb	2023-04-15 01:37:05.993735128 -0600
@@ -0,0 +1,12 @@
+class RGhost::MergePdfs
+  attr_reader :error, :errors
+  DEFAULT_OPTIONS = { :convert =>  true }
+
+  def self.merge(pdfs, options={})
+    rge = RGhost::Engine.new(pdfs,DEFAULT_OPTIONS.merge(options))
+    out = rge.render(:pdf)
+    @error = rge.error
+    @errors = rge.errors
+    out
+  end
+end
\ No newline at end of file
diff -Nuar rghost-0.9.6/lib/rghost/ruby_ghost_engine.rb rghost-0.9.7/lib/rghost/ruby_ghost_engine.rb
--- rghost-0.9.6/lib/rghost/ruby_ghost_engine.rb	2023-04-15 01:46:49.435913583 -0600
+++ rghost-0.9.7/lib/rghost/ruby_ghost_engine.rb	2023-04-15 01:37:06.000735034 -0600
@@ -52,11 +52,9 @@
     params << "-sstdout=#{shellescape(file_err)}"
     params << "-sOutputFile=#{shellescape(file_out)}"
     params << @options[:raw] if @options[:raw]
-
-
     case @document
     when RGhost::Document
-      file_in="#{tmp_filename}.rgin"
+      file_in = shellescape("#{tmp_filename}.rgin")
       params.concat @document.gs_paper
       mode=external_encoding.nil? ? 'w' : "w:#{external_encoding}"
       fi=File.open(file_in,mode)
@@ -66,10 +64,14 @@
       file_in=@document.path
       #@delete_input=false unless @options[:debug]
     when String
-      file_in=@document
+      file_in = shellescape(@document)
+    when Array
+      file_in = @document.map{|d| shellescape(d) }.join(' ')
+    else
+      raise RuntimeError.new("Cannot convert #{@document.class}. Supported classes are RGhost::Document or File or String.")
     end
 
-    params << shellescape(file_in)
+    params << file_in
 
     if RGhost::Config::GS[:mode] == :gslib
       require "rghost/rgengine"
diff -Nuar rghost-0.9.6/lib/rghost/ruby_ghost_version.rb rghost-0.9.7/lib/rghost/ruby_ghost_version.rb
--- rghost-0.9.6/lib/rghost/ruby_ghost_version.rb	2023-04-15 01:46:49.436913569 -0600
+++ rghost-0.9.7/lib/rghost/ruby_ghost_version.rb	2023-04-15 01:37:06.001735020 -0600
@@ -1,8 +1,8 @@
 module RGhost::VERSION #:nodoc:
     MAJOR = 0
-    MINOR = 8
+    MINOR = 9
     TINY  = 7
     DATE=1244286414
     STRING = [MAJOR, MINOR, TINY].join('.')
-  
+
 end
diff -Nuar rghost-0.9.6/lib/rghost.rb rghost-0.9.7/lib/rghost.rb
--- rghost-0.9.6/lib/rghost.rb	2023-04-15 01:46:49.418913810 -0600
+++ rghost-0.9.7/lib/rghost.rb	2023-04-15 01:37:05.989735181 -0600
@@ -12,7 +12,8 @@
 require 'rghost/ps_facade'
 require 'rghost/function'
 require 'rghost/document'
-require 'rghost/grid/grid'  
+require 'rghost/merge_pdfs'
+require 'rghost/grid/grid'
 RGhost::Config::GS[:PATH]="/opt/local/bin/gs"
 

@mojavelinux
Copy link

I'll also add that there are no tags in this repository, so it's impossible to validate what was actually released.

@shairontoledo
Copy link
Owner

@mojavelinux I made you a collaborator, please feel free and fix it.

@mojavelinux
Copy link

Do you know where the original repository is located that would have this missing commits? Or is that they were never pushed anywhere?

@shairontoledo
Copy link
Owner

Good question, I might have generated the gem from another branch I don't remember now. I think applying that diff and pushing it to this repo is better.

@mojavelinux
Copy link

I don't think it's the right approach because those are not my commits. We really should have the original commits, if they are available. I didn't write the code and therefore do not want to be associated as the author. However, I would be willing to submit a PR that makes you the author of the commit (assuming you changed the code).

@stevenharman
Copy link
Collaborator

I'm also noticing that the lib/rghost/ruby_ghost_version.rb (called out in the diff above) is quite out of date/differs from the rghost.gemspec file. So docs produced by RGhost have the wrong metadata in them, and probably had since whatever versions came after 0.8.7.

So, a few questions, @shairontoledo:

  1. Any chance you still have the code around that produced 0.9.7 so we could get the missing commit in?
  2. Would it make sense to update the RGhost::VERSION constants and have the .gemspec pull from there so future versions have the correct metadata?
  3. Would you be open to shipping (to RubyGems) those changes as a 0.9.9 release?

@shairontoledo
Copy link
Owner

@stevenharman:

  1. I don't have it anymore it was cut off from SVN and was hosted by RubyForge, I still see some ashes here https://web.archive.org/web/20070609174011/http://rubyforge.org/projects/rghost/
  2. Yeap.
  3. Sure, please open a PR. I'll go ahead and merge it and publish it accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants