scms 1.9.3 → 1.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d87cf0e9c7ace8edfe9ab7b3b29efe5190b3949
4
- data.tar.gz: 8154a52768916c8c0dea448fa7026f8ed9d13677
3
+ metadata.gz: 0d13e89ab65773ba3b85c1bbf9fdd3336faf0535
4
+ data.tar.gz: 9cd9682ef55ce720cd9d3d3d79330d26a475e665
5
5
  SHA512:
6
- metadata.gz: f412b3720d06c6ed7454a28221b6ca54f88a87f7a23e0e8db79423f699c0dbcdf33139c31dc50919100faeefb2cc2654763b7de87dba8b1c8a368906c21ffca1
7
- data.tar.gz: f1792b97b4980811586dddbeae6c890aed9197d14e427297a54a1976babeca11724cd712813ac7c3823cba555824dd343f23da33d0119fa6950861753b2896cb
6
+ metadata.gz: cde4753adbc84538ffa0fd7cb1d41e079c16a488adbfec7693813104f11fd1a77f450dc32f87221c10117d12b40f31c7989196da9431ac5e3ec6437d292de4a8
7
+ data.tar.gz: 213efe391c2e75b4e22b2a100974170ce452b7dae4cb901f7ca29f10861aa628221678e7c930e1f985ddac273ebea0e244c0247561b3fe93c8de6175f5bd8870
@@ -12,13 +12,11 @@ pages:
12
12
  intro: _views/about-intro.html
13
13
  main: _views/about-main.html
14
14
 
15
- scripts:
15
+ bundles:
16
16
  - script:
17
17
  generate: scripts/bootstrap.min-v2.1.1.js
18
18
  bundle:
19
19
  - scripts/bootstrap.js
20
-
21
- stylesheets:
22
20
  - style:
23
21
  generate: stylesheets/style-1.0.css
24
22
  bundle:
data/build commands.txt CHANGED
@@ -1,3 +1,3 @@
1
1
  rake install
2
2
  gem build Scms.gemspec
3
- gem push .\pkg\Scms-1.7.9.gem
3
+ gem push scms-1.7.9.gem
data/lib/scms.rb CHANGED
@@ -72,10 +72,11 @@ module Scms
72
72
  end
73
73
 
74
74
  #Bundle resources
75
- scripts = Scms.bundlescripts($settings["scripts"])
76
- stylesheets = Scms.bundlestylesheets($settings["stylesheets"])
75
+ scripts = Scms.bundle($settings["scripts"])
76
+ stylesheets = Scms.bundle($settings["stylesheets"])
77
+ bundles = Scms.bundle($settings["bundles"])
77
78
  #Generate pages
78
- Scms.parsepages(scripts, stylesheets)
79
+ Scms.parsepages(scripts, stylesheets, bundles)
79
80
  else
80
81
  ScmsUtils.errLog("Config is empty")
81
82
  end
@@ -101,7 +102,7 @@ module Scms
101
102
  return @pub
102
103
  end
103
104
 
104
- def Scms.parsepages(scripts, stylesheets)
105
+ def Scms.parsepages(scripts, stylesheets, bundles)
105
106
  # build views from templates
106
107
  @template = $settings["template"]
107
108
  if $settings["pages"] != nil
@@ -206,6 +207,7 @@ module Scms
206
207
  :config => pageconfig,
207
208
  :scripts => scripts,
208
209
  :stylesheets => stylesheets,
210
+ :bundles => bundles,
209
211
  :sitedir => $website,
210
212
  :monkeyhook => monkeyhook
211
213
  }
@@ -228,23 +230,23 @@ module Scms
228
230
  end
229
231
  end
230
232
 
231
- def Scms.bundlescripts(scriptsConfig)
233
+ def Scms.bundle(bundleConfig)
232
234
  scripts = Hash.new
