siteleaf 0.9.22 → 0.9.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6f81b5e2b0e30522c443b49419ddc93eaee2ce31
4
+ data.tar.gz: 5eb92f3d3bf0e6f555f7620f762462caac9fde80
5
+ SHA512:
6
+ metadata.gz: ab5c786334310e8ff5def9532ee81c0dea9b2d29dbeacc5b8352820c6b16cea3770c777cd036ef02ee4c9c70420cf02a0fc3917262e12c24e31737bfdd15cf60
7
+ data.tar.gz: 27ac15f55218d9d7227ab0cfdf4fe8ce6c06ef43925c8a99bef7c071fb8bdbbe7ff60dd822ed593197181a9b1bbebd7be6bd15c07d7f859d71ac7b0454514aed
data/README.md CHANGED
@@ -63,9 +63,19 @@ To upload your theme to Siteleaf, run the following command:
63
63
 
64
64
  siteleaf push theme
65
65
 
66
- To switch Siteleaf users or re-authenticate:
66
+ **Publish your site:**
67
+
68
+ To publish your site changes to your hosting provider, run the following command:
69
+
70
+ siteleaf publish
71
+
72
+ **Switch Siteleaf users or re-authenticate:**
67
73
 
68
74
  siteleaf auth
75
+
76
+ **For a full list of commands, run:**
77
+
78
+ siteleaf help
69
79
 
70
80
 
71
81
  Using this gem in your application
@@ -89,7 +99,7 @@ Siteleaf.api_key = 'KEY'
89
99
  Siteleaf.api_secret = 'SECRET'
90
100
 
91
101
  # get authenticated user
92
- me = Siteleaf::Users.find('me')
102
+ me = Siteleaf::User.find('me')
93
103
 
94
104
  # get all sites
95
105
  sites = Siteleaf::Site.all
@@ -107,6 +117,9 @@ site = Siteleaf::Site.find('5196f137cc8591956b000001')
107
117
  site.title = 'New Title'
108
118
  site.save
109
119
 
120
+ # publish site
121
+ site.publish
122
+
110
123
  # delete site
111
124
  site.delete
112
125
 
@@ -118,7 +131,7 @@ pages = site.pages
118
131
 
119
132
  # create new page in site
120
133
  page = Siteleaf::Page.create({
121
- :site_id => site.id
134
+ :site_id => site.id,
122
135
  :title => 'My Page',
123
136
  :body => 'This is my first page.'
124
137
  })
@@ -128,7 +141,7 @@ page = Siteleaf::Page.find('519719ddcc85910626000001')
128
141
 
129
142
  # create new post in page
130
143
  post = Siteleaf::Post.create({
131
- :parent_id => page.id
144
+ :parent_id => page.id,
132
145
  :title => 'My Post',
133
146
  :body => 'This is my first post.'
134
147
  })
data/bin/siteleaf CHANGED
@@ -11,11 +11,12 @@ Usage: siteleaf [COMMAND] [OPTIONS]
11
11
 
12
12
  Commands:
13
13
  auth Login in with your credentials
14
- s, server Starts a local server.
14
+ s, server Starts a local server
15
15
  c, config DOMAIN Configure an existing directory
16
16
  n, new DOMAIN Creates new site on siteleaf.net
17
17
  pull theme Pulls theme files for configured site from Siteleaf
18
- push theme Pushes all files in dir as theme to configured site.
18
+ push theme Pushes all files in dir as theme to configured site
19
+ publish Publish website to hosting provider
19
20
  help Prints this help document
20
21
  version Prints the siteleaf gem version
21
22
 
@@ -23,6 +24,7 @@ Options:
23
24
  -h, --help Prints this help document
24
25
  -v, --version Prints the siteleaf gem version
25
26
  -p, --port PORT Binds local server to PORT (default: 9292)
27
+ -q, --quiet Suppress publish status
26
28
 
27
29
  See https://github.com/siteleaf/siteleaf-gem for additional documentation.
28
30
  )
@@ -151,6 +153,24 @@ def put_theme_assets(site_id)
151
153
  end
152
154
  end
153
155
 
156
+ def publish(site_id, quiet = true)
157
+ site = Siteleaf::Site.new(id: site_id)
158
+ job = site.publish
159
+
160
+ if quiet
161
+ puts "=> Publish queued.\n"
162
+ else
163
+ last_msg = nil
164
+ job.stream do |s|
165
+ if (msg = s["message"]) && (msg != last_msg)
166
+ puts msg
167
+ last_msg = msg
168
+ end
169
+ end
170
+ puts "=> Publish completed.\n"
171
+ end
172
+ end
173
+
154
174
  case ARGV[0]
155
175
  when '-v', '--version', 'version'
156
176
  puts Siteleaf::VERSION
@@ -210,6 +230,15 @@ when 'push'
210
230
  else
211
231
  puts "`#{ARGV[0]}` command not found.\n"
212
232
  end
233
+ when 'publish'
234
+ if auth != false
235
+ quiet = %w[-q --quiet].include?(ARGV[1]) && ARGV[1]
236
+ if site_id = get_site_id
237
+ publish(site_id, quiet)
238
+ else
239
+ puts "Site not configured, run `siteleaf config yoursite.com`.\n"
240
+ end
241
+ end
213
242
  else
214
243
  puts "`#{ARGV[0]}` command not found.\n"
215
244
  puts help
