smooster 0.4.1 → 0.4.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 +4 -4
- data/README.md +4 -0
- data/lib/smooster/cli/executable.rb +13 -5
- data/lib/smooster/deploy/media_asset.rb +5 -0
- data/lib/smooster/deploy/pages.rb +6 -2
- data/lib/smooster/deploy/site_templates.rb +6 -2
- data/lib/smooster/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a20fe62a1bbfd74278fa7d59b3039ad468453ce
|
4
|
+
data.tar.gz: aa5e06e14aebc6b643ca085d97a26a08fa8b988c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ff1e2b8cfa6b70d1315184e27c15516f65ea8b6900b7ba3fd42a49f4632f17d661de1829c58a99b5f379817bdbcc8fea252ffa94191c8baec2dcb0452ac0b9f
|
7
|
+
data.tar.gz: f05da62d75ce563341fb3f7573f1da9a807f050317587bd02cc6e6721077402b7817e29de7aa915f4c18f917427d94779d2eacf159e319e77fc89bc873863729
|
data/README.md
CHANGED
@@ -74,6 +74,10 @@ This is a ruby gem
|
|
74
74
|
|
75
75
|
## Changelog
|
76
76
|
|
77
|
+
###0.4.2
|
78
|
+
* Bugfix: Checking folder names for unsupported characters before upload
|
79
|
+
* Bugfix: Checking page titles for unsupported characters before upload
|
80
|
+
|
77
81
|
###0.4.1
|
78
82
|
* Feature: Setting the hosting for the website
|
79
83
|
|
@@ -9,6 +9,7 @@ module Smooster
|
|
9
9
|
|
10
10
|
desc "test", "Returns test data"
|
11
11
|
def test
|
12
|
+
puts "smooster Gem Version: #{Gem.loaded_specs["smooster"].version}"
|
12
13
|
puts Smooster::Application.instance.api_key()
|
13
14
|
puts Dir.pwd
|
14
15
|
end
|
@@ -91,12 +92,19 @@ module Smooster
|
|
91
92
|
urls << p.url
|
92
93
|
puts "#{p.filename} #{status}"
|
93
94
|
end
|
95
|
+
puts "Starting validation of #{urls.count} pages"
|
96
|
+
return if urls.count == 0
|
94
97
|
urls.each do |url|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
98
|
+
begin
|
99
|
+
puts "#{url}"
|
100
|
+
url_encoded = CGI.escape(url)
|
101
|
+
if options[:validator]
|
102
|
+
Launchy.open("http://validator.w3.org/check?uri=#{url_encoded}&charset=%28detect+automatically%29&doctype=Inline&group=0")
|
103
|
+
sleep 1
|
104
|
+
end
|
105
|
+
rescue => e
|
106
|
+
Smooster::Application.instance.logger.error "Error in page validation for #{url}!: #{e} / #{e.backtrace.inspect}"
|
107
|
+
puts "This url failed to be validated: #{url}".colorize(:red)
|
100
108
|
end
|
101
109
|
end
|
102
110
|
end
|
@@ -53,6 +53,11 @@ module Smooster
|
|
53
53
|
def upload
|
54
54
|
return false if self.checksum.to_s == self.load_checksum.to_s
|
55
55
|
|
56
|
+
unless /^[a-zA-Z0-9\/\-]+$/.match(self.folder_path)
|
57
|
+
puts "The folder names must contain ONLY letters, numbers and hyphens (-): #{self.folder_path}".colorize(:red)
|
58
|
+
return false
|
59
|
+
end
|
60
|
+
|
56
61
|
if self.smo_id.present?
|
57
62
|
begin
|
58
63
|
response = RestClient.put "#{Smooster::Application.instance.api_url()}/#{Smooster::Application.instance.site_id()}/media_assets/#{self.smo_id}", {:media_asset => {:file => File.new(self.file_path, 'rb'), :folder_path => self.folder_path}}, {"Authorization" => 'Token token="'+ Smooster::Application.instance.api_key() +'"', "Accept" => 'application/vnd.smoosterid.v2'}
|
@@ -9,8 +9,12 @@ module Smooster
|
|
9
9
|
template = SiteTemplate.new({:body => body, :path => file, :checksum => Digest::MD5.hexdigest(body)})
|
10
10
|
template.smo_id = template.load_smo_id if template.load_smo_id.present?
|
11
11
|
source = Nokogiri::HTML(body)
|
12
|
-
|
13
|
-
|
12
|
+
if /^[a-z0-9\/\-]+$/.match(source.css('title').first)
|
13
|
+
template.title = source.css('title').first.inner_html
|
14
|
+
collection << template
|
15
|
+
else
|
16
|
+
puts "Couldn't create page, because the templates title-tag name must contain ONLY lower case letters, numbers and hyphens (-): #{source.css('title').first}".colorize(:red)
|
17
|
+
end
|
14
18
|
end
|
15
19
|
collection
|
16
20
|
end
|
@@ -10,8 +10,12 @@ module Smooster
|
|
10
10
|
template.smo_id = template.load_smo_id if template.load_smo_id.present?
|
11
11
|
source = Nokogiri::HTML(body)
|
12
12
|
if source.css('title').first
|
13
|
-
|
14
|
-
|
13
|
+
if /^[a-z0-9\/\-]+$/.match(source.css('title').first)
|
14
|
+
template.title = source.css('title').first.inner_html
|
15
|
+
collection << template
|
16
|
+
else
|
17
|
+
puts "Couldn't create template, because the templates title-tag name must contain ONLY lower case letters, numbers and hyphens (-): #{source.css('title').first}".colorize(:red)
|
18
|
+
end
|
15
19
|
else
|
16
20
|
puts "The file #{file} is not a valid HTMl-Document. Also be sure to add a title-tag".colorize(:red)
|
17
21
|
end
|
data/lib/smooster/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smooster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Maier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|