scms 1.7.9 → 1.8.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
- <?xml version="1.0" encoding="ISO-8859-1"?>
2
- <menu>
3
- <page href="index.html">Home</page>
4
- <page href="about.html">About</page>
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <menu>
3
+ <page href="index.html">Home</page>
4
+ <page href="about.html">About</page>
5
5
  </menu>
data/bin/scms CHANGED
@@ -33,12 +33,12 @@ optparse = OptionParser.new do|opts|
33
33
 
34
34
  options[:mode] = "pub"
35
35
  opts.on( '-m', '--mode MODE', 'CMS or Publish' ) do|m|
36
- options[:mode] = m
36
+ options[:mode] = m
37
37
  end
38
38
 
39
39
  options[:html] = "true"
40
40
  opts.on( '-f', '--html HTML', 'true or false' ) do|h|
41
- options[:html] = h
41
+ options[:html] = h
42
42
  end
43
43
 
44
44
  options[:verbose] = false
@@ -53,26 +53,29 @@ optparse = OptionParser.new do|opts|
53
53
  end
54
54
  end
55
55
  optparse.parse!
56
- #Now raise an exception if we have not found a website option
57
- if options[:website].nil?
58
- puts "Please specify a website directory, e.g."
59
- puts "staticcms -w ~/websites/mystaticwebsite"
60
- raise OptionParser::MissingArgument
56
+
57
+ $website = Dir.pwd
58
+ unless options[:website].nil?
59
+ $website = options[:website]
61
60
  end
61
+ puts "Compiling #{$website}"
62
+
63
+ ##Set globals
64
+ $html = (ENV["SCMS_HTML_OUT"] or "false")
62
65
 
63
66
  $stdout.sync = true
64
67
  root_folder = File.expand_path("../", File.dirname(__FILE__))
65
- @pub = File.join("#{options[:website]}/compiled")
68
+ @pub = File.join("#{$website}/_site")
66
69
  unless options[:pub].nil?
67
70
  @pub = options[:pub]
68
71
  end
69
72
 
70
73
  Folders = {
71
74
  :root => root_folder,
72
- :website => File.join(options[:website]),
75
+ :website => File.join($website),
73
76
  :pub => (ENV["SCMS_PUBLISH_FOLDER"] or @pub),
74
77
  :assets => (ENV["SCMS_STATICCMS_FOLDER"] or File.join(root_folder, "assets")),
75
- :config => (ENV["SCMS_CONFIG_FOLDER"] or File.join(options[:website]))
78
+ :config => (ENV["SCMS_CONFIG_FOLDER"] or File.join($website))
76
79
  }
77
80
 
78
81
  if options[:action] == "create"
