mercury 0.7.5 → 0.8.1
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/Mercury.gemspec +17 -2
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/docs/config.ru +7 -0
- data/docs/mercury.log +2013 -0
- data/docs/views/about.haml +6 -0
- data/docs/views/about.md +25 -0
- data/docs/views/default.sass +35 -0
- data/docs/views/footer.haml +2 -0
- data/docs/views/header.haml +3 -0
- data/docs/views/home.haml +12 -0
- data/docs/views/home.md +21 -0
- data/docs/views/navigation.haml +10 -0
- data/docs/views/resources.haml +12 -0
- data/docs/views/resources.md +7 -0
- data/lib/mercury.rb +30 -10
- data/lib/views/layout.haml +1 -1
- data/spec/mercury_spec.rb +12 -0
- metadata +24 -2
data/docs/views/about.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# About Mercury
|
|
2
|
+
|
|
3
|
+
Mercury is a gem that makes it simple to work with haml, sass, jquery and other tools and technologies without the hassle.
|
|
4
|
+
|
|
5
|
+
<pre><code>
|
|
6
|
+
$ gem install mercury
|
|
7
|
+
|
|
8
|
+
$ mercury {your project}
|
|
9
|
+
|
|
10
|
+
$ cd {your project}
|
|
11
|
+
|
|
12
|
+
$ mate views
|
|
13
|
+
|
|
14
|
+
# Start writing your haml
|
|
15
|
+
|
|
16
|
+
# default.haml
|
|
17
|
+
|
|
18
|
+
%h1 Hello World
|
|
19
|
+
|
|
20
|
+
----
|
|
21
|
+
|
|
22
|
+
# Run
|
|
23
|
+
|
|
24
|
+
$ mercury
|
|
25
|
+
</code></pre>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
=nav_a
|
|
2
|
+
border: 1px solid gray
|
|
3
|
+
padding: 10px
|
|
4
|
+
text-decoration: none
|
|
5
|
+
color: #004080
|
|
6
|
+
|
|
7
|
+
#header-wrapper
|
|
8
|
+
background-color: orange
|
|
9
|
+
color: white
|
|
10
|
+
|
|
11
|
+
#navigation
|
|
12
|
+
text-align: center
|
|
13
|
+
ul
|
|
14
|
+
list-style: none
|
|
15
|
+
|
|
16
|
+
li
|
|
17
|
+
display: inline
|
|
18
|
+
a
|
|
19
|
+
+nav_a
|
|
20
|
+
|
|
21
|
+
a:hover
|
|
22
|
+
background-color: orange
|
|
23
|
+
color: white
|
|
24
|
+
|
|
25
|
+
a:visited
|
|
26
|
+
+nav_a
|
|
27
|
+
|
|
28
|
+
#home-content
|
|
29
|
+
p
|
|
30
|
+
font-size: 2em
|
|
31
|
+
|
|
32
|
+
pre
|
|
33
|
+
background-color: black
|
|
34
|
+
color: white
|
|
35
|
+
padding: 10px
|
data/docs/views/home.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Mercury is a gem that makes it simple to work with haml, sass, jquery and other tools and technologies without the hassle.
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
<pre><code>
|
|
6
|
+
$ gem install mercury
|
|
7
|
+
</code></pre>
|
|
8
|
+
|
|
9
|
+
## Create a Mercury Project
|
|
10
|
+
|
|
11
|
+
<pre><code>
|
|
12
|
+
$ mercury project_awesome
|
|
13
|
+
</code></pre>
|
|
14
|
+
|
|
15
|
+
## Run your Mercury Project
|
|
16
|
+
|
|
17
|
+
<pre><code>
|
|
18
|
+
$ cd project_awesome
|
|
19
|
+
$ mercury
|
|
20
|
+
</code></pre>
|
|
21
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
## Mercury allows you to easily use the following list of technologies:
|
|
2
|
+
|
|
3
|
+
* [Haml](http://www.haml-lang.com)
|
|
4
|
+
* [Sass](http://www.sass-lang.com)
|
|
5
|
+
* [JQuery](http://www.jquery.com)
|
|
6
|
+
* [JQueryUI](http://www.jqueryui.com)
|
|
7
|
+
* [Markdown](http://daringfireball.net/projects/markdown/)
|
data/lib/mercury.rb
CHANGED
|
@@ -4,38 +4,58 @@ require 'sass'
|
|
|
4
4
|
require 'fileutils'
|
|
5
5
|
require 'faker'
|
|
6
6
|
|
|
7
|
+
begin
|
|
8
|
+
require 'rdiscount'
|
|
9
|
+
# ^^ that sets a Markdown constant
|
|
10
|
+
rescue LoadError
|
|
11
|
+
require 'bluecloth'
|
|
12
|
+
Markdown = BlueCloth
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Core Sinatra application to run mercury apps
|
|
7
16
|
class Mercury < Sinatra::Application
|
|
8
17
|
SASS = 'sass'
|
|
9
18
|
JS = 'js'
|
|
19
|
+
MARKDOWN = 'md'
|
|
10
20
|
|
|
11
21
|
set :root, FileUtils.pwd.gsub("\n",'')
|
|
12
22
|
set :public, File.dirname(__FILE__) + '/public'
|
|
13
23
|
|
|
14
24
|
get '/*' do
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
layout_template = open(File.join(vd,'layout.haml'),'r').read
|
|
18
|
-
|
|
19
|
-
view_file = vf.empty? ? open(File.join(vd,'index.haml'),'r').read : vf.to_sym
|
|
20
|
-
|
|
21
|
-
haml view_file, :layout => layout_template
|
|
25
|
+
view_file_request = params["splat"][0]
|
|
26
|
+
haml view_file_request.empty? ? view_file = get_view('index.haml') : view_file_request.to_sym, :layout => get_view('layout.haml')
|
|
22
27
|
end
|
|
23
28
|
|
|
24
29
|
def sass(sassfile)
|
|
25
30
|
["<style type='text/css'>",
|
|
26
|
-
Sass::Engine.new(
|
|
31
|
+
Sass::Engine.new(open_file(find_file(sassfile, SASS))).render,
|
|
27
32
|
"</style>\n"].join("\n")
|
|
28
33
|
end
|
|
29
34
|
|
|
30
35
|
def javascript(jsfile)
|
|
31
36
|
["<script type='text/javascript'>",
|
|
32
|
-
|
|
37
|
+
open_file(find_file(jsfile, JS)),
|
|
33
38
|
"</script>\n"].join("\n")
|
|
34
39
|
end
|
|
35
40
|
|
|
41
|
+
def markdown(mdfile)
|
|
42
|
+
Markdown.new(open_file(find_file(mdfile, MARKDOWN))).to_html
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
|
|
36
46
|
private
|
|
37
47
|
def find_file(filename, ext)
|
|
38
|
-
Dir.glob(File.join(options.views, "**/*.#{ext}")).select { |
|
|
48
|
+
Dir.glob(File.join(options.views, "**/*.#{ext}")).select { |extfile| extfile =~ /#{filename}.#{ext}$/ }.first
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def open_file(full_path_and_filename)
|
|
52
|
+
open(full_path_and_filename,'r').read
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def get_view(filename)
|
|
56
|
+
view_directory = File.join(File.dirname(__FILE__),'views')
|
|
57
|
+
open_file File.join(view_directory,filename)
|
|
39
58
|
end
|
|
40
59
|
|
|
60
|
+
|
|
41
61
|
end
|
data/lib/views/layout.haml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
%html{ :xmlns => "http://www.w3.org/1999/xhtml", :lang => "en", 'xml:lang' => "en" }
|
|
3
3
|
%head
|
|
4
4
|
%title Mercury
|
|
5
|
-
- ['reset','text','960','smoothness/jquery-ui-1.8rc3.custom',
|
|
5
|
+
- ['reset','text','960','smoothness/jquery-ui-1.8rc3.custom','app'].each do |css|
|
|
6
6
|
%link{ :href => "/stylesheets/#{css}.css", :rel => "stylesheet", :type => "text/css", :media => "screen", :charset => "utf-8" }
|
|
7
7
|
%body
|
|
8
8
|
- ['jquery-1.4.2.min', 'jquery-ui-1.8rc3.custom.min'].each do |js|
|
data/spec/mercury_spec.rb
CHANGED
|
@@ -16,5 +16,17 @@ describe "mercury index" do
|
|
|
16
16
|
get '/'
|
|
17
17
|
last_response.body.should =~ /Mercury/
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
it "should contain mercury" do
|
|
21
|
+
get '/'
|
|
22
|
+
last_response.body.should =~ /Jack Russell Software/
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# it "should return error" do
|
|
26
|
+
# app.stub!(:haml).and_return("<h1>test</h1>")
|
|
27
|
+
# get '/test'
|
|
28
|
+
# puts last_response.body
|
|
29
|
+
# end
|
|
30
|
+
|
|
19
31
|
|
|
20
32
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mercury
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tom Wilson
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2010-03-
|
|
12
|
+
date: 2010-03-07 00:00:00 -05:00
|
|
13
13
|
default_executable: mercury
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -42,6 +42,16 @@ dependencies:
|
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
43
|
version: "0"
|
|
44
44
|
version:
|
|
45
|
+
- !ruby/object:Gem::Dependency
|
|
46
|
+
name: bluecloth
|
|
47
|
+
type: :runtime
|
|
48
|
+
version_requirement:
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: "0"
|
|
54
|
+
version:
|
|
45
55
|
description: Mercury allows you to create web sites/apps/mockups using haml, sass, and jquery.
|
|
46
56
|
email: thing2@jackhq.com
|
|
47
57
|
executables:
|
|
@@ -60,6 +70,18 @@ files:
|
|
|
60
70
|
- Rakefile
|
|
61
71
|
- VERSION
|
|
62
72
|
- bin/mercury
|
|
73
|
+
- docs/config.ru
|
|
74
|
+
- docs/mercury.log
|
|
75
|
+
- docs/views/about.haml
|
|
76
|
+
- docs/views/about.md
|
|
77
|
+
- docs/views/default.sass
|
|
78
|
+
- docs/views/footer.haml
|
|
79
|
+
- docs/views/header.haml
|
|
80
|
+
- docs/views/home.haml
|
|
81
|
+
- docs/views/home.md
|
|
82
|
+
- docs/views/navigation.haml
|
|
83
|
+
- docs/views/resources.haml
|
|
84
|
+
- docs/views/resources.md
|
|
63
85
|
- lib/mercury.rb
|
|
64
86
|
- lib/public/favicon.ico
|
|
65
87
|
- lib/public/images/bk_gradient.png
|