scms 2.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2U2M2M3ZmZkYjFjZTkxMTU5MzliYmMxMGNkM2UyNWUzODkzMzA0Zg==
4
+ M2IxN2JkZDQ2YzcxZGZkZmYzZmQxNzAzZTNlMTI2NDkwODJhODdhMA==
5
5
  data.tar.gz: !binary |-
6
- YmYyMDJiNDM1MDNlYWY5ZTNlOWYyODE1MGU0NjkzYmRhODVlYWU3ZQ==
6
+ Y2NiYWI5MzQwNWRhMGY1MWY3ZTg1ZmY3MWU4NjA1ODg5MTM2OWViZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Njg2MTdjMTUxYzhkMmRlYTQ3ZTRmMDA0Njk2MzQxZWQ0NmIyZTM2ODZjMGU4
10
- ZjRiN2U3ODRkMzNhZDZiOTkzZjY1YWUyMTZjYzc5MDJmMWMwMDZiYTg0NGYy
11
- YWVlMGI3MjgxMWU1ZDIzZjAzNzc4Yzg0OWRiZTBkYzRmNmI1Y2E=
9
+ NmM1ODZlMWYxZWQ1YzE5NGY3ZWUyZDM0ZTZhMmRkOGJlNTUzYzZlODI0ZWY1
10
+ YTJiMThiYjEwOTllYTViYTRmYzhjMDNiNGYyMWViNTcyMjA4NGU3ZjMyODk3
11
+ YzM4NTg0ZjliOWU0ZTEzOGQ3MDNmMDZlYjExYWQyMDY0NTM0NDE=
12
12
  data.tar.gz: !binary |-
13
- YmU0NTYxNGQ5MjE1ZDllZGI0NTNhZDE4Zjk3MWFiNDIxYTM4Y2RkMDIwYTU1
14
- OTU2ZWI5Y2FhZjY3ZGM3MGQxNTM5YzdiODZkMmMyYmZjOGI1OTczOTkyYjhm
15
- NTMxYmIzZjk1ZjkyODNiZTU3N2ViOTc5OTBiNjc2ZDhhYWVjYmU=
13
+ ZmI4MjJlNjliMjQ4NWNmNGRiZjljYjE2ZDA3NzkwNWJhZmUwM2U5MTlmODg4
14
+ MzE3OTIzMWQzZjAxNjM0NWIyMmMwYjQ4YWU3ODJmMDU3MTU1YmFhMjVkODhi
15
+ N2Q3ZWExNjFlMWFhZGMwNDZjZmFkMTk2MTBmM2NmMmE4NWNhYmI=
@@ -1,4 +1,4 @@
1
- template: _templates/skin.erb.html # The website skin (erb template)
1
+ template: _layouts/skin.erb.html # The website skin (erb template)
2
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:
@@ -9,14 +9,14 @@ pages:
9
9
  description: Meta description
10
10
  keywords: "CMS, S3, Ruby"
11
11
  views:
12
- intro: _views/home-intro.html
13
- main: _views/home-main.html
12
+ intro: _views/home/intro.html
13
+ main: _views/home/main.html
14
14
  - about:
15
15
  generate: about.html
16
16
  navigation: About
17
17
  views:
18
- intro: _views/about-intro.html
19
- main: _views/about-main.html
18
+ intro: _views/about/intro.html
19
+ main: _views/about/main.html
20
20
  - contact: #Pageless for nav only
21
21
  navigation: contact
22
22
  navigation_meta: contactform
@@ -25,12 +25,13 @@ pages:
25
25
  # Define your bundles here (versioning is recomended if your caching assets)
26
26
  bundles:
27
27
  - script:
28
- generate: scripts/bootstrap.min-v2.1.1.js
28
+ generate: js/bootstrap.min-v2.1.1.js
29
29
  files:
30
- - scripts/bootstrap.js
30
+ - _source/scripts/bootstrap.js
31
+ - _source/scripts/script.js
31
32
  - style:
32
- generate: stylesheets/style-1.0.css
33
+ generate: css/style-1.0.css
33
34
  files:
