middleman 2.0.9.pre.2 → 2.0.9.pre.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/CHANGELOG +9 -0
  2. data/features/builder.feature +6 -0
  3. data/features/data.feature +16 -1
  4. data/features/fonts.feature +11 -0
  5. data/features/relative_assets.feature +8 -2
  6. data/features/step_definitions/middleman_steps.rb +9 -2
  7. data/fixtures/data-app/config.rb +3 -0
  8. data/fixtures/data-app/data/pages.yml +6 -0
  9. data/fixtures/data-app/source/index.html.haml +1 -0
  10. data/fixtures/data-app/source/layout.haml +3 -0
  11. data/fixtures/fonts-app/config.rb +0 -0
  12. data/fixtures/fonts-app/source/fonts/StMarie-Thin.otf +0 -0
  13. data/fixtures/fonts-app/source/stylesheets/fonts.css.sass +3 -0
  14. data/fixtures/glob-app/config.rb +1 -0
  15. data/fixtures/glob-app/source/index.html.haml +6 -0
  16. data/fixtures/glob-app/source/stylesheets/site.css.sass +1 -0
  17. data/fixtures/test-app/config.rb +1 -0
  18. data/fixtures/test-app/data/test2.json +4 -0
  19. data/fixtures/test-app/source/data3.html.erb +1 -0
  20. data/lib/middleman/base.rb +8 -3
  21. data/lib/middleman/builder.rb +61 -22
  22. data/lib/middleman/cli.rb +2 -1
  23. data/lib/middleman/core_extensions/assets.rb +1 -1
  24. data/lib/middleman/core_extensions/compass.rb +6 -2
  25. data/lib/middleman/core_extensions/data.rb +20 -3
  26. data/lib/middleman/templates/html5.rb +1 -0
  27. data/lib/middleman/templates/mobile.rb +17 -0
  28. data/lib/middleman/templates/mobile/source/404.html +38 -0
  29. data/lib/middleman/templates/mobile/source/README.markdown +64 -0
  30. data/lib/middleman/templates/mobile/source/crossdomain.xml +25 -0
  31. data/lib/middleman/templates/mobile/source/css/style.css +236 -0
  32. data/lib/middleman/templates/mobile/source/default.appcache +17 -0
  33. data/lib/middleman/templates/mobile/source/humans.txt +43 -0
  34. data/lib/middleman/templates/mobile/source/img/h/apple-touch-icon.png +0 -0
  35. data/lib/middleman/templates/mobile/source/img/h/splash.png +0 -0
  36. data/lib/middleman/templates/mobile/source/img/l/apple-touch-icon-precomposed.png +0 -0
  37. data/lib/middleman/templates/mobile/source/img/l/apple-touch-icon.png +0 -0
  38. data/lib/middleman/templates/mobile/source/img/l/splash.png +0 -0
  39. data/lib/middleman/templates/mobile/source/img/m/apple-touch-icon.png +0 -0
  40. data/lib/middleman/templates/mobile/source/index.html +95 -0
  41. data/lib/middleman/templates/mobile/source/js/libs/jquery-1.5.1.js +8316 -0
  42. data/lib/middleman/templates/mobile/source/js/libs/jquery-1.5.1.min.js +16 -0
  43. data/lib/middleman/templates/mobile/source/js/libs/modernizr-custom.js +14 -0
  44. data/lib/middleman/templates/mobile/source/js/libs/respond.min.js +7 -0
  45. data/lib/middleman/templates/mobile/source/js/mylibs/helper.js +147 -0
  46. data/lib/middleman/templates/mobile/source/js/script.js +0 -0
  47. data/lib/middleman/templates/mobile/source/robots.txt +5 -0
  48. data/lib/middleman/templates/mobile/source/sitemap.xml +10 -0
  49. data/lib/middleman/templates/mobile/source/test/index.html +31 -0
  50. data/lib/middleman/templates/mobile/source/test/qunit/qunit.css +148 -0
  51. data/lib/middleman/templates/mobile/source/test/qunit/qunit.js +1265 -0
  52. data/lib/middleman/templates/mobile/source/test/tests.js +26 -0
  53. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/Readme.PDF +0 -0
  54. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/aspx/aspx1.snippet +31 -0
  55. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/aspx/aspx2.snippet +2 -0
  56. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/aspx/ga.aspx +195 -0
  57. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/aspx/sample.aspx +44 -0
  58. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/jsp/ga.jsp +225 -0
  59. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/jsp/jsp1.snippet +35 -0
  60. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/jsp/jsp2.snippet +2 -0
  61. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/jsp/sample.jsp +51 -0
  62. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/php/ga.php +176 -0
  63. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/php/php1.snippet +30 -0
  64. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/php/php2.snippet +4 -0
  65. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/php/sample.php +44 -0
  66. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/pl/ga.pl +195 -0
  67. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/pl/perl1.snippet +27 -0
  68. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/pl/perl2.snippet +1 -0
  69. data/lib/middleman/templates/mobile/source/tools/googleanalyticsformobile/pl/sample.pl +38 -0
  70. data/lib/middleman/templates/mobile/source/tools/mobile-bookmark-bubble/COPYING +202 -0
  71. data/lib/middleman/templates/mobile/source/tools/mobile-bookmark-bubble/bookmark_bubble.js +559 -0
  72. data/lib/middleman/templates/mobile/source/tools/mobile-bookmark-bubble/example/example.html +43 -0
  73. data/lib/middleman/templates/mobile/source/tools/mobile-bookmark-bubble/example/example.js +57 -0
  74. data/lib/middleman/templates/mobile/source/tools/mobile-bookmark-bubble/images/arrow.png +0 -0
  75. data/lib/middleman/templates/mobile/source/tools/mobile-bookmark-bubble/images/close.png +0 -0
  76. data/lib/middleman/templates/mobile/source/tools/mobile-bookmark-bubble/images/generate_base64_images +33 -0
  77. data/lib/middleman/templates/mobile/source/tools/mobile-bookmark-bubble/images/icon_calendar.png +0 -0
  78. data/lib/middleman/templates/mobile/source/tools/wspl/README +27 -0
  79. data/lib/middleman/templates/mobile/source/tools/wspl/databasefactory.js +45 -0
  80. data/lib/middleman/templates/mobile/source/tools/wspl/dbworker.js +324 -0
  81. data/lib/middleman/templates/mobile/source/tools/wspl/dbworker_test.html +393 -0
  82. data/lib/middleman/templates/mobile/source/tools/wspl/dbworkerstarter.js +32 -0
  83. data/lib/middleman/templates/mobile/source/tools/wspl/dbwrapper_gears.js +595 -0
  84. data/lib/middleman/templates/mobile/source/tools/wspl/dbwrapper_gears_test.html +404 -0
  85. data/lib/middleman/templates/mobile/source/tools/wspl/dbwrapper_html5.js +203 -0
  86. data/lib/middleman/templates/mobile/source/tools/wspl/dbwrapper_html5_test.html +468 -0
  87. data/lib/middleman/templates/mobile/source/tools/wspl/dbwrapperapi.js +202 -0
  88. data/lib/middleman/templates/mobile/source/tools/wspl/dbwrapperapi_test.html +51 -0
  89. data/lib/middleman/templates/mobile/source/tools/wspl/gears_resultset.js +71 -0
  90. data/lib/middleman/templates/mobile/source/tools/wspl/gears_resultset_test.html +86 -0
  91. data/lib/middleman/templates/mobile/source/tools/wspl/gears_transaction.js +196 -0
  92. data/lib/middleman/templates/mobile/source/tools/wspl/gears_transaction_test.html +221 -0
  93. data/lib/middleman/templates/mobile/source/tools/wspl/gearsutils.js +94 -0
  94. data/lib/middleman/templates/mobile/source/tools/wspl/gearsutils_test.html +84 -0
  95. data/lib/middleman/templates/mobile/source/tools/wspl/global_functions.js +72 -0
  96. data/lib/middleman/templates/mobile/source/tools/wspl/simplenotes/index.html +347 -0
  97. data/lib/middleman/templates/mobile/source/tools/wspl/simplenotes/simplenotes.js +503 -0
  98. data/lib/middleman/templates/mobile/source/tools/wspl/simplenotes/styles.css +66 -0
  99. data/lib/middleman/templates/mobile/source/tools/wspl/simplenotes/template.js +75 -0
  100. data/lib/middleman/version.rb +1 -1
  101. data/middleman-x86-mingw32.gemspec +0 -1
  102. data/middleman.gemspec +3 -2
  103. metadata +116 -51
  104. data/lib/middleman/config.ru +0 -2
  105. data/lib/middleman/features/tiny_src.rb +0 -11