233
- if scriptsConfig != nil
234
- ScmsUtils.log("Bundeling Scripts:")
235
- scriptsConfig.each do |script|
236
- #ScmsUtils.log( "script (#{script.class}) = #{script}" )
237
- script.each do |option|
235
+ if bundleConfig != nil
236
+ ScmsUtils.log("Bundeling:")
237
+ bundleConfig.each do |bundle|
238
+ #ScmsUtils.log( "bundle (#{bundle.class}) = #{bundle}" )
239
+ bundle.each do |option|
238
240
  name = option[0]
239
241
  if option[1]["version"] != nil
240
- scriptversion = option[1]["version"]
242
+ bundleVersion = option[1]["version"]
241
243
  else
242
- scriptversion = 1
244
+ bundleVersion = 1
243
245
  end
244
- scriptname = File.join("scripts", "#{name}-v#{scriptversion}.js") #Legasy name filename from root and version
245
- scriptname = File.join(option[1]["generate"]) if option[1]["generate"] != nil #just use the generate
246
- scripts[name] = scriptname
247
- ScmsUtils.successLog("#{scriptname}")
246
+ bundleName = File.join("scripts", "#{name}-v#{bundleVersion}.js") #Legasy name filename from root and version
247
+ bundleName = File.join(option[1]["generate"]) if option[1]["generate"] != nil #just use the generate
248
+ scripts[name] = bundleName
249
+ ScmsUtils.successLog("#{bundleName}")
248
250
 
249
251
  content = ""
250
252
  assetList = ""
@@ -260,57 +262,16 @@ module Scms
260
262
  end
261
263
  ScmsUtils.log("#{assetList}")
262
264
 
263
- scriptsdir = File.dirname(scriptname)
264
- Dir.mkdir(scriptsdir, 755) unless File::directory?(scriptsdir)
265
- File.open(scriptname, 'w') {|f| f.write(content) }
266
- Scms.packr(scriptname) unless /(-min)|(\.min)/.match(scriptname)
265
+ bundleDir = File.dirname(bundleName)
266
+ Dir.mkdir(bundleDir, 755) unless File::directory?(bundleDir)
267
+ File.open(bundleName, 'w') {|f| f.write(content) }
268
+ Scms.packr(bundleName) unless /(-min)|(\.min)/.match(bundleName)
267
269
  end
268
270
  end
269
271
  end
270
272
  return scripts
271
273
  end
272
274
 
273
- def Scms.bundlestylesheets(styleConfig)
274
- stylesheets = Hash.new
275
- if styleConfig != nil
276
- ScmsUtils.log("Bundeling Stylesheets:")
277
- styleConfig.each do |stylesheet|
278
- #ScmsUtils.log( "stylesheet (#{stylesheet.class}) = #{stylesheet}" )
279
- stylesheet.each do |option|
280
- name = option[0]
281
- if option[1]["version"] != nil
282
- stylesheetversion = option[1]["version"]
283
- else
284
- stylesheetversion = 1
285
- end
286
- stylesheetname = File.join("stylesheets", "#{name}-v#{stylesheetversion}.css") #Legasy name filename from root and version
287
- stylesheetname = File.join(option[1]["generate"]) if option[1]["generate"] != nil #just use the generate
288
- stylesheets[name] = stylesheetname
289
- ScmsUtils.successLog("#{stylesheetname}")
290
-
291
- content = ""
292
- bundle = option[1]["bundle"]
293
- assetList = ""
294
- bundle.each do |asset|
295
- assetList += "\t #{asset}\n"
296
- assetname = File.join(@source, asset)
297
- if File::exists?(assetname)
298
- content = content + "\n" + File.read(assetname)
299
- else
300
- ScmsUtils.errLog( "Error: No such file #{assetname}" )
301
- end
302
- end
303
- ScmsUtils.log( "#{assetList}" )
304
-
305
- stylesheetdir = File.dirname(stylesheetname)
306
- Dir.mkdir(stylesheetdir, 755) unless File::directory?(stylesheetdir)
307
- File.open(stylesheetname, 'w') {|f| f.write(content) }
308
- end
309
- end
310
- end
311
- return stylesheets
312
- end
313
-
314
275
  def Scms.parsetemplate(template, hash)