34
- - stylesheets/bootstrap.css
35
- - stylesheets/bootstrap-responsive.css
36
- - stylesheets/style.css
35
+ - _source/stylesheets/bootstrap.css
36
+ - _source/stylesheets/bootstrap-responsive.css
37
+ - _source/stylesheets/style.css
@@ -8,7 +8,7 @@
8
8
  <meta name="keywords" content="<%= page.keywords %>">
9
9
  <meta name="author" content="Courtenay Probert">
10
10
 
11
- <script src='scripts/jquery-1.8.2.min.js'></script>
11
+ <script src='js/jquery-1.8.2.min.js'></script>
12
12
  <!-- Le styles -->
13
13
  <link href='<%= page.bundles["style"] %>' rel="stylesheet">
14
14
  <style type="text/css">
data/bin/scms CHANGED
@@ -23,32 +23,47 @@ options = {}
23
23
  optparse = OptionParser.new do|opts|
24
24
  # Set a banner, displayed at the top of the help screen.
25
25
  opts.banner = "Usage: scms [options]"
26
-
27
- # Define the options, and what they do
28
- opts.on('-w', '--website WEBSITE', "Website directory (defaults to ./)") do |w|
29
- options[:website] = w
30
- end
31
26
 
32
- opts.on('-c', '--config CONFIGDIR', "Configeration directory if different from Website (defaults to ./)") do |c|
33
- options[:configdir] = c
27
+ options[:website] = Dir.pwd
28
+ opts.on('-s', '--source WorkingDir', "Location of website source code (defaults to ./)") do |w|
29
+ options[:website] = w.to_path
34
30
  end
35
-
36
- opts.on('-o', '--output BuildDIR', "Website build dir (defaults to ./)") do |o|
37
- options[:pub] = o
31
+
32
+ opts.on('-d', '--destination OutPutDir', "The location of the build files (defaults to ./)") do |o|
33
+ options[:destination] = o.to_path
38
34
  end
39
-
40
- options[:action] = "build"
41
- opts.on( '-a', '--action ACTION', 'build, deploy, listen or create' ) do|a|
42
- options[:action] = a
35
+
36
+ options[:create] = nil
37
+ opts.on( '-c', '--create NewWebSiteName', 'Create a new scms website' ) do |newsite|
38
+ options[:create] = newsite
43
39
  end
44
40
 
45
41
  options[:server] = false
46
- opts.on( '-s', '--server', 'Run a scms server on port localhost:8008' ) do
42
+ opts.on( '-s', '--serve', 'Run a scms server on port localhost:8008' ) do
47
43
  options[:server] = true
48
44
  end
45
+
46
+ options[:port] = 8002
47
+ opts.on( '-p', '--port Port', 'Listen on the given port (only workes with --serve)' ) do|p|
48
+ options[:port] = p
49
+ end
50
+
51
+ options[:watch] = false
52
+ opts.on( '-w', '--watch', 'Run a scms server on port localhost:8008' ) do
53
+ options[:watch] = true
54
+ end
55
+
56
+ options[:publish] = false
57
+ opts.on( '-p', '--publish', 'Deploy site to S3' ) do
58
+ options[:publish] = true
59
+ end
60
+
61
+ opts.on('-o', '--config ConfigDir', "Configeration directory if different from Website (defaults to ./)") do |c|
62
+ options[:configdir] = c
63
+ end
49
64
 
50
65
  options[:mode] = "pub"
51
- opts.on( '-m', '--mode MODE', 'CMS or Publish (for use with Air-Monkey: http://ipassexam.github.io/Air-Monkey/)' ) do|m|
66
+ opts.on( '-m', '--mode Mode', 'CMS or Publish (for use with Air-Monkey: http://ipassexam.github.io/Air-Monkey/)' ) do|m|
52
67
  options[:mode] = m
53
68
  end
54
69
 
@@ -68,24 +83,33 @@ optparse.parse!
68
83
  #Set globals
69
84
  $stdout.sync = true