data/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ 2.0.9
2
+ =====
3
+ - Added --glob option to build which only builds matching files
4
+ - Allow data/ files to be in JSON format as well
5
+ - Enabled Liquid {% include %} tag
6
+ - RubyInstaller-specific gem
7
+ - Allow access to data/ in config.rb
8
+ - Add mobile html5boilerplate template
9
+
1
10
  2.0.8
2
11
  =====
3
12
  - Support accessing variables and data objects in ERb Sprockets files (library.js.coffee.erb)
@@ -17,6 +17,12 @@ Feature: Builder
17
17
  Then "images/Child folder/regular_file(example).txt" should exist at "test-app"
18
18
  And cleanup built app at "test-app"
19
19
 
20
+ Scenario: Build glob
21
+ Given a built app at "glob-app" with flags "--glob '**/*.sass'"
22
+ Then "stylesheets/site.css" should exist at "glob-app" and include "html"
23
+ Then "index.html" should not exist at "glob-app"
24
+ And cleanup built app at "glob-app"
25
+
20
26
  # Scenario: Force relative assets
21
27
  # Given a built app at "relative-app" with flags "--relative"
22
28
  # Then "stylesheets/relative_assets.css" should exist at "relative-app" and include "../"
@@ -6,7 +6,22 @@ Feature: Local Data API
6
6
  When I go to "/data.html"
