siteleaf 1.0.7 → 1.0.8

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: 5f74c49a1f23b1a7fa9b7ed1887a6902fe8b124a
4
- data.tar.gz: 8b6938a886900939e717d62e6a8d99769cfe2530
3
+ metadata.gz: 379557d79b19798bedb2c6d0c81638f01f879ade
4
+ data.tar.gz: ed497c0fe6039b06fde30ed8dd1afb402d127fba
5
5
  SHA512:
6
- metadata.gz: fc28e5260c862cf114e6b7714bad0bd0d668096befac16a5cb7924dc7913db633c75a09e9f7c205f16a417da96ea8b4418e72652db7168f6f34a48a159787ce2
7
- data.tar.gz: e6f85fde2f3dba994740f17a4d56f9fcb9ab1cfbaa750c509e7ab41ca9959509f5f047e056824b3d7b7bb3341f8f3e610d61730534764794ea5dd7df4e5003c1
6
+ metadata.gz: 3340dadf03c7e75c05b4d7fafc8159208f11f1013861624ee378055d3553b63602fec673e015627652f99419566e7290e424b8953ed25813b0da726d3241ad30
7
+ data.tar.gz: ee1d3a50b0d9074005ba8b8eae72d6927b1ee571bf39782d9d1b6eccbf6fde2cc855bad558b64b4898571d088ca07799ac701ee521738750e72fee4099c0962d
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- For v2 see: https://github.com/siteleaf/siteleaf-gem/tree/2.0.0.pre
1
+ **Note:** This version only applies to v1 sites, for v2 see: https://github.com/siteleaf/siteleaf-gem
2
2
 
3
- Siteleaf Gem (v1)
3
+ Siteleaf v1 Gem
4
4
  =================
5
5
 