@@ -111,10 +114,6 @@ raise "No website in folder #{Folders[:website]}" if !File::directory?(Folders[:
111
114
  #puts "Config dir = #{Folders[:config]}"
112
115
  #puts "Mode = #{options[:mode]}"
113
116
 
114
- ##Set globals
115
- $website = Folders[:website]
116
- $html = (ENV["SCMS_HTML_OUT"] or "false")
117
-
118
117
  deployDir = StaticCMS.build(Folders[:pub], Folders[:config], options[:mode])
119
118
 
120
119
  if options[:action] == "crunch"
@@ -124,4 +123,6 @@ end
124
123
  if options[:action] == "deploy"
125
124
  StaticCMS.crunch(deployDir)
126
125
  StaticCMS.deploy(deployDir, Folders[:config])
126
+ backupdir = File.join(Folders[:website], "private")
127
+ S3Deploy.backup(backupdir, Folders[:config]) if File.directory? backupdir
127
128
  end
@@ -0,0 +1,2 @@
1
+ gem build scms.gemspec
2
+ gem push scms-1.7.9.gem
data/lib/scms.rb CHANGED
@@ -17,8 +17,11 @@ module StaticCMS
17
17
  @configdir = config
18
18
  @mode = mode
19
19
  @webroot = "public"
20
+ @source = File.join($website, @webroot)
20
21
 
21
22
  ScmsUtils.log("_Mode: #{mode}_")
23
+
24
+ StaticCMS.sassall(@source)
22
25
 
23
26
  yamlpath=File.join(@configdir, "config.yml")
24
27
  ScmsUtils.log("**[Getting Config](#{ScmsUtils.uriEncode("file:///#{yamlpath}")})**")
@@ -65,8 +68,7 @@ module StaticCMS
65
68
  ScmsUtils.errLog("Config is empty")
66
69
  end
67
70
 
68
- webroot = File.join($website, @webroot)
69
- if File.exists?(webroot)
71
+ if File.exists?(@source)
70
72
  ScmsUtils.log("_Merging 'public' folder_")
71
73
 
72
74
  if @cleanpub
@@ -74,19 +76,18 @@ module StaticCMS
74
76
  end
75
77
 
76
78
  FileUtils.mkdir @pub unless Dir.exists? @pub
77
- Dir.chdir(webroot) do
79
+ Dir.chdir(@source) do
78
80
  #files = Dir.glob('*')
79
81
  #FileUtils.cp_r files, @pub
80
82
 
81
83
  Dir.glob("**/*").reject{|f| f['.svn']}.each do |oldfile|
82
- newfile = File.join(@pub, oldfile.sub(webroot, ''))
84
+ newfile = File.join(@pub, oldfile.sub(@source, ''))
83
85
  #puts newfile
84
86
  File.file?(oldfile) ? FileUtils.copy(oldfile, newfile) : FileUtils.mkdir(newfile) unless File.exist? newfile
85
87
  end
86
88
  end
87
- StaticCMS.sassall(@pub)
88
89
  else
89
- ScmsUtils.log("**No 'public' folder in #{$webroot} - skiping merge**")
90
+ ScmsUtils.log("**No 'public' folder in #{@source} - skiping merge**")
90
91
  end
91
92
 
92
93
  ScmsUtils.successLog("**Compiled :)**")
@@ -239,7 +240,7 @@ module StaticCMS
239
240
  bundle = option[1]["bundle"]
240
241
  bundle.each do |asset|
241
242
  assetList += "\t#{asset}\n"
242
- assetname = File.join($website, @webroot, asset)
243
+ assetname = File.join(@source, asset)
243
244
  if File::exists?(assetname)
244
245
  content = content + "\n" + File.read(assetname)
245
246
  else
@@ -281,7 +282,7 @@ module StaticCMS
281
282
  assetList = ""
282
283
  bundle.each do |asset|
283
284
  assetList += "\t #{asset}\n"
284
- assetname = File.join($website, @webroot, asset)
285
+ assetname = File.join(@source, asset)
285
286
  if File::exists?(assetname)
286
287
  content = content + "\n" + File.read(assetname)
287
288
  else
@@ -362,6 +363,7 @@ module StaticCMS
362
363
  end
363
364
 
364
365
  def StaticCMS.sassall(crunchDir)
366
+ ScmsUtils.log( "**Minimising Sass Files (.scss) **" )
365
367
  Dir.chdir(crunchDir) do
366
368
  Dir.glob("**/*.{scss}").each do |asset|
367
369
  StaticCMS.sass(asset)
@@ -379,8 +381,9 @@ module StaticCMS
379
381
  :syntax => :scss
380
382
  }.freeze)
381
383
  output = sass_engine.to_css
382
- File.open(asset, 'w') { |file| file.write(output) }
383
- ScmsUtils.log( "_Sassed #{File.basename(asset)}_" )
384
+ css_file = "#{File.dirname(asset)}/#{File.basename(asset,'.*')}.css"
385
+ File.open(css_file, 'w') { |file| file.write(output) }
386
+ ScmsUtils.log( "_Sassed: #{css_file}_" )
384
387
  rescue Exception => e
385
388
  ScmsUtils.errLog( "Error processing: #{asset}" )
386
389
  ScmsUtils.errLog( e.message )
data/lib/scms/s3deploy.rb CHANGED
@@ -1,45 +1,64 @@
1
- module S3Deploy
2
- VERSION = '1.0.0'
3
- require "scms/scms_utils.rb"
4
-
5
- def S3Deploy.sync(pub, config)
6
- @pub = pub
7
- ENV["S3CONF"] = config
8
- ENV["AWS_CALLING_FORMAT"] = "SUBDOMAIN"
9
- #ENV["SSL_CERT_DIR"] = File.join($website, "s3certs")
10
- ENV["S3SYNC_MIME_TYPES_FILE"] = File.join(Folders[:root], "assets", "mime.types")
11
-
12
- yamlpath=File.join(config, "s3config.yml")
13
- #ScmsUtils.log( "Getting s3sync settings: \n#{yamlpath}\n\n")
14
- $settings = YAML.load_file(yamlpath)
15
-
16
- ScmsUtils.log( "Syncing with Amazon S3: **#{$settings['bucket']}**" )
17
-
18
- removeold = "--delete"
19
- if $settings['clean'] != nil
20
- unless $settings['clean']
21
- removeold = ""
22
- end
23
- end
24
-
25
- cmd = "s3sync"
26
- cache = "--cache-control='max-age=31449600'"
27
- params = "--exclude='.svn' --progress --make-dirs --recursive --public-read #{removeold} #{cache} \"#{@pub}/\" #{$settings['bucket']}:/"
28
- if $settings['cache'] != nil
29
- $settings['cache'].each do |folder|
30
- ScmsUtils.log( "Syncing **#{folder}** caching: 1 year" )
31
- ScmsUtils.run(cmd, params)
32
- end
33
- end
34
-
35
- cache = ""
36
- ScmsUtils.log( "Syncing **root** no caching" )
37
- ScmsUtils.run(cmd, params)
38
-
39
- ScmsUtils.successLog("**Deployed :)**")
40
-
41
- if $settings['uri'] != nil
42
- ScmsUtils.log("[_#{$settings['uri']}_](#{$settings['uri']})")
43
- end
44
- end
1
+ module S3Deploy
2
+ VERSION = '1.0.0'
3
+ require "scms/scms_utils.rb"
4
+
5
+ def S3Deploy.sync(pub, config)
6
+ @pub = pub
7
+ ENV["S3CONF"] = config
8
+ ENV["AWS_CALLING_FORMAT"] = "SUBDOMAIN"
9
+ ENV["S3SYNC_MIME_TYPES_FILE"] = File.join(Folders[:root], "assets", "mime.types")
10
+
11
+ yamlpath=File.join(config, "s3config.yml")
12
+ $settings = YAML.load_file(yamlpath)
13
+
14
+ ScmsUtils.log( "Syncing with Amazon S3: **#{$settings['bucket']}**" )
15
+
16
+ removeold = "--delete"
17
+ if $settings['clean'] != nil
18
+ unless $settings['clean']
19
+ removeold = ""
20
+ end
21
+ end
22
+
23
+ cmd = "s3sync"
24
+ params = "--exclude='.svn' --progress --make-dirs --recursive --public-read #{removeold}"
25
+
26
+ if $settings['cache'] != nil
27
+ $settings['cache'].each do |folder|
28
+ ScmsUtils.log( "Syncing **#{folder}** caching: 1 year" )
29
+ cacheparams = "#{params} --cache-control='max-age=31449600' \"#{@pub}/#{folder}/\" #{$settings['bucket']}:#{folder}/"
30
+ ScmsUtils.run(cmd, cacheparams)
31
+ end
32
+ end
33
+
34
+ ScmsUtils.log( "Syncing **root** no caching" )
35
+ roorparams = "#{params} \"#{@pub}/\" #{$settings['bucket']}:/"
36
+ ScmsUtils.run(cmd, roorparams)
37
+ ScmsUtils.successLog("**Deployed :)**")
38
+
39
+ if $settings['uri'] != nil
40
+ ScmsUtils.log("[_#{$settings['uri']}_](#{$settings['uri']})")
41
+ end
42
+ end
43
+
44
+ def S3Deploy.backup(privatedir, config)
45
+ ENV["S3CONF"] = config
46
+ ENV["AWS_CALLING_FORMAT"] = "SUBDOMAIN"
47
+ ENV["S3SYNC_MIME_TYPES_FILE"] = File.join(Folders[:root], "assets", "mime.types")
48
+
49
+ yamlpath=File.join(config, "s3config.yml")
50
+ $settings = YAML.load_file(yamlpath)
51
+
52
+ ScmsUtils.log( "Backing up to Amazon S3: **#{$settings['bucket']}**" )
53
+ cmd = "s3sync"
54
+ removeold = "--delete"
55
+ if $settings['clean'] != nil
56
+ unless $settings['clean']
57
+ removeold = ""
58
+ end
59
+ end
60
+ params = "--exclude='.svn' --progress --make-dirs --recursive #{removeold} \"#{privatedir}/\" #{$settings['bucket']}:private/"
61
+ ScmsUtils.run(cmd, params)
62
+ ScmsUtils.successLog("** Done :) **")
63
+ end
45
64
  end
data/lib/scms/version.rb CHANGED
@@ -1,3 +1,3 @@
1
- module StaticCMS
2
- VERSION = '1.7.9'
3
- end
1
+ module StaticCMS
2
+ VERSION = '1.8.6'
3
+ end
data/scms.gemspec CHANGED
@@ -1,24 +1,24 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- $:.push File.expand_path("../lib", __FILE__)
4
- require 'scms/version'
5
-
6
- Gem::Specification.new do |s|
7
- s.name = 'scms'
8
- s.version = StaticCMS::VERSION
9
- s.date = '2013-06-29'
10
- s.homepage = 'https://github.com/cprobert/Static-CMS'
11
- s.summary = "Create simple static websites, in a jiffy"
12
- s.description = "A gem for creating static html websites"
13
- s.authors = ["Courtenay Probert"]
14
- s.email = 'courtenay@probert.me.uk'
15
- s.files = Dir.glob("**/*")
16
-
17
- s.add_dependency "aproxacs-s3sync"
18
- s.add_dependency "nokogiri"
19
- s.add_dependency "maruku"
20
- s.add_dependency "sass"
21
- s.add_dependency "packr"
22
-
23
- s.executables << 'scms'
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ $:.push File.expand_path("../lib", __FILE__)
4
+ require 'scms/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'scms'
8
+ s.version = StaticCMS::VERSION
9
+ s.date = '2013-06-29'
10
+ s.homepage = 'http://cprobert.github.io/Static-CMS/'
11
+ s.summary = "Create simple static websites, in a jiffy"
12
+ s.description = "A gem for creating static html websites"
13
+ s.authors = ["Courtenay Probert"]
14
+ s.email = 'courtenay@probert.me.uk'
15
+ s.files = Dir.glob("**/*")
16
+
17
+ s.add_dependency "aproxacs-s3sync"
18
+ s.add_dependency "nokogiri"
19
+ s.add_dependency "maruku"
20
+ s.add_dependency "sass"
21
+ s.add_dependency "packr"
22
+
23
+ s.executables << 'scms'
24
24
  end
@@ -1,8 +1,8 @@
1
- {
2
- "folders":
3
- [
4
- {
5
- "path": "/I/Code/GitHub/Static-CMS"
6
- }
7
- ]
8
- }
1
+ {
2
+ "folders":
3
+ [
4
+ {
5
+ "path": "/I/Code/GitHub/Static-CMS"
6
+ }
7
+ ]
8
+ }
@@ -111,6 +111,30 @@
111
111
  },
