artifact 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/artifact.gemspec +0 -2
- data/lib/artifact/app.rb +3 -6
- data/lib/artifact/helpers.rb +2 -6
- data/lib/artifact/middleman.rb +8 -0
- data/lib/artifact/version.rb +1 -1
- metadata +2 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bda99fa0e5fde0177d4744d68fd15f6468a7c30
|
4
|
+
data.tar.gz: cdf2bb96ae7f24420fa80374d8a72f5b78cb5551
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60e0a5ac8cc6037aa5b4bfa421551d616b14430fbe67f964255d461a1532673db83e13f26433d9cdd3ad2bfe2e3e8ef2d1ee97971030e1a93f762906f7da998c
|
7
|
+
data.tar.gz: 85355c680662dec4cdd41b5e34d7526fb2e7564e0efbbfea95f29c7cce45042c0cb3b7cb9c4b030144132085737c9cb0b7e2a3bb5dc3466f6a84fe04ab6ba72f
|
data/artifact.gemspec
CHANGED
data/lib/artifact/app.rb
CHANGED
@@ -1,20 +1,17 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'helpers')
|
2
|
-
%w(sinatra/base active_support/inflector
|
2
|
+
%w(sinatra/base active_support/inflector).each { |lib| require lib }
|
3
3
|
|
4
4
|
module Artifact
|
5
5
|
|
6
6
|
class App < Sinatra::Base
|
7
7
|
|
8
|
-
set :method_override, true
|
9
8
|
set :sessions, true
|
10
|
-
set :views, File.
|
9
|
+
set :views, File.join(settings.root, 'views')
|
11
10
|
|
12
11
|
use Rack::ShowExceptions
|
13
|
-
# use Rack::CommonLogger, LOGGER
|
14
|
-
# use Rack::Flash
|
15
12
|
use Rack::Static,
|
16
13
|
:urls => %w(/css /img /js),
|
17
|
-
:root => File.
|
14
|
+
:root => File.join(settings.root, 'public')
|
18
15
|
|
19
16
|
helpers do
|
20
17
|
# include Rack::Utils # provides escape, parse_query and unescape
|
data/lib/artifact/helpers.rb
CHANGED
@@ -42,21 +42,17 @@ module Artifact
|
|
42
42
|
# paths, links
|
43
43
|
#########################################
|
44
44
|
|
45
|
-
def base_path
|
46
|
-
env['SCRIPT_NAME']
|
47
|
-
end
|
48
|
-
|
49
45
|
def get_class_name(klass)
|
50
46
|
klass.name.to_s.split("::").last
|
51
47
|
end
|
52
48
|
|
53
49
|
def guess_model_path(m)
|
54
|
-
|
50
|
+
'/' + get_class_name(m).pluralize.downcase
|
55
51
|
end
|
56
52
|
|
57
53
|
def url_for(object)
|
58
54
|
object.nil? ? "#" : object.is_a?(String) ? object \
|
59
|
-
: object.respond_to?(:path) ? object.path : "#{guess_model_path(object.class)}/#{object.to_param}"
|
55
|
+
: object.respond_to?(:path) ? url(object.path) : url("#{guess_model_path(object.class)}/#{object.to_param}")
|
60
56
|
end
|
61
57
|
|
62
58
|
def link_to(string, resource)
|
data/lib/artifact/middleman.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'app')
|
2
2
|
require 'active_support'
|
3
3
|
|
4
|
+
require 'middleman-core/sitemap'
|
5
|
+
require 'middleman-core/core_extensions/front_matter'
|
6
|
+
|
4
7
|
class Middleman::Sitemap::Store
|
5
8
|
|
6
9
|
alias_method :original_initialize, :initialize
|
@@ -193,6 +196,11 @@ module Artifact
|
|
193
196
|
def updated!
|
194
197
|
return if Artifact.middleman.nil? # not loaded yet!
|
195
198
|
|
199
|
+
# set environment to build so the whole app doesn't get reloaded
|
200
|
+
# for each file inside the reload_path block
|
201
|
+
# ref: https://github.com/middleman/middleman/blob/v3-stable/middleman-core/lib/middleman-core/sitemap/extensions/on_disk.rb#L62
|
202
|
+
Artifact.middleman.config[:environment] = :build
|
203
|
+
|
196
204
|
puts "Reloading Middleman..."
|
197
205
|
Artifact.middleman.files.reload_path(Artifact.drafts.path)
|
198
206
|
Artifact.middleman.files.reload_path(Artifact.posts.path)
|
data/lib/artifact/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artifact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomás Pollak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,34 +108,6 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: sinatra-contrib
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rack-flash3
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :runtime
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
111
|
description: Frontend UI for git blogging.
|
140
112
|
email:
|
141
113
|
- tomas@forkhq.com
|