slideshow 1.2.0.beta4 → 1.2.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ Hoe.spec 'slideshow' do
17
17
  ['markdown','>= 0.4.0'],
18
18
  ['textutils','>= 0.2.0'],
19
19
  ['props','>= 0.2.0'],
20
- ['pakman','>= 0.2.0'],
20
+ ['pakman','>= 0.3.0'],
21
21
  ['activesupport', '>= 3.2.6']
22
22
  ]
23
23
 
@@ -68,6 +68,10 @@ class Gen
68
68
  end
69
69
 
70
70
 
71
+ ## fix:/todo: check if these get called
72
+ ## from helpers
73
+ ## fix: cleanup and remove
74
+
71
75
  def load_template( path )
72
76
  puts " Loading template #{path}..."
73
77
  return File.read( path )
@@ -78,18 +82,6 @@ class Gen
78
82
  end
79
83
 
80
84
 
81
- def with_output_path( dest, output_path )
82
- dest_full = File.expand_path( dest, output_path )
83
- logger.debug "dest_full=#{dest_full}"
84
-
85
- # make sure dest path exists
86
- dest_path = File.dirname( dest_full )
87
- logger.debug "dest_path=#{dest_path}"
88
- FileUtils.makedirs( dest_path ) unless File.directory? dest_path
89
- dest_full
90
- end
91
-
92
-
93
85
 
94
86
  # move into a filter??
95
87
  def post_processing_slides( content )
@@ -167,7 +159,7 @@ class Gen
167
159
 
168
160
  # check if file exists (if yes use custom template package!) - allows you to override builtin package with same name
169
161
  if File.exists?( manifest_path_or_name )
170
- manifest = Pakman::Manifest.load_file( logger, manifest_path_or_name )
162
+ manifestsrc = manifest_path_or_name
171
163
  else
172
164
  # check for builtin manifests
173
165
  manifests = installed_template_manifests
@@ -179,7 +171,7 @@ class Gen
179
171
  exit 2
180
172
  end
181
173
 
182
- manifest = Pakman::Manifest.load_file( logger, matches[0][1] )
174
+ manifestsrc = matches[0][1]
183
175
  end
184
176
 
185
177
 
@@ -254,44 +246,12 @@ class Gen
254
246
  end
255
247
 
256
248
 
257
- ###
258
- ## fix: move code into Pakman::Gen/Generator or Templater
259
249
 
260
- #### fix/todo:
261
- ##
262
- ## check for .erb file extension for trigger for erb processing
263
-
264
- manifest.each do |entry|
265
- outname = entry[0]
266
- if outname.include? '__file__' # process
267
- outname = outname.gsub( '__file__', basename )
268
- puts "Preparing #{outname}..."
269
-
270
- out = File.new( with_output_path( outname, outpath ), "w+" )
271
-
272
- out << render_template( load_template( entry[1] ), binding )
273
-
274
- if entry.size > 2 # more than one source file? assume header and footer with content added inbetween
275
- out << content2
276
- out << render_template( load_template( entry[2] ), binding )
277
- end
250
+ pakpath = opts.output_path
278
251
 
279
- out.flush
280
- out.close
281
-
282
- else # just copy verbatim if target/dest has no __file__ in name
283
- dest = entry[0]
284
- source = entry[1]
285
-
286
- #### fix/todo:
287
- ##
288
- ## check for .erb file extension for trigger for erb processing
289
-
290
- puts "Copying to #{dest} from #{source}..."
291
- FileUtils.copy( source, with_output_path( dest, outpath ) )
292
- end
293
- end
294
-
252
+ logger.debug( "manifestsrc=>#{manifestsrc}<, pakpath=>#{pakpath}<" )
253
+
254
+ Pakman::Templater.new( logger ).copy_pak( manifestsrc, pakpath, binding, basename, content )
295
255
 
296
256
  ## pop/restore working folder/dir
297
257
  unless newcwd == oldcwd
@@ -14,21 +14,20 @@ class GenTemplates
14
14
  attr_reader :logger, :opts, :config
15
15
 
16
16
  def run
17
- manifest_name = opts.manifest.gsub( '.txt', '' ) # remove (optional) .txt ending
17
+ manifest_name = opts.manifest
18
+ manifest_name = manifest_name.downcase.gsub( '.txt', '' ) # remove (optional) .txt ending
18
19
  logger.debug "manifest=#{manifest_name}"
19
20
 
20
- manifests = installed_generator_manifests
21
-
22
21
  # check for builtin generator manifests
23
- matches = manifests.select { |m| m[0] == manifest_name+'.txt.gen' }
22
+ manifests = installed_generator_manifests.select { |m| m[0] == manifest_name+'.txt.gen' }
24
23
 
25
- if matches.empty?
26
- puts "*** error: unknown template manifest '#{manifest_name}'"
24
+ if manifests.empty?
25
+ puts "*** error: unknown generator template pack '#{manifest_name}'"
27
26
  # todo: list installed manifests
28
27
  exit 2
29
28
  end
30
29
 
31
- manifestsrc = matches[0][1]
30
+ manifestsrc = manifests[0][1]
32
31
  pakpath = opts.output_path
33
32
 
34
33
  logger.debug( "manifestsrc=>#{manifestsrc}<, pakpath=>#{pakpath}<" )
@@ -1,3 +1,3 @@
1
1
  module Slideshow
2
- VERSION = '1.2.0.beta4'
2
+ VERSION = '1.2.0.beta5'
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideshow
3
3
  version: !ruby/object:Gem::Version
4
- hash: 811109185
4
+ hash: -507730549
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
9
  - 0
10
10
  - beta
11
- - 4
12
- version: 1.2.0.beta4
11
+ - 5
12
+ version: 1.2.0.beta5
13
13
  platform: ruby
14
14
  authors:
15
15
  - Gerald Bauer
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-06-19 00:00:00 Z
20
+ date: 2012-06-20 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: RedCloth
@@ -91,12 +91,12 @@ dependencies:
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- hash: 23
94
+ hash: 19
95
95
  segments:
96
96
  - 0
97
- - 2
97
+ - 3
98
98
  - 0
99
- version: 0.2.0
99
+ version: 0.3.0
100
100
  type: :runtime
101
101
  version_requirements: *id005
102
102
  - !ruby/object:Gem::Dependency