112
112
  "buffers":
113
113
  [
114
+ {
115
+ "file": "bin/scms",
116
+ "settings":
117
+ {
118
+ "buffer_size": 3766,
119
+ "line_ending": "Windows"
120
+ }
121
+ },
122
+ {
123
+ "file": "/C/Users/cprobert/AppData/Local/Temp/scmsDeploy.rb-rev50.svn000.tmp.rb",
124
+ "settings":
125
+ {
126
+ "buffer_size": 1860,
127
+ "line_ending": "Unix"
128
+ }
129
+ },
130
+ {
131
+ "file": "lib/scms/s3deploy.rb",
132
+ "settings":
133
+ {
134
+ "buffer_size": 2329,
135
+ "line_ending": "Windows"
136
+ }
137
+ }
114
138
  ],
115
139
  "build_system": "",
116
140
  "command_palette":
@@ -136,11 +160,19 @@
136
160
  },
137
161
  "file_history":
138
162
  [
139
- "/I/Code/GitHub/Static-CMS/lib/scms.rb",
140
- "/I/Code/GitHub/Static-CMS/bin/scms",
163
+ "/C/Users/cprobert/AppData/Local/Temp/scmsDeploy.rb-rev150.svn000.tmp.rb",
164
+ "/C/Users/cprobert/AppData/Local/Temp/scmsDeploy.rb-rev250.svn000.tmp.rb",
141
165
  "/I/Code/GitHub/Static-CMS/lib/scms/s3deploy.rb",
142
- "/I/Code/GitHub/Static-CMS/lib/scms/version.rb",
166
+ "/I/Code/GitHub/Static-CMS/bin/scms.rb",
167
+ "/I/Code/GitHub/Static-CMS/bin/scms",
168
+ "/I/Code/GitHub/Static-CMS/build commands.txt",
169
+ "/I/Code/GitHub/Static-CMS/staticcms.sublime-workspace",
170
+ "/I/Code/GitHub/Static-CMS/lib/scms.rb",
171
+ "/I/Code/GitHub/Static-CMS/assets/blank-app-template/application.xml",
172
+ "/I/Code/GitHub/Static-CMS/assets/blank-app-template/package.cmd",
173
+ "/I/Code/GitHub/Static-CMS/README.md",
143
174
  "/I/Code/GitHub/Static-CMS/scms.gemspec",
175
+ "/I/Code/GitHub/Static-CMS/lib/scms/version.rb",
144
176
  "/I/Code/GitHub/Static-CMS/lib/staticcms/ScmsUtils.rb",
145
177
  "/I/Code/GitHub/Static-CMS/lib/staticcms/ScmsDeploy.rb",
146
178
  "/I/Code/GitHub/Static-CMS/staticcms.gemspec",
@@ -197,7 +229,7 @@
197
229
  },
