scms 2.0.3 → 2.0.5

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: 5f381843ee93fb7c0c758ba3205076e82392b921
4
- data.tar.gz: 6458d3e0809e62af6f6ba24c417f0c88b3d29e1c
3
+ metadata.gz: 609c59402344d9305ba7e76db8552d4806ba317c
4
+ data.tar.gz: 12a2b3db3a156fc520f61ca422e9d6792b1534d4
5
5
  SHA512:
6
- metadata.gz: 39ac479902d10445c3189c93cb0eb0e2267f046a620f41fb849317a9a2172a7a417c2525b339d7d54d75650b02cd432db0e754487af7da5f5023e5dafde1f470
7
- data.tar.gz: db12283f651d7d18c4da2f0b2a74fddddce747549cff8e685f66e39d1ff3357d33beea9534f75b8768755a3d5a6c972d4b3f6894b24571c424c783ac2f224048
6
+ metadata.gz: 535c525277e5930d81705dfbbce442878f54ac80ec2bbe39e722779440a42682f409fa5f48e6fb5982b43527eabf0f29b696109587b8ec5a2f49c84beaadbdea
7
+ data.tar.gz: 3f19d0ef09e134a84015247633634f89a0129e42562ffedb075b6544d68817308718bd07daf7a452509caef24fc9f4cef8a01da3704aabc5dfbd9df8c025fb3d
@@ -1,5 +1,5 @@
1
1
  template: _templates/skin.erb.html # The website skin (erb template)
2
- #url: http://www.mywebsite.com/ #Whats the website root when published - All references in html ~/ will be replaced with this
2
+ #rooturl: http://www.mywebsite.com/ #Whats the website root when published - All references in html ~/ will be replaced with this
3
3
  # Define your pages here
4
4
  pages:
5
5
  - index:
data/bin/scms CHANGED
@@ -11,6 +11,12 @@ require 'optparse'
11
11
  require 'fileutils'
12
12
  require 'Scms'
13
13
 
14
+ class String
15
+ def to_path(end_slash=false)
16
+ "#{'/' if self[0]=='\\'}#{self.split('\\').join('/')}#{'/' if end_slash}"
17
+ end
18
+ end
19
+
14
20
  options = {}
15
21
  optparse = OptionParser.new do|opts|
16
22
  # Set a banner, displayed at the top
@@ -21,6 +27,10 @@ optparse = OptionParser.new do|opts|
21
27
  opts.on('-w', '--website WEBSITE', "Website directory (full path)") do |w|
22
28
  options[:website] = w
23
29
  end
30
+
31
+ opts.on('-c', '--config CONFIGDIR', "Configeration directory if different from Website (full path)") do |c|
32
+ options[:configdir] = c
33
+ end
24
34
 
25
35
  opts.on('-o', '--output BuildDIR', "Website build dir (full path)") do |o|
26
36
  options[:pub] = o
@@ -35,11 +45,6 @@ optparse = OptionParser.new do|opts|
35
45
  opts.on( '-m', '--mode MODE', 'CMS or Publish' ) do|m|
36
46
  options[:mode] = m
37
47
  end
38
-
39
- options[:html] = "true"
40
- opts.on( '-f', '--html HTML', 'true or false' ) do|h|
41
- options[:html] = h
42
- end
43
48
 
44
49
  options[:verbose] = false
45
50
  opts.on( '-v', '--verbose', 'Output more information' ) do
@@ -57,14 +62,14 @@ optparse.parse!
57
62
  #Set globals
58
63
  $stdout.sync = true
59
64
  root_folder = File.expand_path("../", File.dirname(__FILE__))
60
- website = (options[:website].nil?) ? Dir.pwd : options[:website]
65
+ website = ((options[:website].nil?) ? Dir.pwd : options[:website]).to_path
61
66
  $website = website
62
67
  Folders = {
63
68
  :root => root_folder,
64
- :website => File.join(website),
65
- :pub => (ENV["SCMS_PUBLISH_FOLDER"] or options[:pub]),
66
- :assets => File.join(root_folder, "assets"),
67
- :config => (ENV["SCMS_CONFIG_FOLDER"] or File.join(website))
69
+ :website => website,
70
+ :pub => (options[:pub] or ENV["SCMS_PUBLISH_FOLDER"] or '').to_path,
71
+ :config => (options[:configdir] or ENV["SCMS_CONFIG_FOLDER"] or website).to_path,
72
+ :assets => File.join(root_folder, "assets")
68
73
  }
69
74
 
70
75
  if options[:action] == "create"
@@ -93,7 +98,7 @@ end
93
98
 
94
99
  raise "No website in folder #{Folders[:website]}" if !File::directory?(Folders[:website])
95
100
  Scms.upgrade(Folders[:website])
