mercury 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +3 -7
- data/lib/mercury.rb +4 -4
- data/lib/mercury/css.rb +6 -3
- data/lib/mercury/helpers.rb +5 -4
- data/lib/mercury/js.rb +6 -3
- data/lib/mercury_mixins.rb +11 -0
- metadata +3 -2
data/README.rdoc
CHANGED
@@ -1,25 +1,21 @@
|
|
1
|
-
= Mercury
|
1
|
+
= Mercury
|
2
2
|
|
3
3
|
=== What is it?
|
4
4
|
|
5
|
-
It is a command line application that allows you to create and run web sites built using haml, sass, jquery, and coffee-script. It also has support for markdown
|
5
|
+
It is a command line application that allows you to create and run web sites built using haml, sass, jquery, and coffee-script. It also has support for markdown built right in. Give it a try, it only takes 5 minutes to get up and running.
|
6
6
|
|
7
7
|
=== Technology
|
8
8
|
|
9
9
|
* haml
|
10
10
|
* sass
|
11
|
-
* jquery
|
12
|
-
* jquery-ui
|
13
11
|
* coffee-script
|
14
12
|
* markdown
|
15
|
-
|
16
|
-
* /gif|png|jpg|jpeg/ Image Support
|
13
|
+
|
17
14
|
|
18
15
|
== Why
|
19
16
|
|
20
17
|
At Jack Russell Software, we love haml, jquery, etc and needed to create web mockups or wireframes quickly to get user interface feedback during our storyboarding process. Mercury was the answer, it allows us to work with the same tools we are familar with and focus on getting the user interface right.
|
21
18
|
|
22
|
-
See for you self! Try Mercury, you will be hooked!
|
23
19
|
|
24
20
|
Simply type:
|
25
21
|
|
data/lib/mercury.rb
CHANGED
@@ -2,6 +2,7 @@ require 'sinatra'
|
|
2
2
|
require 'haml'
|
3
3
|
require 'fileutils'
|
4
4
|
require 'faker'
|
5
|
+
require File.dirname(__FILE__) + '/mercury_mixins'
|
5
6
|
|
6
7
|
%w{ helpers images css js }.each do |lib|
|
7
8
|
require File.dirname(__FILE__) + '/mercury/' + lib
|
@@ -15,20 +16,19 @@ require 'sass/plugin/rack'
|
|
15
16
|
class Mercury < Sinatra::Application
|
16
17
|
use Sass::Plugin::Rack
|
17
18
|
|
19
|
+
include MercuryMixins
|
20
|
+
|
18
21
|
helpers Sinatra::MercuryHelpers
|
19
22
|
register Sinatra::MercuryImages
|
20
23
|
register Sinatra::MercuryCss
|
21
24
|
register Sinatra::MercuryJs
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
+
|
26
27
|
set :root, FileUtils.pwd.gsub("\n",'')
|
27
28
|
set :public, FileUtils.pwd.gsub("\n",'') + '/wwwroot'
|
28
29
|
set :views, FileUtils.pwd.gsub("\n",'') + '/wwwroot'
|
29
30
|
|
30
31
|
|
31
|
-
|
32
32
|
get '/*' do
|
33
33
|
view_file_request = params["splat"][0]
|
34
34
|
haml view_file_request.empty? ? view_file = get_view('index.haml') : view_file_request.to_sym, :layout => get_view('layout.haml')
|
data/lib/mercury/css.rb
CHANGED
@@ -5,9 +5,12 @@ module Sinatra
|
|
5
5
|
# stream images
|
6
6
|
app.get %r{(.css)$} do
|
7
7
|
content_type 'text/css'
|
8
|
-
File.
|
9
|
-
|
10
|
-
|
8
|
+
if File.file?(options.views + request.path_info.sub(/\.css$/,'.sass'))
|
9
|
+
sass_file = options.views + request.path_info.sub(/\.css$/,'.sass')
|
10
|
+
Sass::Engine.new(open_file(sass_file)).render
|
11
|
+
else
|
12
|
+
open_file(options.views + request.path_info)
|
13
|
+
end
|
11
14
|
end
|
12
15
|
end
|
13
16
|
end
|
data/lib/mercury/helpers.rb
CHANGED
@@ -69,10 +69,11 @@ module Sinatra
|
|
69
69
|
def find_file(filename, ext)
|
70
70
|
Dir.glob(File.join(options.views, "**/*.#{ext}")).select { |extfile| extfile.downcase =~ /\/#{filename.to_s.downcase}.#{ext}$/ }.first
|
71
71
|
end
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
|
73
|
+
|
74
|
+
# def open_file(full_path_and_filename)
|
75
|
+
# open(full_path_and_filename,'r') { |file| file.read }
|
76
|
+
# end
|
76
77
|
|
77
78
|
end
|
78
79
|
|
data/lib/mercury/js.rb
CHANGED
@@ -5,9 +5,12 @@ module Sinatra
|
|
5
5
|
# stream images
|
6
6
|
app.get %r{(.js)$} do
|
7
7
|
content_type 'text/javascript'
|
8
|
-
File.
|
9
|
-
|
10
|
-
|
8
|
+
if File.file?(options.views + request.path_info.sub(/\.js$/,'.coffee'))
|
9
|
+
coffee_file = options.views + request.path_info.sub(/\.js$/,'.coffee')
|
10
|
+
brew(coffee_file)
|
11
|
+
else
|
12
|
+
open_file(options.views + request.path_info)
|
13
|
+
end
|
11
14
|
end
|
12
15
|
end
|
13
16
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tom Wilson
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/mercury/images.rb
|
87
87
|
- lib/mercury/js.rb
|
88
88
|
- lib/mercury_config.rb
|
89
|
+
- lib/mercury_mixins.rb
|
89
90
|
- lib/public/favicon.ico
|
90
91
|
- lib/public/images/bk_gradient.png
|
91
92
|
- lib/public/javascripts/coffee-script.js
|