6
6
  - [Installation](#installation)
@@ -17,7 +17,7 @@ Installation
17
17
 
18
18
  The Siteleaf gem is available for installation on [Rubygems](https://rubygems.org/gems/siteleaf). To install run:
19
19
 
20
- gem install siteleaf
20
+ gem install siteleaf -v '~>1'
21
21
 
22
22
 
23
23
  Using the CLI
@@ -89,7 +89,7 @@ Using this gem in your application
89
89
 
90
90
  To use this gem in your application, add the following to your Gemfile:
91
91
 
92
- gem 'siteleaf', :git => 'git://github.com/siteleaf/siteleaf-gem.git'
92
+ gem 'siteleaf', '~>1'
93
93
 
94
94
 
95
95
 
@@ -193,7 +193,7 @@ Troubleshooting
193
193
 
194
194
  Try running:
195
195
 
196
- sudo gem install siteleaf
196
+ sudo gem install siteleaf -v '~>1'
197
197
 
198
198
 
199
199
  Contributing
data/lib/siteleaf/site.rb CHANGED
@@ -3,12 +3,12 @@ module Siteleaf
3
3
 
4
4
  attr_accessor :title, :domain, :timezone, :meta, :posts_path, :version
5
5
  attr_reader :id, :user_id, :created_at, :updated_at
6
-
6
+
7
7
  def self.find_by_domain(domain)
8
8
  result = Client.get self.endpoint, {"domain" => domain}
9
9
  self.new(result.first) if result and result.size >= 1
10
10
  end
11
-
11
+
12
12
  def theme
13
13
  @theme ||= if result = Client.get("sites/#{self.id}/theme")
14
14
  theme = Theme.new(result)
@@ -16,60 +16,61 @@ module Siteleaf
16
16
  theme
17
17
  end
18
18
  end
19
-
19
+
20
20
  def assets
21
21
  result = Client.get "sites/#{self.id}/assets"
22
22
  result.map { |r| Asset.new(r) } if result
23
23
  end
24
-
24
+
25
25
  def pages
26
26
  result = Client.get "sites/#{self.id}/pages"
27
27
  result.map { |r| Page.new(r) } if result
28
28
  end
29
-
29
+
30
30
  def posts
31
31
  result = Client.get "sites/#{self.id}/posts"
32
32
  result.map { |r| Post.new(r) } if result
33
33
  end
34
-
34
+
35
35
  def resolve(url = '/')
36
36
  Client.get "sites/#{self.id}/resolve", {"url" => url}
37
37
  end
38
-
38
+
39
39
  def preview(url = '/', template = nil)
40
40
  Client.post "sites/#{self.id}/preview", {"url" => url, "template" => template}
41
41
  end
42
-
42
+
43
43
  def publish
44
44
  result = Client.post "sites/#{self.id}/publish", {}
45
45
  Job.new(id: result.parsed_response["job_id"]) if result
46
46
  end
47
-
47
+
48
48
  def posts_path
49
49
  @posts_path || 'posts'
50
50
  end
51
-
51
+
52
52
  def filename
53
53
  "_config.yml"
54
54
  end
55
-
55
+
56
56
  def config
57
57
  attrs = {}
58
58
  attrs['title'] = title
59
59
  attrs['url'] = "http://#{domain}"
60
60
  attrs['timezone'] = timezone
61
61
  attrs['permalink'] = 'pretty'
62
-
62
+ attrs['markdown'] = 'kramdown'
63
+
63
64
  meta.each{|m| attrs[m['key'].to_s.downcase] = m['value'].to_s == '' ? nil : m['value'].to_s.gsub("\r\n","\n")} unless meta.nil?
64
-
65
+
65
66
  # output uploads using v1 /assets path
66
67
  attrs['collections'] = {
67
68
  'uploads' => {
68
- 'title' => 'Uploads',
69
+ 'title' => 'Uploads',
69
70
  'output' => true
70
71
  }
71
72
  }
72
-
73
+
73
74
  # use collections for any set of posts not called "posts"
74
75
  pages.each do |page|
75
76
  path = page.url.sub('/','').gsub('/','_')
@@ -79,35 +80,29 @@ module Siteleaf
79
80
  attrs['collections'][path]['permalink'] = "#{page.url}/:path" if path != page.slug
80
81
  end
81
82
  end
82
-
83
+
83
84
  # set permalink style for posts
84
85
  attrs['defaults'] = [{
85
86
  'scope' => {
86
- 'path' => '',
87
+ 'path' => '',
87
88
  'type' => 'posts'
88
- },
89
+ },
89
90
  'values' => {
90
- 'permalink' => "/#{posts_path}/:title/"
91
+ 'permalink' => "/#{posts_path}/:title/"
91
92
  }
92
93
  }]
93
-
94
- # markdown defaults to match v1 rendering
95
- attrs['markdown'] = 'redcarpet'
96
- attrs['redcarpet'] = {
97
- 'extensions' => ['autolink', 'fenced_code_blocks', 'lax_spacing', 'strikethrough', 'superscript', 'tables', 'footnotes', 'highlight']
98
- }
99
-
94
+
100
95
  attrs
101
96
  end
102
-
97
+
103
98
  def to_file(dir = 'export')
104
- assets = Dir.glob("#{dir}/_uploads/**/*").each_with_object({}) do |var, hash|
99
+ assets = Dir.glob("#{dir}/_uploads/**/*").each_with_object({}) do |var, hash|
105
100
  # remap assets to _uploads
106
101
  hash[var.sub("#{dir}/_uploads",'/assets')] = var.sub("#{dir}/_uploads",'/uploads')
107
102
  end
108
-
103
+
109
104
  config.to_yaml.gsub(Regexp.union(assets.keys), assets)
110
105
  end
111
-
106
+
112
107
  end
113
108
  end
@@ -1,3 +1,3 @@
1
1
  module Siteleaf
2
- VERSION = "1.0.7"
2
+ VERSION = "1.0.8"
3
3
  end
data/siteleaf.gemspec CHANGED
@@ -12,12 +12,12 @@ Gem::Specification.new do |gem|
12
12
  gem.description = %q{A Ruby interface and command line utility for the Siteleaf API.}
13
13
  gem.summary = "Siteleaf Ruby interface"
14
14
  gem.homepage = "http://siteleaf.com"
15
-
15
+
16
16
  gem.required_ruby_version = '>= 1.9.3'
17
-
17
+
18
18
  gem.add_dependency 'httparty', '>= 0.13.3'
19
19
  gem.add_dependency 'httmultiparty', '>= 0.3.13'
20
- gem.add_dependency 'psych', '2.0.8'
20
+ gem.add_dependency 'psych', '>= 2.0.17'
21
21
  gem.add_dependency 'rack'
22
22
 
23
23
  gem.files = `git ls-files`.split($/)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: siteleaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siteleaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-25 00:00:00.000000000 Z
11
+ date: 2016-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: psych
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 2.0.8
47
+ version: 2.0.17
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 2.0.8
54
+ version: 2.0.17
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rack
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  requirements: []
117
117
  rubyforge_project:
118
- rubygems_version: 2.4.7
118
+ rubygems_version: 2.5.1
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Siteleaf Ruby interface