7
7
  Then I should see "One:Two"
8
8
 
9
+ Scenario: Rendering json
10
+ Given the Server is running at "test-app"
11
+ When I go to "/data3.html"
12
+ Then I should see "One:Two"
13
+
9
14
  Scenario: Rendering liquid
10
15
  Given the Server is running at "test-app"
11
16
  When I go to "/data2.html"
12
- Then I should see "OneTwo"
17
+ Then I should see "OneTwo"
18
+
19
+ Scenario: Using data in config.rb
20
+ Given the Server is running at "data-app"
21
+ When I go to "/test1.html"
22
+ Then I should see "Welcome"
23
+
24
+ Scenario: Using data2 in config.rb
25
+ Given the Server is running at "data-app"
26
+ When I go to "/test2.html"
27
+ Then I should see "Welcome"
@@ -0,0 +1,11 @@
1
+ Feature: Web Fonts
2
+
3
+ Scenario: Checking built folder for content
4
+ Given a built app at "fonts-app"
5
+ Then "stylesheets/fonts.css" should exist at "fonts-app" and include "/fonts/StMarie-Thin.otf"
6
+ And cleanup built app at "fonts-app"
7
+
8
+ Scenario: Rendering scss
9
+ Given the Server is running at "fonts-app"
10
+ When I go to "/stylesheets/fonts.css"
11
+ Then I should see "/fonts/StMarie-Thin.otf"
@@ -20,7 +20,7 @@ Feature: Relative Assets
20
20
  When I go to "/stylesheets/relative_assets.css"
21
21
  Then I should see "url('../images/blank.gif"
22
22
 
23
- Scenario: Rendering html with the feature disabled
23
+ Scenario: Rendering html with the feature enabled
24
24
  Given "relative_assets" feature is "enabled"
25
25
  And the Server is running at "test-app"
26
26
  When I go to "/relative_image.html"
@@ -41,4 +41,10 @@ Feature: Relative Assets
41
41
  When I go to "/relative_image.html"
42
42
  Then I should not see "/images/blank.gif"
43
43
  Then I should not see "/img/blank.gif"
44
- And I should see "img/blank.gif"
44
+ And I should see "img/blank.gif"
45
+
46
+ Scenario: Rendering scss with the feature enabled
47
+ Given "relative_assets" feature is "enabled"
48
+ And the Server is running at "fonts-app"
49
+ When I go to "/stylesheets/fonts.css"
50
+ Then I should see "url('../fonts/StMarie"
@@ -1,9 +1,16 @@
1
+ Given /^a clean server$/ do
2
+ @server = Middleman.server
3
+ @server.set :show_exceptions, false
4
+ end
5
+
1
6
  Given /^"([^\"]*)" feature is "([^\"]*)"$/ do |feature, state|
2
- @server ||= Middleman.server
7
+ @server = Middleman.server
3
8
  @server.set :show_exceptions, false
9
+
4
10
  if state == "enabled"
5
11
  @server.activate(feature.to_sym)
6
- end
12
+ end
13
+
7
14
  @server.set :environment, @current_env || :development
8
15
  end
9
16
 