70
85
  root_folder = File.expand_path("../", File.dirname(__FILE__))
71
- website = ((options[:website].nil?) ? Dir.pwd : options[:website]).to_path
72
- $website = website
73
86
  Folders = {
74
87
  :root => root_folder,
75
- :website => website,
76
- :pub => (options[:pub] or ENV["SCMS_PUBLISH_FOLDER"] or '').to_path,
77
- :config => (options[:configdir] or ENV["SCMS_CONFIG_FOLDER"] or website).to_path,
88
+ :website => options[:website],
89
+ :destination => (options[:destination] or ENV["SCMS_PUBLISH_FOLDER"] or '').to_path,
90
+ :config => (options[:configdir] or ENV["SCMS_CONFIG_FOLDER"] or options[:website]),
78
91
  :assets => File.join(root_folder, "assets")
79
92
  }
93
+ $website = Folders[:website]
94
+
95
+ ScmsUtils.log "System root folder = #{Folders[:root]}"
96
+ ScmsUtils.log "Website folder = #{Folders[:website]}"
97
+ ScmsUtils.log "Destination dir = #{Folders[:destination]}"
98
+ ScmsUtils.log "Config dir = #{Folders[:config]}"
99
+ ScmsUtils.log "Mode = #{options[:mode]}"
80
100
 
81
- if options[:action] == "create"
82
- if File.exists?(File.join(Folders[:website], "_config.yml"))
101
+ raise "Invalid working directory! #{Folders[:website]}" if !File::directory?(Folders[:website])
102
+
103
+ if options[:create] != nil
104
+ puts "Creating scms website: #{options[:create]}"
105
+ newWorkingDir = File.join(Folders[:website], options[:create])
106
+ if File.exists?(File.join(newWorkingDir, "_config.yml"))
83
107
  #if Dir.exists? Folders[:website]
84
108
  "Website already exists!!!"
85
109
  else
86
- puts "Making website: #{Folders[:website]}"
87
- FileUtils.mkdir_p Folders[:website]
88
- FileUtils.cp_r(Dir["#{File.join(Folders[:assets], "blank-template")}/*"], Folders[:website])
110
+ puts "Making website: #newWorkingDir}"
111
+ FileUtils.mkdir_p newWorkingDir
112
+ FileUtils.cp_r(Dir["#{File.join(Folders[:assets], "blank-template")}/*"], newWorkingDir)
89
113
  end
90
114
  exit
91
115
  end
@@ -94,31 +118,23 @@ monkeyhook = File.join(Folders[:website], "scripts", "air-monkey-hook.js")
94
118
  if options[:mode] == "cms"
95
119
  FileUtils.cp(File.join(Folders[:assets], "air-monkey-hook.js"), monkeyhook)
96
120
  else
97
- FileUtils.rm(monkeyhook) if File.exist?(monkeyhook) && options[:action] == "deploy"
121
+ FileUtils.rm(monkeyhook) if File.exist?(monkeyhook) && options[:publish]
98
122
  end
99
123
 
100
- #ScmsUtils.log "System root folder = #{Folders[:root]}"
101
- #ScmsUtils.log "Website folder = #{Folders[:website]}"
102
- #ScmsUtils.log "Pub dir = #{Folders[:pub]}"
103
- #ScmsUtils.log "Config dir = #{Folders[:config]}"
104
- #ScmsUtils.log "Mode = #{options[:mode]}"
105
-
106
- raise "No website in folder #{Folders[:website]}" if !File::directory?(Folders[:website])
107
- Scms.upgrade(Folders[:website])
108
124
  Scms.build(Folders[:website], Folders[:config], options[:mode])
109
- Scms.copywebsite(Folders[:website], Folders[:pub]) if Folders[:pub] != nil
125
+ Scms.copywebsite(Folders[:website], Folders[:destination]) if Folders[:destination] != ''
110
126
 
111
127
  threads = []
112
128
  if options[:server]
113
129
  threads << Thread.new {
114
- ScmsServer.start(8088, Folders[:website])
130
+ ScmsServer.start(Folders[:website], options[:port])
115
131
  }
