jekyll-admin 0.1.0.pre2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ module JekyllAdmin
7
7
 
8
8
  get "/:page_id" do
9
9
  ensure_page
10
- json page.to_api
10
+ json page.to_api(:include_content => true)
11
11
  end
12
12
 
13
13
  put "/:page_id" do
@@ -18,7 +18,8 @@ module JekyllAdmin
18
18
  end
19
19
 
20
20
  write_file(page_path, page_body)
21
- json page.to_api
21
+ ensure_page
22
+ json page.to_api(:include_content => true)
22
23
  end
23
24
 
24
25
  delete "/:page_id" do
@@ -7,7 +7,7 @@ module JekyllAdmin
7
7
 
8
8
  get "/*" do
9
9
  if static_file
10
- json static_file.to_api
10
+ json static_file.to_api(:include_content => true)
11
11
  elsif !static_files_for_path.empty?
12
12
  json static_files_for_path.map(&:to_api)
13
13
  else
@@ -17,7 +17,8 @@ module JekyllAdmin
17
17
 
18
18
  put "/*" do
19
19
  write_file(static_file_path, static_file_body)
20
- json static_file.to_api
20
+ ensure_static_file_exists
21
+ json static_file.to_api(:include_content => true)
21
22
  end
22
23
 
23
24
  delete "/*" do