96
- Scms.build(Folders[:website], Folders[:pub], Folders[:config], options[:mode])
101
+ Scms.build(Folders[:website], Folders[:config], options[:mode])
97
102
  Scms.copywebsite(Folders[:website], Folders[:pub]) if Folders[:pub] != nil
98
103
  mimetypefile = File.join(Folders[:root], "assets", "mime.types")
99
104
  S3Deploy.sync(Folders[:website], Folders[:config], mimetypefile) if options[:action] == "deploy"
data/lib/scms.rb CHANGED
@@ -13,7 +13,7 @@ module Scms
13
13
 
14
14
  include YAML
15
15
 
16
- def Scms.build(website, pub, config, mode)
16
+ def Scms.build(website, config, mode)
17
17
  @website = website
18
18
  @mode = mode
19
19
  #ScmsUtils.log("Mode: #{mode}")
@@ -32,7 +32,8 @@ module Scms
32
32
  begin
33
33
  require_relative bootstrap
34
34
  rescue Exception=>e
35
- ScmsUtils.errLog( e )
35
+ ScmsUtils.errLog(e.message)
36
+ ScmsUtils.log(e.backtrace.inspect )
36
37
  end
37
38
  else
38
39
  ScmsUtils.log("Bootstrap does not exist #{bootstrap}")
@@ -319,7 +320,7 @@ module Scms
319
320
  end
320
321
 
321
322
  def Scms.copywebsite(website, pub)
322
- if pub != nil
323
+ if pub.to_s.strip.length != 0
323
324
  FileUtils.mkdir pub unless Dir.exists? pub
324
325
  source = File.join(website)
325
326
  Dir.chdir(source) do
data/lib/scms/s3deploy.rb CHANGED
@@ -9,19 +9,12 @@ module S3Deploy
9
9
  ENV["S3CONF"] = config
10
10
  ENV["AWS_CALLING_FORMAT"] = "SUBDOMAIN"
11
11
  ENV["S3SYNC_MIME_TYPES_FILE"] = mimetypefile
12
- puts "S3SYNC_MIME_TYPES_FILE: #{ENV["S3SYNC_MIME_TYPES_FILE"] }"
12
+ #puts "S3SYNC_MIME_TYPES_FILE: #{ENV["S3SYNC_MIME_TYPES_FILE"] }"
13
13
 
14
14
  s3yamlpath=File.join(config, "_s3config.yml")
15
15
  settings = YAML.load_file(s3yamlpath)
16
16
  throw "No bucket defined in _s3config.yml settings file" if settings['bucket'] == nil
17
17
  ScmsUtils.log( "Syncing with Amazon S3: #{settings['bucket']}" )
18
-
19
- removeold = "--delete"
20
- if settings['clean'] != nil
21
- unless settings['clean']
22
- removeold = ""
23
- end
24
- end
25
18
 
26
19
  exclude = "(\\.svn$)|(^_)"
27
20
  if settings['ignore'] != nil
@@ -29,7 +22,7 @@ module S3Deploy
29
22
  end
30
23
 
31
24
  cmd = "s3sync"
32
- params = "#{removeold} --exclude=\"#{exclude}\" --progress --make-dirs --recursive"
25
+ params = "--exclude=\"#{exclude}\" --progress --make-dirs --recursive"
33
26
 
34
27
  #First deploy private directories
35
28
  Dir.glob("#{pub}/_*/").each do |f|
@@ -49,7 +42,9 @@ module S3Deploy
49
42
  end
50
43
 
51
44
  ScmsUtils.log( "Syncing root (public)" )
52
- roorparams = "#{params} --public-read \"#{pub}/\" #{settings['bucket']}:/"
45
+ removeold = ""
46
+ removeold = "--delete" if settings['clean'].to_s == "true"
47
+ roorparams = "#{removeold} #{params} --public-read \"#{pub}/\" #{settings['bucket']}:/"
53
48
  #Finnaly deploy all remaining files (except excludes)
54
49
  ScmsUtils.run(cmd, roorparams)
55
50
  ScmsUtils.successLog("Deployed :)")
@@ -92,4 +92,5 @@ module ScmsUtils
92
92
  return uri.gsub("%20", " ")
93
93
  end
94
94
 
95
- end
95
+ end
96
+
data/lib/scms/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scms
2
- VERSION = "2.0.3"
2
+ VERSION = "2.0.5"
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: 2.0.3
4
+ version: 2.0.5
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-12 00:00:00.000000000 Z
11
+ date: 2013-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cprobert-s3sync
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  version: '0'
156
156
  requirements: []
157
157
  rubyforge_project:
158
- rubygems_version: 2.0.4
158
+ rubygems_version: 2.0.5
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: Create simple static websites, in a jiffy