116
132
  end
117
133
 
118
- if options[:action] == "watch"
134
+ if options[:watch]
119
135
  #watcher = Thread.new {
120
136
  require 'filewatcher'
121
- FileWatcher.new(["_views", "_templates", "_source"], "Watching for changes in _views, _templates or _source").watch do |filename|
137
+ FileWatcher.new(["_views", "_layouts", "_templates", "_source"], "Watching for changes in _views, _layouts or _source").watch do |filename|
122
138
  puts "Updated " + filename
123
139
  Scms.build(Folders[:website], Folders[:config], options[:mode])
124
140
  end
@@ -126,8 +142,13 @@ if options[:action] == "watch"
126
142
  #watcher.join
127
143
  end
128
144
 
129
- mimetypefile = File.join(Folders[:root], "assets", "mime.types")
130
- S3Deploy.sync(Folders[:website], Folders[:config], mimetypefile) if options[:action] == "deploy"
145
+ if options[:publish]
146
+ if File.exists?(File.join(Folders[:config], "_s3config.yml"))
147
+ puts "Deploying to S3"
148
+ mimetypefile = File.join(Folders[:assets], "mime.types")
149
+ S3Deploy.sync(Folders[:website], Folders[:config], mimetypefile)
150
+ end
151
+ end
131
152
 
132
153
  # join web server thread if it hasn't been used with watch action