@@ -0,0 +1,3 @@
1
+ data.pages.each do |p|
2
+ page p.from, :proxy => p.to
3
+ end
@@ -0,0 +1,6 @@
1
+ -
2
+ from: "/test1.html"
3
+ to: "/index.html"
4
+ -
5
+ from: "/test2.html"
6
+ to: "/index.html"
@@ -0,0 +1 @@
1
+ %h1 Welcome
@@ -0,0 +1,3 @@
1
+ %html
2
+ %body
3
+ = yield
File without changes
@@ -0,0 +1,3 @@
1
+ @import "compass"
2
+
3
+ +font-face("St Marie", font-files("StMarie-Thin.otf", opentype))
@@ -0,0 +1 @@
1
+ page "/index.html", :layout => false
@@ -0,0 +1,6 @@
1
+ %h1 Welcome
2
+
3
+ :markdown
4
+ ## H2
5
+
6
+ Paragraph
@@ -0,0 +1 @@
1
+ @import "compass/reset"
@@ -20,6 +20,7 @@ with_layout false do
20
20
  page "/slim.html"
21
21
  page "/data.html"
22
22
  page "/data2.html"
23
+ page "/data3.html"
23
24
  page "/liquid_master.html"
24
25
  page "/page-classes.html"
25
26
  page "/sub1/page-classes.html"
@@ -0,0 +1,4 @@
1
+ [
2
+ { "title": "One" },
3
+ { "title": "Two" }
4
+ ]
@@ -0,0 +1 @@
1
+ <%= data.test2.map { |r| r.title }.join(":") %>
@@ -1,3 +1,5 @@
1
+ # require 'sinatra/synchrony'
2
+
1
3
  require "i18n"
2
4
 
3
5
  require "active_support"
@@ -6,7 +8,9 @@ require "active_support/core_ext/class/attribute_accessors"
6
8
 
7
9
  module Middleman::Base
8
10
  class << self
9
- def registered(app)
11
+ def registered(app)
12
+ # app.register ::Sinatra::Synchrony
13
+
10
14
  app.extend ClassMethods
11
15
  app.send :include, InstanceMethods
12
16
 
@@ -25,7 +29,6 @@ module Middleman::Base
25
29
  app.set :js_dir, "javascripts" # Where to look for javascript files
26
30
  app.set :css_dir, "stylesheets" # Where to look for CSS files
27
31
  app.set :images_dir, "images" # Where to look for images
28
- app.set :fonts_dir, "fonts" # Where to look for fonts
29
32
 
30
33
  app.set :build_dir, "build" # Which folder are builds output to
31
34
  app.set :http_prefix, nil # During build, add a prefix for absolute paths
@@ -96,7 +99,9 @@ module Middleman::Base
96
99
 
97
100
  # Return static files
98
101
  if !::Tilt.mappings.has_key?(template_engine.to_s)
99
- content_type mime_type(File.extname(request_path)), :charset => 'utf-8'
102
+ matched_mime = mime_type(File.extname(request_path))
103
+ matched_mime = "application/octet-stream" if matched_mime.nil?
104
+ content_type matched_mime, :charset => 'utf-8'
100
105
  status 200
101
106
  send_file File.join(settings.views, request_path)
102
107
  false
@@ -5,14 +5,14 @@ require 'rack/test'
5
5
  SHARED_SERVER = Middleman.server
6
6
  SHARED_SERVER.set :environment, :build
7
7
 
8
- module Middleman
8
+ module Middleman
9
9
  module ThorActions
10
10
  def tilt_template(source, *args, &block)
11
11
  config = args.last.is_a?(Hash) ? args.pop : {}
12
12
  destination = args.first || source
13
13
 
14
14
  # source = File.expand_path(find_in_source_paths(source.to_s))
15
- context = instance_eval('binding')
15
+ # context = instance_eval('binding')
16
16
 