315
276
  data = OpenStruct.new(hash)
316
277
  result = ""
@@ -357,22 +318,6 @@ module Scms
357
318
  FileUtils.mkdir_p(pub) unless File.exist? pub
358
319
  FileUtils.chmod 0755, pub
359
320
  end
360
-
361
- def Scms.crunch(crunchDir)
362
- ScmsUtils.log( "Starting crunching CSS and JavaScript in:\n#{crunchDir}\n\n" )
363
- #Scms.sassall(crunchDir)
364
- Dir.chdir(crunchDir) do
365
- Dir.glob("**/*.js").reject{|f| /-min/.match(f) != nil || /\.min/.match(f) != nil || /\.pack/.match(f) != nil }.each do |asset|
366
- Scms.packr(asset)
367
- end
368
- #Dir.glob("**/*.{css, js}").each do |asset|
369
- # #fullFileName = File.basename(asset)
370
- # #ScmsUtils.log( "Crunching #{fullFileName}" )
371
- # ext = File.extname(asset)
372
- # Scms.yuicompress(asset, ext)
373
- #end
374
- end
375
- end
376
321
 
377
322
  def Scms.sassall(crunchDir)
378
323
  ScmsUtils.log("Minimising Sass Files (.scss)")
@@ -416,7 +361,33 @@ module Scms
416
361
  end
417
362
  end
418
363
  end
419
-
364
+
365
+ def Scms.deploy(pub, config)
366
+ yamlpath=File.join(config, "_s3config.yml")
367
+ if File.exists?(yamlpath)
368
+ S3Deploy.sync(pub, config)
369
+ else
370
+ raise "The following file doesn't exist #{yamlpath}"
371
+ end
372
+ end
373
+
374
+ def Scms.Upgrade()
375
+ File.rename("config.yml", "_config.yml") if File.exists? File.join($website, "config.yml")
376
+ File.rename("s3config.yml", "_s3config.yml") if File.exists? File.join($website, "s3config.yml")
377
+ end
378
+
379
+ def Scms.crunch(crunchDir)
380
+ ScmsUtils.log( "Starting crunching CSS and JavaScript in:\n#{crunchDir}\n\n" )
381
+ Dir.chdir(crunchDir) do
382
+ Dir.glob("**/*.{css, js}").each do |asset|
383
+ #fullFileName = File.basename(asset)
384
+ #ScmsUtils.log( "Crunching #{fullFileName}" )
385
+ ext = File.extname(asset)
386
+ Scms.yuicompress(asset, ext)
387
+ end
388
+ end
389
+ end
390
+
420
391
  def Scms.yuicompress(asset, ext)
421
392
  if File.exists?(asset)
422
393
  #ScmsUtils.log( " Encoding: #{asset.encoding}" )
@@ -434,18 +405,4 @@ module Scms
434
405
  ScmsUtils.errLog( "#{asset} does not exist" )
435
406
  end
436
407
  end
437
-
438
- def Scms.deploy(pub, config)
439
- yamlpath=File.join(config, "_s3config.yml")
440
- if File.exists?(yamlpath)
441
- S3Deploy.sync(pub, config)
442
- else
443
- raise "The following file doesn't exist #{yamlpath}"
444
- end
445
- end
446
-
447
- def Scms.Upgrade()
448
- File.rename("config.yml", "_config.yml") if File.exists? File.join($website, "config.yml")
449
- File.rename("s3config.yml", "_s3config.yml") if File.exists? File.join($website, "s3config.yml")
450
- end
451
408
  end
data/lib/scms/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scms
2
- VERSION = "1.9.3"
2
+ VERSION = "1.9.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.3
4
+ version: 1.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Courtenay Probert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-09 00:00:00.000000000 Z
11
+ date: 2013-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cprobert-s3sync