data/lib/siteleaf.rb CHANGED
@@ -5,6 +5,7 @@ require 'siteleaf/version'
5
5
  require 'siteleaf/client'
6
6
  require 'siteleaf/entity'
7
7
  require 'siteleaf/asset'
8
+ require 'siteleaf/job'
8
9
  require 'siteleaf/page'
9
10
  require 'siteleaf/post'
10
11
  require 'siteleaf/server'
@@ -0,0 +1,20 @@
1
+ module Siteleaf
2
+ class Job < Entity
3
+
4
+ attr_reader :id
5
+
6
+ def stream(&callback)
7
+ HTTParty.send(:get, Siteleaf.api_url("jobs/#{self.id}"), {
8
+ :basic_auth => {:username => Siteleaf.api_key, :password => Siteleaf.api_secret},
9
+ :stream_body => true
10
+ }) do |fragment|
11
+ if str = fragment.match(/{.*}/)
12
+ if json = JSON.parse(str[0])
13
+ callback.call(json)
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ end
20
+ end
data/lib/siteleaf/page.rb CHANGED
@@ -23,8 +23,8 @@ module Siteleaf
23
23
  end
24
24
 
25
25
  def pages
26
- result = Client.get "pages/#{self.id}/pages"
27
- result.map { |r| self.new(r) } if result
26
+ result = Client.get "pages/#{self.id}?include=pages"
27
+ result["pages"].map { |r| Page.new(r) } if result
28
28
  end
29
29
 
30
30
  def page
data/lib/siteleaf/site.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Siteleaf
2
2
  class Site < Entity
3
3
 
4
- attr_accessor :title, :domain, :timezone
4
+ attr_accessor :title, :domain, :timezone, :meta
5
5
  attr_reader :id, :user_id, :created_at, :updated_at
6
6
 
7
7
  def self.find_by_domain(domain)
@@ -35,5 +35,10 @@ module Siteleaf
35
35
  Client.post "sites/#{self.id}/preview", {"url" => url, "template" => template}
36
36
  end
37
37
 
38
+ def publish
39
+ result = Client.post "sites/#{self.id}/publish", {}
40
+ Job.new(id: result.parsed_response["job_id"]) if result
41
+ end
42
+
38
43
  end
39
44
  end
@@ -1,3 +1,3 @@
1
1
  module Siteleaf
2
- VERSION = "0.9.22"
2
+ VERSION = "0.9.23"
3
3
  end
data/siteleaf.gemspec CHANGED
@@ -13,10 +13,10 @@ Gem::Specification.new do |gem|
13
13
  gem.summary = "Siteleaf Ruby interface"
14
14
  gem.homepage = "http://siteleaf.com"
15
15
 
16
- gem.required_ruby_version = '>= 1.8'
16
+ gem.required_ruby_version = '>= 1.9.3'
17
17
 
18
- gem.add_dependency 'httparty', '<= 0.11'
19
- gem.add_dependency 'httmultiparty', '<= 0.3.12'
18
+ gem.add_dependency 'httparty', '>= 0.13.3'
19
+ gem.add_dependency 'httmultiparty', '>= 0.3.13'
20
20
  gem.add_dependency 'rack'
21
21
 
22
22
  gem.files = `git ls-files`.split($/)
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: siteleaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.22
5
- prerelease:
4
+ version: 0.9.23
6
5
  platform: ruby
7
6
  authors:
8
7
  - Siteleaf
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-07-28 00:00:00.000000000 Z
11
+ date: 2015-06-24 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - <=
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
- version: '0.11'
19
+ version: 0.13.3
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - <=
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
- version: '0.11'
26
+ version: 0.13.3
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: httmultiparty
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - <=
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
- version: 0.3.12
33
+ version: 0.3.13
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - <=
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
- version: 0.3.12
40
+ version: 0.3.13
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rack
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  description: A Ruby interface and command line utility for the Siteleaf API.
@@ -77,6 +70,7 @@ files:
77
70
  - lib/siteleaf/asset.rb
78
71
  - lib/siteleaf/client.rb
79
72
  - lib/siteleaf/entity.rb
73
+ - lib/siteleaf/job.rb
80
74
  - lib/siteleaf/page.rb
81
75
  - lib/siteleaf/post.rb
82
76
  - lib/siteleaf/server.rb
@@ -88,26 +82,25 @@ files:
88
82
  homepage: http://siteleaf.com
89
83
  licenses:
90
84
  - MIT
85
+ metadata: {}
91
86
  post_install_message:
92
87
  rdoc_options: []
93
88
  require_paths:
94
89
  - lib
95
90
  required_ruby_version: !ruby/object:Gem::Requirement
96
- none: false
97
91
  requirements:
98
- - - ! '>='
92
+ - - '>='
99
93
  - !ruby/object:Gem::Version
100
- version: '1.8'
94
+ version: 1.9.3
101
95
  required_rubygems_version: !ruby/object:Gem::Requirement
102
- none: false
103
96
  requirements:
104
- - - ! '>='
97
+ - - '>='
105
98
  - !ruby/object:Gem::Version
106
99
  version: '0'
107
100
  requirements: []
108
101
  rubyforge_project:
109
- rubygems_version: 1.8.23
102
+ rubygems_version: 2.4.7
110
103
  signing_key:
111
- specification_version: 3
104
+ specification_version: 4
112
105
  summary: Siteleaf Ruby interface
113
106
  test_files: []