133
154
  threads.each { |t|
data/bin/scms-server CHANGED
@@ -19,9 +19,9 @@ optparse = OptionParser.new do|opts|
19
19
  # Set a banner, displayed at the top of the help screen.
20
20
  opts.banner = "Usage: scms-server [options]"
21
21
 
22
- options[:dir] = Dir::pwd
23
- opts.on( '-d', '--dir DIR', 'Document Root of http server [default = current working dir]' ) do|d|
24
- options[:dir] = d
22
+ options[:website] = Dir::pwd
23
+ opts.on( '-s', '--source DIR', 'Document Root of http server [default = current working dir]' ) do|d|
24
+ options[:website] = d
25
25
  end
26
26
 
27
27
  options[:port] = 8008
@@ -29,10 +29,10 @@ optparse = OptionParser.new do|opts|
29
29
  options[:port] = p
30
30
  end
31
31
 
32
- # options[:host] = "localhost"
33
- # opts.on( '-h', '--host HOST', 'http host for http server [default = localhost]' ) do|h|
34
- # options[:host] = h
35
- # end
32
+ options[:host] = Socket.gethostname
33
+ opts.on( '-h', '--host HOST', 'http host for http server [default = localhost]' ) do|h|
34
+ options[:host] = h
35
+ end
36
36
 
37
37
  options[:version] = false
38
38
  opts.on( '-v', '--version', 'Output scms version' ) do
@@ -48,8 +48,7 @@ end
48
48
  optparse.parse!
49
49
 
50
50
  #puts "Working dir: #{Dir::pwd}"
51
- #puts "Doc root: #{options[:dir]}"
51
+ #puts "Doc root: #{options[:website]}"
52
52
 
53
- port = options[:port]
54
- ScmsServer.start(port, options[:dir])
53
+ ScmsServer.start(options[:website], options[:port], options[:host])
55
54
  exit
data/lib/scms.rb CHANGED
@@ -396,8 +396,8 @@ module Scms
396
396
  end
397
397
  end
398
398
 
399
- def Scms.upgrade(website)
400
- File.rename("config.yml", "_config.yml") if File.exists? File.join(website, "config.yml")
401
- File.rename("s3config.yml", "_s3config.yml") if File.exists? File.join(website, "s3config.yml")
402
- end
399
+ # def Scms.upgrade(website)
400
+ # File.rename("config.yml", "_config.yml") if File.exists? File.join(website, "config.yml")
401
+ # File.rename("s3config.yml", "_s3config.yml") if File.exists? File.join(website, "s3config.yml")
402
+ # end
403
403
  end
@@ -4,13 +4,17 @@ require 'launchy'
4
4
  module ScmsServer
5
5
  include WEBrick
6
6
 
7
- def ScmsServer.start(port, root_document)
7
+ def ScmsServer.start(root_document, port, hostname="localhost")
8
8
 
9
- puts "Starting server: http://#{Socket.gethostname}:#{port}"
9
+ puts "Starting server: http://#{hostname}:#{port}"
10
10
  #:BindAddress
11
- server = HTTPServer.new(:Port=> port, :DocumentRoot=> root_document)
11
+ server = HTTPServer.new(
12
+ :DocumentRoot => root_document,
13
+ :Port => port,
14
+ :BindAddress => hostname
15
+ )
16
+
12
17
  mime_types_file = File.expand_path('../../assets/mime.types', File.dirname(__FILE__))
13
- puts mime_types_file
14
18
  WEBrick::HTTPUtils::load_mime_types(mime_types_file)
15
19
 
16
20
  trap("INT"){
@@ -19,14 +23,23 @@ module ScmsServer
19
23
  exit!
20
24
  }
21
25
 
22
- uri = "http://localhost:#{port}"
26
+ uri = "http://#{hostname}:#{port}"
23
27
  Launchy.open( uri ) do |exception|
24
28
  puts "Attempted to open #{uri} and failed because #{exception}"
25
29
  end
26
30
 
27
- server.start
28
-
29
- return server
31
+ begin
32
+ server.start
33
+ rescue SystemExit, Interrupt
34
+ puts "Closing web brick"
35
+ server.start
36
+ rescue StandardError => e
37
+ puts "StandardError"
38
+ server.shutdown
39
+ rescue Exception => e
40
+ puts "scms-server exception"
41
+ rais e
42
+ end
30
43
  end
31
44
 
32
45
  end
data/lib/scms/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scms
2
- VERSION = "2.2.0"
2
+ VERSION = "3.0.0"
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.2.0
4
+ version: 3.0.0
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-10-10 00:00:00.000000000 Z
11
+ date: 2013-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cprobert-s3sync
@@ -139,21 +139,21 @@ files:
139
139
  - Rakefile
140
140
  - assets/air-monkey-hook.js
141
141
  - assets/blank-template/_config.yml
142
+ - assets/blank-template/_layouts/skin.erb.html
142
143
  - assets/blank-template/_s3config.template.yml
143
- - assets/blank-template/_templates/skin.erb.html
144
- - assets/blank-template/_views/about-intro.html
145
- - assets/blank-template/_views/about-main.html
146
- - assets/blank-template/_views/home-intro.html
147
- - assets/blank-template/_views/home-main.html
144
+ - assets/blank-template/_source/scripts/bootstrap.js
145
+ - assets/blank-template/_source/scripts/script.js
146
+ - assets/blank-template/_source/stylesheets/bootstrap-responsive.css
147
+ - assets/blank-template/_source/stylesheets/bootstrap.css
148
+ - assets/blank-template/_source/stylesheets/style.css
149
+ - assets/blank-template/_views/about/intro.html
150
+ - assets/blank-template/_views/about/main.html
151
+ - assets/blank-template/_views/home/intro.html
152
+ - assets/blank-template/_views/home/main.html
148
153
  - assets/blank-template/images/glyphicons-halflings-white.png
149
154
  - assets/blank-template/images/glyphicons-halflings.png
155
+ - assets/blank-template/js/jquery-1.8.2.min.js
150
156
  - assets/blank-template/robots.txt
151
- - assets/blank-template/scripts/bootstrap.js
152
- - assets/blank-template/scripts/jquery-1.8.2.min.js
153
- - assets/blank-template/scripts/script.js
154
- - assets/blank-template/stylesheets/bootstrap-responsive.css
155
- - assets/blank-template/stylesheets/bootstrap.css
156
- - assets/blank-template/stylesheets/style.css
157
157
  - assets/mime.types
158
158
  - assets/yuicompressor/readme
159
159
  - bin/scms