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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e79feef5a99e24c60cc8a5bd3cc45e9b8c02739c
4
- data.tar.gz: 1cc7825dad9f2d6240626055db3c1f863bd9f88f
3
+ metadata.gz: 0bda99fa0e5fde0177d4744d68fd15f6468a7c30
4
+ data.tar.gz: cdf2bb96ae7f24420fa80374d8a72f5b78cb5551
5
5
  SHA512:
6
- metadata.gz: 1bb13911e6984f007950ca058d7959538547d9410f73481350c54721870b3a96be2eec8acfd5d755bcf3e857b3d3ff141eb2b60c23a68203598b6cdc4f63205a
7
- data.tar.gz: 4b07499de205b9248530b699f5a016fd01b9ea4afa253d2a1fd3ad819cb1129bc2175b7332ef68a12adbaac5df9a8afe3fd412723c4bb61c258f53ad1e12d260
6
+ metadata.gz: 60e0a5ac8cc6037aa5b4bfa421551d616b14430fbe67f964255d461a1532673db83e13f26433d9cdd3ad2bfe2e3e8ef2d1ee97971030e1a93f762906f7da998c
7
+ data.tar.gz: 85355c680662dec4cdd41b5e34d7526fb2e7564e0efbbfea95f29c7cce45042c0cb3b7cb9c4b030144132085737c9cb0b7e2a3bb5dc3466f6a84fe04ab6ba72f
data/artifact.gemspec CHANGED
@@ -26,6 +26,4 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency "activesupport"
27
27
  spec.add_dependency "rugged"
28
28
  spec.add_dependency "sinatra"
29
- spec.add_dependency "sinatra-contrib"
30
- spec.add_dependency "rack-flash3"
31
29
  end
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 json).each { |lib| require lib }
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.expand_path(File.join(File.dirname(__FILE__), 'views'))
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.expand_path(File.join(File.dirname(__FILE__), 'public'))
14
+ :root => File.join(settings.root, 'public')
18
15
 
19
16
  helpers do
20
17
  # include Rack::Utils # provides escape, parse_query and unescape
@@ -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
- base_path + '/' + get_class_name(m).pluralize.downcase
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)
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Artifact
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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: 2014-10-23 00:00:00.000000000 Z
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