17
17
  request_path = destination.sub(/^#{SHARED_SERVER.build_dir}/, "")
18
18
 
@@ -35,15 +35,16 @@ module Middleman
35
35
  include Middleman::ThorActions
36
36
 
37
37
  def self.shared_rack
38
- @shared_rack ||= begin
38
+ @shared_rack ||= begin
39
39
  mock = ::Rack::MockSession.new(SHARED_SERVER)
40
40
  sess = ::Rack::Test::Session.new(mock)
41
- sess.get("/")
41
+ response = sess.get("__middleman__")
42
42
  sess
43
43
  end
44
44
  end
45
45
 
46
46
  class_option :relative, :type => :boolean, :aliases => "-r", :default => false, :desc => 'Override the config.rb file and force relative urls'
47
+ class_option :glob, :type => :string, :aliases => "-g", :default => nil, :desc => 'Build a subset of the project'
47
48
 
48
49
  def initialize(*args)
49
50
  super
@@ -62,10 +63,14 @@ module Middleman
62
63
  def build_all_files
63
64
  self.class.shared_rack
64
65
 
65
- action Directory.new(self, SHARED_SERVER.views, SHARED_SERVER.build_dir, { :force => true })
66
+ if options.has_key?("glob")
67
+ action GlobAction.new(self, SHARED_SERVER.views, SHARED_SERVER.build_dir, { :force => true, :glob => options["glob"] })
68
+ else
69
+ action DirectoryAction.new(self, SHARED_SERVER.views, SHARED_SERVER.build_dir, { :force => true })
66
70
 
67
- SHARED_SERVER.proxied_paths.each do |url, proxy|
68
- tilt_template(url.gsub(/^\//, "#{SHARED_SERVER.build_dir}/"), { :force => true })
71
+ SHARED_SERVER.proxied_paths.each do |url, proxy|
72
+ tilt_template(url.gsub(/^\//, "#{SHARED_SERVER.build_dir}/"), { :force => true })
73
+ end
69
74
  end
70
75
  end
71
76
 
@@ -75,6 +80,8 @@ module Middleman
75
80
  end
76
81
 
77
82
  def run_hooks
83
+ return if options.has_key?("glob")
84
+
78
85
  @@hooks.each do |name, proc|
79
86
  instance_eval(&proc)
80
87
  end
@@ -85,7 +92,7 @@ module Middleman
85
92
  end
86
93
  end
87
94
 
88
- class Directory < ::Thor::Actions::EmptyDirectory
95
+ class BaseAction < ::Thor::Actions::EmptyDirectory
89
96
  attr_reader :source
90
97
 
91
98
  def initialize(base, source, destination=nil, config={}, &block)
@@ -95,14 +102,58 @@ module Middleman
95
102
  end
96
103
 
97
104
  def invoke!
98
- base.empty_directory given_destination, config
99
105
  execute!
100
106
  end
101
107
 
102
108
  def revoke!
103
109
  execute!
104
110
  end
111
+
112
+ protected
113
+ def handle_path(file_source)
114
+ # Skip partials prefixed with an underscore
115
+ return unless file_source.gsub(SHARED_SERVER.root, '').split('/').select { |p| p[0,1] == '_' }.empty?
116
+
117
+ file_extension = File.extname(file_source)
118
+ file_destination = File.join(given_destination, file_source.gsub(source, '.'))
119
+ file_destination.gsub!('/./', '/')
120
+
121
+ handled_by_tilt = ::Tilt.mappings.has_key?(file_extension.gsub(/^\./, ""))
122
+ if handled_by_tilt
123
+ file_destination.gsub!(file_extension, "")
124
+ end
125
+
126
+ destination = base.tilt_template(file_source, file_destination, config, &@block)
127
+ end
128
+ end
129
+
130
+ class GlobAction < BaseAction
105
131
 
132
+ protected
133
+ def execute!
134
+ Dir[File.join(source, @config[:glob])].each do |path|
135
+ file_name = path.gsub(SHARED_SERVER.views + "/", "")
136
+ if file_name == "layouts"
137
+ false
138
+ elsif file_name.include?("layout.") && file_name.split(".").length == 2
139
+ false
140
+ else
141
+ next if File.directory?(path)
142
+
143
+ handle_path(path)
144
+
145
+ true
146
+ end
147
+ end
148
+ end
149
+ end
150
+
151
+ class DirectoryAction < BaseAction
152
+ def invoke!
153
+ base.empty_directory given_destination, config
154
+ super
155
+ end
156
+
106
157
  protected
107
158
  def handle_directory(lookup, &block)
108
159
  lookup = File.join(lookup, '*')
@@ -131,19 +182,7 @@ module Middleman
131
182
  next
132
183
  end
133
184
 
134
- # Skip partials prefixed with an underscore
135
- next unless file_source.gsub(SHARED_SERVER.root, '').split('/').select { |p| p[0,1] == '_' }.empty?
136
-
137
- file_extension = File.extname(file_source)
138
- file_destination = File.join(given_destination, file_source.gsub(source, '.'))
139
- file_destination.gsub!('/./', '/')
140
-
141
- handled_by_tilt = ::Tilt.mappings.has_key?(file_extension.gsub(/^\./, ""))
142
- if handled_by_tilt
143
- file_destination.gsub!(file_extension, "")
144
- end
145
-
146
- destination = base.tilt_template(file_source, file_destination, config, &@block)
185
+ handle_path(file_source)
147
186
  end
148
187
  end
149
188
 
data/lib/middleman/cli.rb CHANGED
@@ -49,7 +49,8 @@ module Middleman
49
49
  end
50
50
 
51
51
  desc "build", "Builds the static site for deployment"
52
- method_option "relative", :type => :boolean, :aliases => "-r", :default => false, :desc => 'Override the config.rb file and force relative urls'
52
+ method_option :relative, :type => :boolean, :aliases => "-r", :default => false, :desc => 'Override the config.rb file and force relative urls'
53
+ method_option :glob, :type => :string, :aliases => "-g", :default => nil, :desc => 'Build a subset of the project'
53
54
  def build
54
55
  v1_check
55
56
  thor_group = Middleman::Builder.new([], options).invoke_all
@@ -15,7 +15,7 @@ module Middleman::CoreExtensions::Assets
15
15
  alias :included :registered
16
16
  end
17
17
 
18
- module ClassMethods
18
+ module ClassMethods
19
19
  def register_asset_handler(handler_name, &block)
20
20
  @asset_handler_map ||= []
21
21
  @asset_handler_stack ||= []
@@ -1,6 +1,9 @@
1
1
  module Middleman::CoreExtensions::Compass
2
2
  class << self
3
3
  def registered(app)
4
+ # Where to look for fonts
5
+ app.set :fonts_dir, "fonts"
6
+
4
7
  app.extend ClassMethods
5
8
 
6
9
  require "compass"
@@ -56,8 +59,8 @@ module Middleman::CoreExtensions::Compass
56
59
  File.join(app.http_prefix || "/", app.js_dir)
57
60
  end
58
61
 
59
- config.http_javascripts_path = if app.respond_to? :http_fonts_path
60
- app.http_js_path
62
+ config.http_fonts_path = if app.respond_to? :http_fonts_path
63
+ app.http_fonts_path
61
64
  else
62
65
  File.join(app.http_prefix || "/", app.fonts_dir)
63
66
  end
@@ -76,6 +79,7 @@ module Middleman::CoreExtensions::Compass
76
79
  build_root = File.basename(self.build_dir)
77
80
  config.css_dir = File.join(build_root, self.css_dir)
78
81
  config.images_dir = File.join(build_root, self.images_dir)
82
+ config.fonts_dir = File.join(build_root, self.fonts_dir)
79
83
  end
80
84
  end
81
85
 
@@ -1,4 +1,5 @@
1
1
  require "yaml"
2
+ require "active_support/json"
2
3
  require "thor"
3
4
 
4
5
  module Middleman::CoreExtensions::Data
@@ -35,9 +36,19 @@ module Middleman::CoreExtensions::Data
35
36
  else
36
37
  file_path = File.join(@app.root, @app.data_dir, "#{path}.yml")
37
38
  if File.exists? file_path
38
- response = YAML.load_file(file_path)
39
+ response = YAML.load_file(file_path)
40
+ else
41
+ file_path = File.join(@app.root, @app.data_dir, "#{path}.yaml")
42
+ if File.exists? file_path
43
+ response = YAML.load_file(file_path)
44
+ else
45
+ file_path = File.join(@app.root, @app.data_dir, "#{path}.json")
46
+ response = ActiveSupport::JSON.decode(File.read(file_path)) if File.exists? file_path
47
+ end
39
48
  end
40
49
  end
50
+
51
+ response
41
52
  end
42
53
 
43
54
  def method_missing(path)
@@ -64,9 +75,15 @@ module Middleman::CoreExtensions::Data
64
75
  data[k] = data_for_path(k)
65
76
  end
66
77
 
67
- yaml_path = File.join(@app.root, @app.data_dir, "*.yml")
78
+ yaml_path = File.join(@app.root, @app.data_dir, "*.{yaml,yml}")
68
79
  Dir[yaml_path].each do |f|
69
- p = f.split("/").last.gsub(".yml", "")
80
+ p = f.split("/").last.gsub(".yml", "").gsub(".yaml", "")
81
+ data[p] = data_for_path(p)
82
+ end
83
+
84
+ json_path = File.join(@app.root, @app.data_dir, "*.json")
85
+ Dir[json_path].each do |f|
86
+ p = f.split("/").last.gsub(".json", "")
70
87
  data[p] = data_for_path(p)
71
88
  end
72
89