siteleaf 1.0.11 → 2.0.0.pre.beta1

Sign up to get free protection for your applications and to get access to all the features.
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.11
4
+ version: 2.0.0.pre.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siteleaf
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-23 00:00:00.000000000 Z
11
+ date: 2015-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.14.0
19
+ version: 0.13.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.14.0
26
+ version: 0.13.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httmultiparty
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -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.17
47
+ version: 2.0.8
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.17
54
+ version: 2.0.8
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rack
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -75,23 +75,24 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
- - ".rbenv-vars"
79
78
  - Gemfile
80
79
  - LICENSE.txt
81
80
  - README.md
82
81
  - Rakefile
83
82
  - bin/siteleaf
84
- - lib/patches/time_with_zone_encode_with.rb
85
83
  - lib/siteleaf.rb
86
84
  - lib/siteleaf/asset.rb
87
85
  - lib/siteleaf/client.rb
86
+ - lib/siteleaf/collection.rb
87
+ - lib/siteleaf/content.rb
88
+ - lib/siteleaf/document.rb
88
89
  - lib/siteleaf/entity.rb
90
+ - lib/siteleaf/file.rb
89
91
  - lib/siteleaf/job.rb
90
92
  - lib/siteleaf/page.rb
91
93
  - lib/siteleaf/post.rb
92
- - lib/siteleaf/server.rb
93
94
  - lib/siteleaf/site.rb
94
- - lib/siteleaf/theme.rb
95
+ - lib/siteleaf/upload.rb
95
96
  - lib/siteleaf/user.rb
96
97
  - lib/siteleaf/version.rb
97
98
  - siteleaf.gemspec
@@ -99,7 +100,7 @@ homepage: http://siteleaf.com
99
100
  licenses:
100
101
  - MIT
101
102
  metadata: {}
102
- post_install_message:
103
+ post_install_message:
103
104
  rdoc_options: []
104
105
  require_paths:
105
106
  - lib
@@ -110,12 +111,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
111
  version: 1.9.3
111
112
  required_rubygems_version: !ruby/object:Gem::Requirement
112
113
  requirements:
113
- - - ">="
114
+ - - ">"
114
115
  - !ruby/object:Gem::Version
115
- version: '0'
116
+ version: 1.3.1
116
117
  requirements: []
117
- rubygems_version: 3.1.6
118
- signing_key:
118
+ rubyforge_project:
119
+ rubygems_version: 2.4.7
120
+ signing_key:
119
121
  specification_version: 4
120
122
  summary: Siteleaf Ruby interface
121
123
  test_files: []
data/.rbenv-vars DELETED
@@ -1,2 +0,0 @@
1
- EXCON_DEBUG=true
2
- DEBUG=true
@@ -1,12 +0,0 @@
1
- class Time
2
- def encode_with(coder)
3
- label =
4
- if utc?
5
- usec.zero? ? '%Y-%m-%d %H:%M:%S Z' : '%Y-%m-%d %H:%M:%S.%9N Z'
6
- else
7
- usec.zero? ? '%Y-%m-%d %H:%M:%S %:z' : '%Y-%m-%d %H:%M:%S.%9N %:z'
8
- end
9
-
10
- coder.represent_scalar(nil, strftime(label))
11
- end
12
- end
@@ -1,81 +0,0 @@
1
- module Siteleaf
2
- class Server
3
-
4
- attr_accessor :site_id
5
-
6
- def initialize(attributes = {})
7
- self.site_id = attributes[:site_id]
8
- end
9
-
10
- def resolve_template(url = "/")
11
- path = url.gsub(/\/\z|\A\//, '') #strip beginning and trailing slashes
12
- paths = path.split("/")
13
- templates = []
14
-
15
- if ['sitemap.xml','feed.xml'].include?(path)
16
- templates.push(path)
17
- else
18
- if path == ""
19
- templates.push("index.html")
20
- else
21
- templates.push("#{paths.join('/')}.html")
22
- templates.push("#{paths.join('/')}/index.html")
23
- templates.push("#{paths.join('/')}/default.html")
24
- while paths.size > 0
25
- paths.pop
26
- templates.push("#{paths.join('/')}/default.html") if paths.size > 0
27
- end
28
- end
29
- templates.push("default.html")
30
- end
31
-
32
- templates.each do |t|
33
- return File.read(t) if File.exist?(t)
34
- end
35
-
36
- return nil
37
- end
38
-
39
- def call(env)
40
- require 'uri'
41
-
42
- site = Siteleaf::Site.new({:id => self.site_id})
43
-
44
- url = URI.unescape(env['PATH_INFO'])
45
- path = url.gsub(/\/\z|\A\//, '') #strip beginning and trailing slashes
46
-
47
- if !['sitemap.xml','feed.xml'].include?(path) and !File.directory?(path) and File.exist?(path)
48
- Rack::File.new(Dir.pwd).call(env)
49
- else
50
- template_data = nil
51
- is_asset = /^(?!(sitemap|feed)\.xml)(assets|.*\.)/.match(path)
52
-
53
- if is_asset and !File.exist?("#{path}.liquid")
54
- output = site.resolve(url)
55
- if output.code == 200
56
- require 'open-uri'
57
- asset = open(output['file']['url'])
58
- [output.code, {'Content-Type' => asset.content_type, 'Content-Length' => asset.size.to_s}, [asset.read]]
59
- else
60
- [output.code, {'Content-Type' => 'text/html', 'Content-Length' => output.size.to_s}, [output.to_s]]
61
- end
62
- else
63
- if (File.exist?("#{path}.liquid") and template_data = File.read("#{path}.liquid")) or (template_data = resolve_template(url))
64
- # compile liquid includes into a single page
65
- include_tags = /\{\%\s+include\s+['"]([A-Za-z0-9_\-\/]+)['"]\s+\%\}/
66
- while include_tags.match(template_data)
67
- template_data = template_data.gsub(include_tags) { |i| File.read("_#{$1}.html") }
68
- end
69
- end
70
-
71
- output = site.preview(url, template_data)
72
- if output.code == 200 && output.headers["content-type"]
73
- [output.code, {'Content-Type' => output.headers["content-type"], 'Content-Length' => output.size.to_s}, [output.to_s]]
74
- else
75
- [output.code, {'Content-Type' => 'text/html', 'Content-Length' => output.size.to_s}, [output.to_s]]
76
- end
77
- end
78
- end
79
- end
80
- end
81
- end
@@ -1,25 +0,0 @@
1
- module Siteleaf
2
- class Theme < Entity
3
-
4
- attr_accessor :name, :site_id
5
- attr_reader :id, :created_at, :updated_at
6
-
7
- def self.find_by_site_id(site_id)
8
- Site.new({:id => site_id}).theme
9
- end
10
-
11
- def self.assets_by_site_id(site_id)
12
- Theme.new({:site_id => site_id}).assets
13
- end
14
-
15
- def site
16
- Site.find(self.site_id)
17
- end
18
-
19
- def assets
20
- result = Client.get "sites/#{self.site_id}/theme/assets"
21
- result.map { |r| Asset.new(r) } if result
22
- end
23
-
24
- end
25
- end