rubypoint 0.0.1 → 0.0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ task :default => :spec
18
18
 
19
19
  GEM = 'rubypoint'
20
20
  GEM_NAME = 'rubypoint'
21
- GEM_VERSION = '0.0.1'
21
+ GEM_VERSION = '0.0.1.1'
22
22
  AUTHORS = ['James Pozdena']
23
23
  EMAIL = "jpoz@jpoz.net"
24
24
  HOMEPAGE = "http://github.com/jpoz/rubypoint"
@@ -4,8 +4,14 @@ require 'ftools'
4
4
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
5
5
 
6
6
  class RubyPoint
7
+ @@working_directory = ''
8
+
7
9
  def self.working_directory
8
- 'tmp/'
10
+ @@working_directory
11
+ end
12
+
13
+ def self.working_directory=(directory)
14
+ @@working_directory = directory
9
15
  end
10
16
 
11
17
  def self.open_doc(file_path, save_path)
Binary file
@@ -2,23 +2,30 @@ require 'zipruby'
2
2
 
3
3
  class RubyPoint
4
4
  class Presentation
5
-
5
+ @@base_pptx = File.dirname(__FILE__)+'/base.pptx'
6
+
6
7
  attr_accessor :files, :slides
7
8
 
8
- def initialize(file_path)
9
+ def initialize(file_path=@@base_pptx)
9
10
  @working_directory = RubyPoint.working_directory
10
- @uuid = Time.now.to_i
11
+ @uuid = Time.now.to_i + rand(100)
11
12
  @files = []
13
+ @base_file_name = file_path.split('/').last
12
14
  self.open(file_path)
13
15
  end
14
16
 
15
17
  def open(path)
16
18
  system("mkdir #{file_directory}")
17
- system("cp #{path} #{@working_directory}#{@uuid}/#{path}")
18
- system("unzip -q #{@working_directory}#{@uuid}/#{path} -d #{@working_directory}#{@uuid}/")
19
- system("rm #{@working_directory}#{@uuid}/#{path}")
19
+ system("cp #{path} #{@working_directory}#{@uuid}/#{@base_file_name}")
20
+ system("unzip -q #{@working_directory}#{@uuid}/#{@base_file_name} -d #{@working_directory}#{@uuid}/")
21
+ system("rm #{@working_directory}#{@uuid}/#{@base_file_name}")
20
22
  @files = Dir.glob("#{@working_directory}#{@uuid}/**/*", ::File::FNM_DOTMATCH)
21
23
  end
24
+
25
+ def system(stuff)
26
+ puts stuff
27
+ super
28
+ end
22
29
 
23
30
  def save(file_path, force=false)
24
31
  slides.each do |s|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubypoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pozdena
@@ -44,6 +44,7 @@ files:
44
44
  - GPL-LICENSE
45
45
  - README.textile
46
46
  - Rakefile
47
+ - lib/rubypoint/base.pptx
47
48
  - lib/rubypoint/content_types_xml.rb
48
49
  - lib/rubypoint/core.rb
49
50
  - lib/rubypoint/docProps/app.rb