198
230
  "find_in_files":
199
231
  {
200
- "height": 0.0,
232
+ "height": 90.0,
201
233
  "where_history":
202
234
  [
203
235
  "I:\\Code\\GitHub\\Static-CMS",
@@ -211,6 +243,9 @@
211
243
  "case_sensitive": false,
212
244
  "find_history":
213
245
  [
246
+ "S3Deploy.backup",
247
+ "Folders[:website]",
248
+ "compiled",
214
249
  "Loading config",
215
250
  "Loading config:",
216
251
  "@configdir",
@@ -335,9 +370,7 @@
335
370
  "app.data(\"firstRun\"",
336
371
  "app.updateGems",
337
372
  "prefs.firstRun",
338
- "installUpdate",
339
- "onUpdateInstall",
340
- "$.publish"
373
+ "installUpdate"
341
374
  ],
342
375
  "highlight": true,
343
376
  "in_selection": false,
@@ -379,8 +412,87 @@
379
412
  "groups":
380
413
  [
381
414
  {
415
+ "selected": 0,
382
416
  "sheets":
383
417
  [
418
+ {
419
+ "buffer": 0,
420
+ "file": "bin/scms",
421
+ "settings":
422
+ {
423
+ "buffer_size": 3766,
424
+ "regions":
425
+ {
426
+ },
427
+ "selection":
428
+ [
429
+ [
430
+ 0,
431
+ 3766
432
+ ]
433
+ ],
434
+ "settings":
435
+ {
436
+ "syntax": "Packages/Ruby/Ruby.tmLanguage"
437
+ },
438
+ "translation.x": 0.0,
439
+ "translation.y": 1655.0,
440
+ "zoom_level": 1.0
441
+ },
442
+ "type": "text"
443
+ },
444
+ {
445
+ "buffer": 1,
446
+ "file": "/C/Users/cprobert/AppData/Local/Temp/scmsDeploy.rb-rev50.svn000.tmp.rb",
447
+ "settings":
448
+ {
449
+ "buffer_size": 1860,
450
+ "regions":
451
+ {
452
+ },
453
+ "selection":
454
+ [
455
+ [
456
+ 934,
457
+ 991
458
+ ]
459
+ ],
460
+ "settings":
461
+ {
462
+ "syntax": "Packages/Ruby/Ruby.tmLanguage"
463
+ },
464
+ "translation.x": 0.0,
465
+ "translation.y": 0.0,
466
+ "zoom_level": 1.0
467
+ },
468
+ "type": "text"
469
+ },
470
+ {
471
+ "buffer": 2,
472
+ "file": "lib/scms/s3deploy.rb",
473
+ "settings":
474
+ {
475
+ "buffer_size": 2329,
476
+ "regions":
477
+ {
478
+ },
479
+ "selection":
480
+ [
481
+ [
482
+ 2329,
483
+ 2329
484
+ ]
485
+ ],
486
+ "settings":
487
+ {
488
+ "syntax": "Packages/Ruby/Ruby.tmLanguage"
489
+ },
490
+ "translation.x": 0.0,
491
+ "translation.y": 0.0,
492
+ "zoom_level": 1.0
493
+ },
494
+ "type": "text"
495
+ }
384
496
  ]
385
497
  }
386
498
  ],