scms 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70608f5a221d75ec349c88c30463deeeeefd9e10
4
- data.tar.gz: c46321dd2211f5e27eef6454e5eeb6a530a9f162
3
+ metadata.gz: d4d890650bc4b0a2fb20e609ec9e71bcb22f318f
4
+ data.tar.gz: 246fa4d2b29c5480c9fa1e886f8077fc1c94a70d
5
5
  SHA512:
6
- metadata.gz: 01098df78d1d4d17597a906d9b6fa524492a0db4183fbd77d6979f8abe3a2e46396bc200397271342906521758a477cec9439efe07866f2da934481638ae7bc1
7
- data.tar.gz: 1e9a3e49f51ba43823c0d1009d243f392640b9de128ae2ff880478649d5b7fa447a16730186710fbb5f73f7650464466f04dea84489d95f8f977543b9a35f3bc
6
+ metadata.gz: d8174103d4c85d19fe0a2febc793e4484d8196ab08b1f7a1901776b8e08a3e406c4798e735983606dd44e5e36bdf0f9a3c3a8a34976851905871c389db02b44a
7
+ data.tar.gz: 0367a45b24d39f7a11073caaf278d5b243cff1cc695945b3eeaaa7a8dd108c3d0b0acd6c0fd374153488cb064f396df75e8fc14815324d996316c815e0dfb423
data/bin/scms CHANGED
@@ -95,4 +95,5 @@ raise "No website in folder #{Folders[:website]}" if !File::directory?(Folders[:
95
95
  Scms.upgrade(Folders[:website])
96
96
  Scms.build(Folders[:website], Folders[:pub], Folders[:config], options[:mode])
97
97
  Scms.copywebsite(Folders[:website], Folders[:pub]) if Folders[:pub] != nil
98
- Scms.deploy(Folders[:website], Folders[:config]) if options[:action] == "deploy"
98
+ mimetypefile = File.join(Folders[:root], "assets", "mime.types")
99
+ S3Deploy.sync(Folders[:website], Folders[:config], mimetypefile) if options[:action] == "deploy"
data/lib/scms.rb CHANGED
@@ -192,11 +192,16 @@ module Scms
192
192
  if File.exists?(erb) && out != nil
193
193
  pubsubdir = File.dirname(out)
194
194
  Dir.mkdir(pubsubdir, 755) unless File::directory?(pubsubdir)
195
- html = Scms.parsetemplate(File.read(erb), pagemodel)
195
+
196
+ erbtemplate = File.read(erb)
197
+ erbtemplate = erbtemplate.gsub('data.','page.')#lagasy fix
198
+ File.open(erb, 'w') {|f| f.write(erbtemplate) }#lagasy fix
199
+
200
+ html = Scms.parsetemplate(erbtemplate, pagemodel)
196
201
 
197
202
  html = html.gsub('~/', ScmsUtils.uriEncode("file:///#{@website}/")) if @mode == "cms"
198
- websiteroot = ''
199
- websiteroot = @settings["url"] unless @settings["url"] == nil
203
+ websiteroot = '/'
204
+ websiteroot = @settings["url"] unless @settings["rooturl"] == nil
200
205
 
201
206
  html = html.gsub('~/', websiteroot)
202
207
 
@@ -210,9 +215,6 @@ module Scms
210
215
  end
211
216
 
212
217
  def Scms.parsetemplate(template, hash)
213
- #lagasy fix
214
- template = template.gsub('data.','page.')
215
-
216
218
  page = OpenStruct.new(hash)
217
219
  result = ""
218
220
 
@@ -309,15 +311,6 @@ module Scms
309
311
  end
310
312
  end
311
313
 
312
- def Scms.deploy(website, config)
313
- yamlpath=File.join(config, "_s3config.yml")
314
- if File.exists?(yamlpath)
315
- S3Deploy.sync(website, config)
316
- else
317
- raise "The following file doesn't exist #{yamlpath}"
318
- end
319
- end
320
-
321
314
  def Scms.copywebsite(website, pub)
322
315
  if pub != nil
323
316
  FileUtils.mkdir pub unless Dir.exists? pub
data/lib/scms/s3deploy.rb CHANGED
@@ -2,18 +2,19 @@ module S3Deploy
2
2
  VERSION = '1.0.0'
3
3
  require "scms/scms-utils.rb"
4
4
 
5
- def S3Deploy.sync(pub, config)
6
- yamlpath=File.join(config, "_config.yml")
7
- settings = ScmsUtils.getsettings(yamlpath)
5
+ def S3Deploy.sync(pub, config, mimetypefile)
6
+ #yamlpath=File.join(config, "_config.yml")
7
+ #scmsSettings = ScmsUtils.getsettings(yamlpath)
8
8
 
9
- ScmsUtils.log( "Syncing with Amazon S3: #{settings['bucket']}" )
10
- @pub = pub
11
9
  ENV["S3CONF"] = config
12
10
  ENV["AWS_CALLING_FORMAT"] = "SUBDOMAIN"
13
- ENV["S3SYNC_MIME_TYPES_FILE"] = File.join(Folders[:root], "assets", "mime.types")
11
+ ENV["S3SYNC_MIME_TYPES_FILE"] = mimetypefile
12
+ puts "S3SYNC_MIME_TYPES_FILE: #{ENV["S3SYNC_MIME_TYPES_FILE"] }"
14
13
 
15
- yamlpath=File.join(config, "_s3config.yml")
16
- settings = YAML.load_file(yamlpath)
14
+ s3yamlpath=File.join(config, "_s3config.yml")
15
+ settings = YAML.load_file(s3yamlpath)
16
+ throw "No bucket defined in _s3config.yml settings file" if settings['bucket'] == nil
17
+ ScmsUtils.log( "Syncing with Amazon S3: #{settings['bucket']}" )
17
18
 
18
19
  removeold = "--delete"
19
20
  if settings['clean'] != nil
@@ -31,10 +32,10 @@ module S3Deploy
31
32
  params = "#{removeold} --exclude=\"#{exclude}\" --progress --make-dirs --recursive"
32
33
 
33
34
  #First deploy private directories
34
- Dir.glob("#{@pub}/_*/").each do |f|
35
+ Dir.glob("#{pub}/_*/").each do |f|
35
36
  privatedir = File.basename(f)
36
37
  ScmsUtils.log( "Backing up #{privatedir} (private)" )
37
- privateparams = "#{params} \"#{@pub}/#{privatedir}/\" #{settings['bucket']}:#{privatedir}/"
38
+ privateparams = "#{params} \"#{pub}/#{privatedir}/\" #{settings['bucket']}:#{privatedir}/"
38
39
  ScmsUtils.run(cmd, privateparams)
39
40
  end
40
41
 
@@ -42,13 +43,13 @@ module S3Deploy
42
43
  if settings['cache'] != nil
43
44
  settings['cache'].each do |folder|
44
45
  ScmsUtils.log( "Syncing #{folder}(public: caching: 1 year)" )
45
- cacheparams = "#{params} --public-read --cache-control='max-age=31449600' \"#{@pub}/#{folder}/\" #{settings['bucket']}:#{folder}/"
46
+ cacheparams = "#{params} --public-read --cache-control='max-age=31449600' \"#{pub}/#{folder}/\" #{settings['bucket']}:#{folder}/"
46
47
  ScmsUtils.run(cmd, cacheparams)
47
48
  end
48
49
  end
49
50
 
50
51
  ScmsUtils.log( "Syncing root (public)" )
51
- roorparams = "#{params} --public-read \"#{@pub}/\" #{settings['bucket']}:/"
52
+ roorparams = "#{params} --public-read \"#{pub}/\" #{settings['bucket']}:/"
52
53
  #Finnaly deploy all remaining files (except excludes)
53
54
  ScmsUtils.run(cmd, roorparams)
54
55
  ScmsUtils.successLog("Deployed :)")
data/lib/scms/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scms
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Courtenay Probert