siteleaf 0.9.11 → 0.9.12

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -114,6 +114,7 @@ pages = site.pages
114
114
 
115
115
  # create new page in site
116
116
  page = Siteleaf::Page.create({
117
+ :site_id => site.id
117
118
  :title => 'My Page',
118
119
  :slug => 'my-page', # optional
119
120
  :body => 'This is my first page.'
@@ -122,14 +123,22 @@ page = Siteleaf::Page.create({
122
123
  # get page by id
123
124
  page = Siteleaf::Page.find('519719ddcc85910626000001')
124
125
 
126
+ # create new post in page
127
+ post = Siteleaf::Post.create({
128
+ :page_id => page.id
129
+ :title => 'My Post',
130
+ :slug => 'my-post', # optional
131
+ :body => 'This is my first post.'
132
+ })
133
+
125
134
  # update page, add metadata, add taxonomy
126
- page.title = 'New Title'
127
- page.meta = [ {"key" => "foo", "value" => "bar"} ]
135
+ post.title = 'New Title'
136
+ post.meta = [ {"key" => "foo", "value" => "bar"} ]
128
137
  post.taxonomy = [ {"key" => "Tags", "values" => ["One","Two","Three"]} ]
129
- page.save
138
+ post.save
130
139
 
131
- # delete page
132
- page.delete
140
+ # delete post
141
+ post.delete
133
142
 
134
143
  # delete page by id
135
144
  Siteleaf::Page.delete('519719ddcc85910626000001')
data/bin/siteleaf CHANGED
@@ -124,7 +124,7 @@ when '-h', '--help', 'help'
124
124
  when 's', 'server'
125
125
  if File.exist?('config.ru')
126
126
  port = ARGV[2] if %w[-p --port].include?(ARGV[1]) && ARGV[1]
127
- `rackup config.ru -p #{port || '9292'}`
127
+ `rackup config.ru -p #{port || '9292'} >&2`
128
128
  else
129
129
  puts "No config found, run `siteleaf config yoursite.com`.\n"
130
130
  end
@@ -69,9 +69,8 @@ module Siteleaf
69
69
  end
70
70
 
71
71
  output = site.preview(url, template_data)
72
- if output.code == 200 && output.headers[:content_type]
73
- puts output.class
74
- [output.code, {'Content-Type' => output.headers[:content_type]}, [output.to_s]]
72
+ if output.code == 200 && output.headers["content-type"]
73
+ [output.code, {'Content-Type' => output.headers["content-type"]}, [output.to_s]]
75
74
  else
76
75
  [output.code, {'Content-Type' => 'text/html'}, [output.to_s]]
77
76
  end
data/lib/siteleaf/site.rb CHANGED
@@ -19,7 +19,7 @@ module Siteleaf
19
19
  end
20
20
 
21
21
  def preview(url = '/', template = nil)
22
- Client.post "sites/#{self.id}/preview.html", {"url" => url, "template" => template}
22
+ Client.post "sites/#{self.id}/preview", {"url" => url, "template" => template}
23
23
  end
24
24
 
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module Siteleaf
2
- VERSION = "0.9.11"
2
+ VERSION = "0.9.12"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: siteleaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.11
4
+ version: 0.9.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-26 00:00:00.000000000 Z
12
+ date: 2013-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty