smooster 0.2.1 → 0.3.6

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: 319f2bf2727611b53db7b538ce5b4be8839fd0ba
4
- data.tar.gz: 80ba17c26da7d73631ca2a7228ceb8eb60d30375
3
+ metadata.gz: e8a582e5a50e55e468838c365c3a6a176bbf78fb
4
+ data.tar.gz: a86cf596c0420c27557fb1f4fd0dbfa3291a0767
5
5
  SHA512:
6
- metadata.gz: 719c35cf83dee877165fe430e62d028c4916d504bc738ad76b943820ccd9e912223a3dfad8fab65da3a4a2962ee16e28297f5fb64be29010ed35df28fee10733
7
- data.tar.gz: 70aeca8276ca2429a9cd480c99c8965c829e2be5aad31d87b66858dff806032eb78d49d53ddd8b035cff6756951ade6e5cc0f75d1a4963dfec8a3da0935e43ad
6
+ metadata.gz: f24f95eda1f164a1d08a23fc13e872d39f437980704b62bb8d76c5053ef757bad0ee420959fea7f51dd697f6a8c3309a3a75481e5433f73701c4024e9bb8556f
7
+ data.tar.gz: 9e455cfd11edf957a4e0a14daa5b31affacbe0b1a7efb1fe6ba98ddb363b33b515322749c780bd06f20e3338c485ac2c85151e7858663f55b3c3a1d1f5c23bdc
data/README.md CHANGED
@@ -32,18 +32,25 @@ This is a ruby gem
32
32
  * A wizard for project for new sites - best case even creates a new site in smooster before deployment
33
33
  * Detecting liquid variables in site_templates an auto activating liquid feature
34
34
  * add subtemplate feature - auto detect similar parts in html and create subtemplates