@@ -0,0 +1,60 @@
1
+ module JekyllAdmin
2
+ # Abstract module to be included in Convertible and Document to provide
3
+ # additional, URL-specific functionality without duplicating logic
4
+ module URLable
5
+
6
+ # Absolute URL to the HTTP(S) rendered/served representation of this resource
7
+ def http_url
8
+ return if is_a?(Jekyll::Collection) || is_a?(JekyllAdmin::DataFile)
9
+ return if is_a?(Jekyll::Document) && !collection.write?
10
+ @http_url ||= Addressable::URI.new(
11
+ :scheme => scheme, :host => host, :port => port,
12
+ :path => path_with_base(JekyllAdmin.site.config["baseurl"], url)
13
+ ).normalize.to_s
14
+ end
15
+
16
+ # Absolute URL to the API representation of this resource
17
+ def api_url
18
+ @api_url ||= Addressable::URI.new(
19
+ :scheme => scheme, :host => host, :port => port,
20
+ :path => path_with_base("/_api", resource_path)
21
+ ).normalize.to_s
22
+ end
23
+
24
+ private
25
+
26
+ # URL path relative to `_api/` to retreive the given resource via the API
27
+ # Note: we can't use a case statement here, because === doesn't like includes
28
+ def resource_path
29
+ if is_a?(Jekyll::Document)
30
+ "/collections/#{relative_path.sub(%r!\A_!, "")}"
31
+ elsif is_a?(Jekyll::Collection)
32
+ "/collections/#{label}"
33
+ elsif is_a?(JekyllAdmin::DataFile)
34
+ relative_path.sub(%r!\A#{JekyllAdmin.site.config["data_dir"]}!, "/data")
35
+ elsif is_a?(Jekyll::StaticFile)
36
+ "/static_files/#{relative_path}"
37
+ elsif is_a?(Jekyll::Page)
38
+ "/pages/#{relative_path}"
39
+ end
40
+ end
41
+
42
+ # URI.join doesn't like joining two relative paths, and File.join may join
43
+ # with `\` rather than with `/` on windows
44
+ def path_with_base(base, path)
45
+ [base, path].join("/").squeeze("/")
46
+ end
47
+
48
+ def scheme
49
+ JekyllAdmin.site.config["scheme"] || "http"
50
+ end
51
+
52
+ def host
53
+ JekyllAdmin.site.config["host"].sub("127.0.0.1", "localhost")
54
+ end
55
+
56
+ def port
57
+ JekyllAdmin.site.config["port"]
58
+ end
59
+ end
60
+ end
@@ -1,3 +1,3 @@
1
1
  module JekyllAdmin
2
- VERSION = "0.1.0.pre2".freeze
2
+ VERSION = "0.1.0".freeze
3
3
  end
@@ -20,6 +20,7 @@ module Jekyll
20
20
  def jekyll_admin_monkey_patch(server)
21
21
  server.mount "/admin", Rack::Handler::WEBrick, JekyllAdmin::StaticServer
22
22
  server.mount "/_api", Rack::Handler::WEBrick, JekyllAdmin::Server
23
+ Jekyll.logger.info "JekyllAdmin mode:", ENV["RACK_ENV"] || "production"
23
24
  end
24
25
  end
25
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mert Kahyaoğlu
@@ -9,132 +9,146 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-08-18 00:00:00.000000000 Z
12
+ date: 2016-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '3.1'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: '3.1'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: sinatra
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
34
  version: '1.4'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: '1.4'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: sinatra-contrib
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
48
  version: '1.4'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.4'
56
+ - !ruby/object:Gem::Dependency
57
+ name: addressable
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: '2.4'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '2.4'
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: bundler
58
72
  requirement: !ruby/object:Gem::Requirement
59
73
  requirements:
60
- - - "~>"
74
+ - - ~>
61
75
  - !ruby/object:Gem::Version
62
76
  version: '1.7'
63
77
  type: :development
64
78
  prerelease: false
65
79
  version_requirements: !ruby/object:Gem::Requirement
66
80
  requirements:
67
- - - "~>"
81
+ - - ~>
68
82
  - !ruby/object:Gem::Version
69
83
  version: '1.7'
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: rake
72
86
  requirement: !ruby/object:Gem::Requirement
73
87
  requirements:
74
- - - "~>"
88
+ - - ~>
75
89
  - !ruby/object:Gem::Version
76
90
  version: '10.0'
77
91
  type: :development
78
92
  prerelease: false
79
93
  version_requirements: !ruby/object:Gem::Requirement
80
94
  requirements:
81
- - - "~>"
95
+ - - ~>
82
96
  - !ruby/object:Gem::Version
83
97
  version: '10.0'
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: rspec
86
100
  requirement: !ruby/object:Gem::Requirement
87
101
  requirements:
88
- - - "~>"
102
+ - - ~>
89
103
  - !ruby/object:Gem::Version
90
104
  version: '3.4'
91
105
  type: :development
92
106
  prerelease: false
93
107
  version_requirements: !ruby/object:Gem::Requirement
94
108
  requirements:
95
- - - "~>"
109
+ - - ~>
96
110
  - !ruby/object:Gem::Version
97
111
  version: '3.4'
98
112
  - !ruby/object:Gem::Dependency
99
113
  name: rubocop
100
114
  requirement: !ruby/object:Gem::Requirement
101
115
  requirements:
102
- - - "~>"
116
+ - - ~>
103
117
  - !ruby/object:Gem::Version
104
118
  version: '0.35'
105
119
  type: :development
106
120
  prerelease: false
107
121
  version_requirements: !ruby/object:Gem::Requirement
108
122
  requirements:
109
- - - "~>"
123
+ - - ~>
110
124
  - !ruby/object:Gem::Version
111
125
  version: '0.35'
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: sinatra-cross_origin
114
128
  requirement: !ruby/object:Gem::Requirement
115
129
  requirements:
116
- - - "~>"
130
+ - - ~>
117
131
  - !ruby/object:Gem::Version
118
132
  version: '0.3'
119
133
  type: :development
120
134
  prerelease: false
121
135
  version_requirements: !ruby/object:Gem::Requirement
122
136
  requirements:
123
- - - "~>"
137
+ - - ~>
124
138
  - !ruby/object:Gem::Version
125
139
  version: '0.3'
126
140
  - !ruby/object:Gem::Dependency
127
141
  name: gem-release
128
142
  requirement: !ruby/object:Gem::Requirement
129
143
  requirements:
130
- - - "~>"
144
+ - - ~>
131
145
  - !ruby/object:Gem::Version
132
146
  version: '0.7'
133
147
  type: :development
134
148
  prerelease: false
135
149
  version_requirements: !ruby/object:Gem::Requirement
136
150
  requirements:
137
- - - "~>"
151
+ - - ~>
138
152
  - !ruby/object:Gem::Version
139
153
  version: '0.7'
140
154
  description: Jekyll::Admin is a drop in administrative framework for Jekyll sites.
@@ -145,9 +159,7 @@ executables: []
145
159
  extensions: []
146
160
  extra_rdoc_files: []
147
161
  files:
148
- - LICENSE
149
- - README.md
150
- - lib/jekyll-admin.rb
162
+ - lib/jekyll/commands/serve.rb
151
163
  - lib/jekyll-admin/apiable.rb
152
164
  - lib/jekyll-admin/data_file.rb
153
165
  - lib/jekyll-admin/public/03945ac4fc7fdefc44bc110bf1ba2393.svg
@@ -170,15 +182,18 @@ files:
170
182
  - lib/jekyll-admin/public/index.html
171
183
  - lib/jekyll-admin/public/styles.css
172
184
  - lib/jekyll-admin/public/styles.css.map
173
- - lib/jekyll-admin/server.rb
174
185
  - lib/jekyll-admin/server/collection.rb
175
186
  - lib/jekyll-admin/server/configuration.rb
176
187
  - lib/jekyll-admin/server/data.rb
177
188
  - lib/jekyll-admin/server/page.rb
178
189
  - lib/jekyll-admin/server/static_file.rb
190
+ - lib/jekyll-admin/server.rb
179
191
  - lib/jekyll-admin/static_server.rb
192
+ - lib/jekyll-admin/urlable.rb
180
193
  - lib/jekyll-admin/version.rb
181
- - lib/jekyll/commands/serve.rb
194
+ - lib/jekyll-admin.rb
195
+ - LICENSE
196
+ - README.md
182
197
  homepage: https://github.com/jekyll/jekyll-admin
183
198
  licenses:
184
199
  - MIT
@@ -190,17 +205,17 @@ require_paths:
190
205
  - lib
191
206
  required_ruby_version: !ruby/object:Gem::Requirement
192
207
  requirements:
193
- - - ">="
208
+ - - '>='
194
209
  - !ruby/object:Gem::Version
195
210
  version: '0'
196
211
  required_rubygems_version: !ruby/object:Gem::Requirement
197
212
  requirements:
198
- - - ">"
213
+ - - '>='
199
214
  - !ruby/object:Gem::Version
200
- version: 1.3.1
215
+ version: '0'
201
216
  requirements: []
202
217
  rubyforge_project:
203
- rubygems_version: 2.6.6
218
+ rubygems_version: 2.0.14.1
204
219
  signing_key:
205
220
  specification_version: 4
206
221
  summary: wp-admin for Jekyll, but better