35
- * Feature that can create a page for each uploaded site_template (so that it's easier to check, if they are working) and return the links for all of them
36
- * For each new generated test page, return a html validator link http://validator.w3.org/check?uri=www.smooster.com%2Fde%2Findex&charset=%28detect+automatically%29&doctype=Inline&group=0
37
35
  * Create a new local project based on the smooster-html-boilerplate
38
36
  * Create a local project based on a demo website - ready to deploy (for beginners, to see how it may work)
37
+ * site_config file for image and formating settings
38
+ * making the script windows ready
39
39
 
40
40
  ## Changelog
41
41
 
42
+ ###0.3.6
43
+ * added smooster site config file for image size, blockformat and rss settings
44
+
45
+ ###0.3.1
46
+ * added NEW smooster setup command to setup a new site
47
+ * renamed smooster setup to smooster register
48
+
42
49
  ###0.2.1
43
50
  * Added Page create feature. smooster deploy initial will first upload medias, templates and then create a page for each uploaded template
44
51
 
45
52
  ###0.1.8
46
- * MAJOR: Changed smooster api v2 for site_templates and media_assets from ids to smo_ids
53
+ * MAJOR: Changed smooster api v2 for site_templates and media_assets from ids to smo_ids
47
54
 
48
55
  ###0.1.7
49
56
  * Bugfix: use only short_path as reference for site_templates and media_assets (do be more compatible between different users systems)
@@ -12,8 +12,8 @@ module Smooster
12
12
  puts Dir.pwd
13
13
  end
14
14
 
15
- desc "setup API_KEY", "Setup your smooster gem. Add your API_KEY"
16
- def setup(api_key)
15
+ desc "register API_KEY", "Register your smooster gem. Add your API_KEY"
16
+ def register(api_key)
17
17
 
18
18
  unless File.directory?("#{Dir.home}/.smo")
19
19
  FileUtils.mkdir_p("#{Dir.home}/.smo")
@@ -24,9 +24,9 @@ module Smooster
24
24
  puts "done!"
25
25
  end
26
26
 
27
- desc "site SITE_ID [API_URL, HTML_FOLDER]", "Setup a new site / project. SITE_ID is the smooster site_id given, when you create a new site in smooster."
27
+ desc "setup SITE_ID [API_URL, HTML_FOLDER]", "Setup a new site / project. SITE_ID is the smooster site_id given, when you create a new site in smooster."
28
28
  #method_options :force => :boolean, :alias => :string
29
- def site(site_id, api_url="http://cms.smooster.com/api", html_folder="html")
29
+ def setup(site_id, api_url="http://cms.smooster.com/api", html_folder="html")
30
30
 
31
31
  unless File.directory?("#{Smooster::Application.instance.base_dir}/.smo")
32
32
  FileUtils.mkdir_p("#{Smooster::Application.instance.base_dir}/.smo")
@@ -38,6 +38,12 @@ module Smooster
38
38
  config_store[:html_folder] = html_folder
39
39
  config_store[:site_id] = site_id
40
40
  end
41
+
42
+ #if ([(print 'Create a site_config.yml file? [y]: '), gets.rstrip][1] == "y")
43
+ unless File.exists?("#{Smooster::Application.instance.base_dir}/site_config.yml")
44
+ File.open("#{Smooster::Application.instance.base_dir}/site_config.yml", "w+") { |file| file.write(File.read(File.expand_path('../../templates/site_config.yml', __FILE__))) }
45
+ end
46
+ #end
41
47
  end
42
48
 
43
49
  desc "deploy [TYPE]", "deploy your project to the smooster cloud DEFAULT=assets [assets,templates,all,initial]"
@@ -102,6 +108,19 @@ module Smooster
102
108
 
103
109
  puts "#{type} done!"
104
110
  end
111
+
112
+ desc "configure", "Configure the smooster site via your site_config.yml"
113
+ def configure()
114
+
115
+ if File.exists?("#{Smooster::Application.instance.base_dir}/site_config.yml")
116
+ Smooster::Deploy::Setting.upload()
117
+
118
+ puts "done!"
119
+ else
120
+ puts "no site_config.yml could be found in your project root folder. Please use 'smooster setup SITE_ID' to create site_config.yml".colorize(:red)
121
+ end
122
+ end
123
+
105
124
  end
106
125
 
107
126
  end
@@ -0,0 +1,27 @@
1
+ module Smooster
2
+ module Deploy
3
+ class Setting
4
+ include ActiveModel::Model
5
+ include ActiveModel::Serializers::JSON
6
+
7
+ attr_accessor :images, :formatblock, :rss
8
+
9
+ def self.read_config
10
+ if File.exists?("#{Smooster::Application.instance.base_dir}/site_config.yml")
11
+ YAML.load(File.read("#{Smooster::Application.instance.base_dir}/site_config.yml"))
12
+ end
13
+ end
14
+
15
+ def self.upload
16
+ begin
17
+ response = RestClient.post "#{Smooster::Application.instance.api_url()}/#{Smooster::Application.instance.site_id()}/configure", {:configs => self.read_config}, {"Authorization" => 'Token token="'+ Smooster::Application.instance.api_key() +'"', "Accept" => 'application/vnd.smoosterid.v2'}
18
+ data = JSON.parse(response)
19
+ rescue => e
20
+ Smooster::Application.instance.logger.error "Error settings!: #{e} / #{e.backtrace.inspect}"
21
+ puts "The settings failed to be updated".colorize(:red)
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+ end
@@ -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
- template.title = source.css('title').first.inner_html
13
- collection << template
12
+ if source.css('title').first
13
+ template.title = source.css('title').first.inner_html
14
+ collection << template
15
+ else
16
+ puts "The file #{file} is not a valid HTMl-Document. Also be sure to add a title-tag".colorize(:red)
17
+ end
14
18
  end
15
19
  collection
16
20
  end
@@ -0,0 +1,31 @@
1
+ images:
2
+ size1:
3
+ width: 250
4
+ size2:
5
+ width: 400
6
+ size3:
7
+ width: 600
8
+ formats:
9
+ line1:
10
+ tag: p
11
+ name: Absatz
12
+ line2:
13
+ tag: h1
14
+ name: Überschrift 1
15
+ line3:
16
+ tag: h2
17
+ name: Überschrift 2
18
+ line4:
19
+ tag: h3
20
+ name: Überschrift 3
21
+ line5:
22
+ tag: h4
23
+ name: Überschrift 4
24
+ line6:
25
+ tag: span
26
+ name: grau & dicke Schrift
27
+ class: greybold
28
+ rss:
29
+ site_description: none
30
+ site_title:
31
+
@@ -1,3 +1,3 @@
1
1
  module Smooster
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.6"
3
3
  end
data/lib/smooster.rb CHANGED
@@ -17,6 +17,7 @@ require 'smooster/deploy/pages'
17
17
  require 'smooster/deploy/page'
18
18
  require 'smooster/deploy/media_assets'
19
19
  require 'smooster/deploy/media_asset'
20
+ require 'smooster/deploy/setting'
20
21
 
21
22
  #debug
22
23
  #require 'pry'
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.2.1
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Maier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-17 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -215,10 +215,11 @@ files:
215
215
  - lib/smooster/deploy/media_assets.rb
216
216
  - lib/smooster/deploy/page.rb
217
217
  - lib/smooster/deploy/pages.rb
218
+ - lib/smooster/deploy/setting.rb
218
219
  - lib/smooster/deploy/site_template.rb
219
220
  - lib/smooster/deploy/site_templates.rb
220
221
  - lib/smooster/rest-client/rest-client-purge.rb
221
- - lib/smooster/templates/configure.yml
222
+ - lib/smooster/templates/site_config.yml
222
223
  - lib/smooster/version.rb
223
224
  - logs/application.log
224
225
  - smooster.gemspec
@@ -1,4 +0,0 @@
1
- project:
2
- html_folder: html
3
- api_url: http://cms.smooster.com/api
4
- site_id: 54351208bb1b7507d1000001