hightouch 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +12 -0
- data/Gemfile.lock +121 -0
- data/README.md +10 -0
- data/bin/hightouch +6 -0
- data/bin/ht +6 -0
- data/config.rb +26 -0
- data/lib/hightouch.rb +89 -0
- data/lib/hightouch/app_generator.rb +25 -0
- data/lib/hightouch/archive.rb +30 -0
- data/lib/hightouch/archive_page_generator.rb +10 -0
- data/lib/hightouch/blog.rb +40 -0
- data/lib/hightouch/blog_posting.rb +95 -0
- data/lib/hightouch/category.rb +7 -0
- data/lib/hightouch/cli.rb +10 -0
- data/lib/hightouch/tag.rb +7 -0
- data/lib/hightouch/version.rb +3 -0
- data/rvmrc.example +1 -0
- data/source/blog/2012/02/02/setup-your-rails-dev-env-with-rda.html.markdown +150 -0
- data/source/blog/2012/03/01/example.html.markdown +11 -0
- data/source/images/adventure/background.jpg +0 -0
- data/source/images/adventure/bars.png +0 -0
- data/source/images/adventure/blacktrans.png +0 -0
- data/source/images/adventure/blog_posting_bg.png +0 -0
- data/source/index.html.haml +2 -0
- data/source/javascripts/all.js +1 -0
- data/source/layouts/blog_postings.html.haml +31 -0
- data/source/layouts/layout.html.haml +31 -0
- data/source/partials/_blog_posting.html.haml +14 -0
- data/source/partials/_blog_posting_summary.html.haml +16 -0
- data/source/partials/_bottombar.html.haml +9 -0
- data/source/partials/_sidebar.html.haml +17 -0
- data/source/partials/_tags.html.haml +6 -0
- data/source/stylesheets/adventure.css.scss +198 -0
- data/source/stylesheets/coderay.css +136 -0
- data/source/stylesheets/default.css.scss +3 -0
- data/source/stylesheets/pygments-github.css +70 -0
- data/source/stylesheets/pygments.css +62 -0
- data/source/templates/archive.html.haml +4 -0
- data/source/templates/category.html.haml +5 -0
- data/source/templates/tag.html.haml +4 -0
- data/spec/spec_helper.rb +12 -0
- metadata +145 -0
data/rvmrc.example
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm --create use 1.9.3@hightouch
|
@@ -0,0 +1,150 @@
|
|
1
|
+
---
|
2
|
+
title: Setup your rails development environment with RDA
|
3
|
+
author: Tower He
|
4
|
+
categories: [programming, example]
|
5
|
+
tags: [ruby, rails, nginx, passenger, rvm, example]
|
6
|
+
date_created: 2012/02/02
|
7
|
+
keywords: ruby, rails
|
8
|
+
---
|
9
|
+
|
10
|
+
### Intro
|
11
|
+
|
12
|
+
I created a project [rda](https://github.com/towerhe/rda) to help us setup our rails dev env more quickly.
|
13
|
+
It is in the early dev stage. By now it only provides two major
|
14
|
+
features:
|
15
|
+
|
16
|
+
* Create a .rvmrc file for your rails app
|
17
|
+
* Setup Nginx + Passenger for your rails app
|
18
|
+
|
19
|
+
READMORE
|
20
|
+
|
21
|
+
### Requirements
|
22
|
+
|
23
|
+
* *RVM*
|
24
|
+
|
25
|
+
RVM is a command-line tool which allows you to easily install,
|
26
|
+
manage, and work with multiple ruby environments from interpreters to
|
27
|
+
sets of gems.
|
28
|
+
|
29
|
+
You should install RVM first. You can follow the installation tips
|
30
|
+
on [https://rvm.beginrescueend.com/rvm/install/#explained](https://rvm.beginrescueend.com/rvm/install/#explained) or just execute the following instructions:
|
31
|
+
|
32
|
+
```:::bash
|
33
|
+
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
|
34
|
+
```
|
35
|
+
|
36
|
+
* *Nginx + Passenger*
|
37
|
+
|
38
|
+
Nginx is an HTTP and reverse proxy server, as well as a
|
39
|
+
mail proxy server, written by Igor Sysoev. For a long time, it has been
|
40
|
+
running on many heavily loaded Russian sites including Yandex, Mail.Ru,
|
41
|
+
VKontakte, and Rambler. According to Netcraft nginx served or proxied 8.49% busiest sites in January 2012.
|
42
|
+
|
43
|
+
Phusion Passenger™ — a.k.a. mod_rails or mod_rack — makes deployment
|
44
|
+
of Ruby web applications, such as those built on the revolutionary Ruby
|
45
|
+
on Rails web framework, a breeze. It follows the usual Ruby on Rails
|
46
|
+
conventions, such as “Don’t-Repeat-Yourself”.
|
47
|
+
|
48
|
+
As simple as posible, you can follow the installation instructions
|
49
|
+
on [http://www.modrails.com/install.html](http://www.modrails.com/install.html) or:
|
50
|
+
|
51
|
+
*Note:* In the process of installing nginx, you will get an error when downloading
|
52
|
+
pcre. For passenger 3.0.11, it tries to download pcre 8.12 which is
|
53
|
+
removed when installing nginx. To fix this error, you should modify
|
54
|
+
phusion_passenger.rb of the installed passenger gem directory and set the version of pcre to 8.21.
|
55
|
+
|
56
|
+
```:::bash
|
57
|
+
# 1. Install passenger
|
58
|
+
gem install passenger
|
59
|
+
# 2. Install nginx
|
60
|
+
passenger-install-nginx-module
|
61
|
+
```
|
62
|
+
|
63
|
+
### Install RDA
|
64
|
+
|
65
|
+
```:::bash
|
66
|
+
gem install rda
|
67
|
+
```
|
68
|
+
|
69
|
+
Or simply add rda to the Gemfile
|
70
|
+
|
71
|
+
```:::ruby
|
72
|
+
gem 'rda'
|
73
|
+
```
|
74
|
+
|
75
|
+
### Setup RVM
|
76
|
+
|
77
|
+
```:::bash
|
78
|
+
rake rda:rvm:setup
|
79
|
+
```
|
80
|
+
|
81
|
+
First of all, this task will check whether the RVM is installed. If RVM
|
82
|
+
is installed, it will create a .rvmrc for the application with the
|
83
|
+
content which looks like:
|
84
|
+
|
85
|
+
```:::bash
|
86
|
+
if [[ -s "/path/to/rvm/environments/ruby-1.9.3-p0@app_name" ]]; then
|
87
|
+
. "/path/to/rvm/environments/ruby-1.9.3-p0@app_name"
|
88
|
+
else
|
89
|
+
rvm use ruby-1.9.3-p0@app_name --create
|
90
|
+
fi
|
91
|
+
```
|
92
|
+
|
93
|
+
After RVM setup, you need to trust the rvmrc by:
|
94
|
+
|
95
|
+
```:::bash
|
96
|
+
rvm rvmrc trust
|
97
|
+
```
|
98
|
+
|
99
|
+
Or you can set rvm_trust_rvmrcs_flag=1 in ~/.rvmrc or /etc/rvmrc.
|
100
|
+
|
101
|
+
If RVM is not installed this task will do nothing but exit.
|
102
|
+
|
103
|
+
### Setup Nginx + Passenger
|
104
|
+
|
105
|
+
```:::bash
|
106
|
+
rake rda:nginx:setup
|
107
|
+
```
|
108
|
+
|
109
|
+
First this task will try to find the config files of Nginx which you
|
110
|
+
have installed from the following paths:
|
111
|
+
|
112
|
+
* /etc/nginx
|
113
|
+
* /usr/local/nginx/conf
|
114
|
+
* /opt/nginx/conf
|
115
|
+
|
116
|
+
You can change the default searching paths by:
|
117
|
+
|
118
|
+
```:::ruby
|
119
|
+
Rda.configure { nginx_conf_paths ['/path/to/nginx/conf'] }
|
120
|
+
```
|
121
|
+
|
122
|
+
Please make sure that you have the write permission of the directory you
|
123
|
+
choosed, or you can run:
|
124
|
+
|
125
|
+
```:::bash
|
126
|
+
sudo rake rda:nginx:setup
|
127
|
+
```
|
128
|
+
|
129
|
+
If there are more than one paths found, it will give you a choice to
|
130
|
+
decide which one will be used. After choosing a proper path, it will try
|
131
|
+
to create two directories sites-available and sites-enabled to save the
|
132
|
+
configs of rails applications.
|
133
|
+
|
134
|
+
* sites-available saves the configs of the rails applications.
|
135
|
+
* sites-enabled saves the link to the rails applications.
|
136
|
+
|
137
|
+
Next it will set Nginx to include the configs under sites-enabled. It
|
138
|
+
means that only the applications under sites-enabled will be loaded. And
|
139
|
+
than it will create a config file for your application under
|
140
|
+
sites-available and create a link to the config file under
|
141
|
+
sites-enabled. After all, it will create a local hostname for your
|
142
|
+
application in /etc/hosts.
|
143
|
+
|
144
|
+
Now You need to start Nginx:
|
145
|
+
|
146
|
+
```:::bash
|
147
|
+
/path/to/nginx/sbin/nginx
|
148
|
+
```
|
149
|
+
|
150
|
+
and then visit http://your_app_name.local.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree .
|
@@ -0,0 +1,31 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{ charset: "utf-8" }
|
5
|
+
|
6
|
+
<!-- Always force latest IE rendering engine or request Chrome Frame -->
|
7
|
+
%meta{ content: "IE=edge,chrome=1", 'http-equiv' => "X-UA-Compatible" }
|
8
|
+
|
9
|
+
<!-- Use title if it's in the page YAML frontmatter -->
|
10
|
+
%title= "#{data.page.title} - hightouch (HT)" || "hightouch (HT)"
|
11
|
+
|
12
|
+
= stylesheet_link_tag "default"
|
13
|
+
= javascript_include_tag "all"
|
14
|
+
|
15
|
+
%body{ class: page_classes }
|
16
|
+
.content
|
17
|
+
.main= partial "partials/blog_posting"
|
18
|
+
= partial "partials/sidebar"
|
19
|
+
= partial "partials/bottombar"
|
20
|
+
|
21
|
+
:javascript
|
22
|
+
var _gaq = _gaq || [];
|
23
|
+
_gaq.push(['_setAccount', 'YOUR_ID']);
|
24
|
+
_gaq.push(['_trackPageview']);
|
25
|
+
|
26
|
+
(function() {
|
27
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
28
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
29
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
30
|
+
})();
|
31
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{ charset: "utf-8" }
|
5
|
+
|
6
|
+
<!-- Always force latest IE rendering engine or request Chrome Frame -->
|
7
|
+
%meta{ content: "IE=edge,chrome=1", 'http-equiv' => "X-UA-Compatible" }
|
8
|
+
|
9
|
+
<!-- Use title if it's in the page YAML frontmatter -->
|
10
|
+
%title= "#{data.page.title} - hightouch (HT)" || "hightouch (HT)"
|
11
|
+
|
12
|
+
= stylesheet_link_tag "default"
|
13
|
+
= javascript_include_tag "all"
|
14
|
+
|
15
|
+
%body{ class: page_classes }
|
16
|
+
.content
|
17
|
+
.main= yield
|
18
|
+
= partial "partials/sidebar"
|
19
|
+
= partial "partials/bottombar"
|
20
|
+
|
21
|
+
:javascript
|
22
|
+
var _gaq = _gaq || [];
|
23
|
+
_gaq.push(['_setAccount', 'YOUR_ID']);
|
24
|
+
_gaq.push(['_trackPageview']);
|
25
|
+
|
26
|
+
(function() {
|
27
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
28
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
29
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
30
|
+
})();
|
31
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- blog_posting = blog.blog_posting(current_path)
|
2
|
+
|
3
|
+
.blog-posting
|
4
|
+
%h1= titleize(humanize(blog_posting.name))
|
5
|
+
%p
|
6
|
+
%span.author
|
7
|
+
%label Created by:
|
8
|
+
= blog_posting.author
|
9
|
+
%span.date-created
|
10
|
+
%label Published on:
|
11
|
+
= blog_posting.date_created
|
12
|
+
%p
|
13
|
+
= partial "partials/tags", locals: { tags: blog_posting.tags }
|
14
|
+
.article-body= blog_posting.article_body
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.blog-posting
|
2
|
+
%h1=link_to titleize(humanize(blog_posting.name)), blog_posting.url
|
3
|
+
%p
|
4
|
+
%span.author
|
5
|
+
%label Created by:
|
6
|
+
= blog_posting.author
|
7
|
+
%span.date-created
|
8
|
+
%label Published on:
|
9
|
+
= blog_posting.date_created
|
10
|
+
%div= blog_posting.description
|
11
|
+
%div
|
12
|
+
.left=link_to 'READ MORE', blog_posting.url
|
13
|
+
.right
|
14
|
+
= partial "partials/tags", locals: { tags: blog_posting.tags }
|
15
|
+
.clear
|
16
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
.sidebar
|
2
|
+
%ul
|
3
|
+
%li
|
4
|
+
%h2 Categories
|
5
|
+
%ul
|
6
|
+
- blog.categories.each do |k, v|
|
7
|
+
%li=link_to "#{titleize(humanize(k))} (#{v.count})", v.path
|
8
|
+
%li
|
9
|
+
%h2 Tags
|
10
|
+
%div
|
11
|
+
- blog.tags.each do |k, v|
|
12
|
+
=link_to k, v.path, style: "font-size: #{font_size_for_tag(v)}px;", title: "#{v.count} blog posting#{"s" if v.count > 1}"
|
13
|
+
%li
|
14
|
+
%h2 Archives
|
15
|
+
%ul
|
16
|
+
- blog.archives.each do |k, v|
|
17
|
+
%li=link_to "#{titleize(humanize(k))} (#{v.count})", v.path
|
@@ -0,0 +1,198 @@
|
|
1
|
+
//
|
2
|
+
// = require pygments-github
|
3
|
+
//
|
4
|
+
@charset "utf-8";
|
5
|
+
|
6
|
+
body {
|
7
|
+
background: fixed center center url("../images/adventure/background.jpg") black;
|
8
|
+
font-family: sans-serif;
|
9
|
+
font-size: 13px;
|
10
|
+
}
|
11
|
+
|
12
|
+
h1, h2, h3, h4, h5, h6 {
|
13
|
+
color: #0B6492;
|
14
|
+
font-family: sans-serif;
|
15
|
+
padding: 0;
|
16
|
+
clear: both;
|
17
|
+
}
|
18
|
+
|
19
|
+
h2 {
|
20
|
+
display: block;
|
21
|
+
font-size: 1.5em;
|
22
|
+
-webkit-margin-before: 0.83em;
|
23
|
+
-webkit-margin-after: 0.83em;
|
24
|
+
-webkit-margin-start: 0px;
|
25
|
+
-webkit-margin-end: 0px;
|
26
|
+
font-weight: bold;
|
27
|
+
}
|
28
|
+
|
29
|
+
pre {
|
30
|
+
background: #eee;
|
31
|
+
border: 1px solid #ccc;
|
32
|
+
padding: 12px 12px 0px 12px;
|
33
|
+
white-space: pre-wrap;
|
34
|
+
}
|
35
|
+
|
36
|
+
a {
|
37
|
+
color: #0B6492;
|
38
|
+
text-decoration: none;
|
39
|
+
font-weight: bold;
|
40
|
+
&:-webkit-any-link {
|
41
|
+
text-decoration: none;
|
42
|
+
cursor: auto;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
ul {
|
47
|
+
display: block;
|
48
|
+
list-style-type: disc;
|
49
|
+
-webkit-margin-before: 1em;
|
50
|
+
-webkit-margin-after: 1em;
|
51
|
+
-webkit-margin-start: 0px;
|
52
|
+
-webkit-margin-end: 0px;
|
53
|
+
-webkit-padding-start: 40px;
|
54
|
+
}
|
55
|
+
|
56
|
+
li {
|
57
|
+
display: list-item;
|
58
|
+
text-align: -webkit-match-parent;
|
59
|
+
}
|
60
|
+
|
61
|
+
label { font-weight: bold; }
|
62
|
+
|
63
|
+
.left { float: left; }
|
64
|
+
.right { float: right; }
|
65
|
+
.clear { clear: both; }
|
66
|
+
|
67
|
+
.content {
|
68
|
+
width: 1000px;
|
69
|
+
margin: 50px auto;
|
70
|
+
text-align: center;
|
71
|
+
}
|
72
|
+
|
73
|
+
.sidebar {
|
74
|
+
text-shadow: 0 0 4px #444;
|
75
|
+
color: white;
|
76
|
+
font-size: 14px;
|
77
|
+
background: url("../images/adventure/blacktrans.png");
|
78
|
+
-moz-border-radius: 6px;
|
79
|
+
-khtml-border-radius: 6px;
|
80
|
+
-webkit-border-radius: 6px;
|
81
|
+
border-radius: 6px;
|
82
|
+
width: 200px;
|
83
|
+
padding: 10px;
|
84
|
+
float: right;
|
85
|
+
text-align: left;
|
86
|
+
ul, li {
|
87
|
+
list-style-type: none;
|
88
|
+
color: #CCCBC4;
|
89
|
+
padding: 0;
|
90
|
+
margin: 0;
|
91
|
+
}
|
92
|
+
a {
|
93
|
+
color: #CCCBC4;
|
94
|
+
}
|
95
|
+
h1, h2, h3, h4, h5, h6 {
|
96
|
+
text-transform: uppercase;
|
97
|
+
border-bottom: 1px solid white;
|
98
|
+
padding-bottom: 5px;
|
99
|
+
float: left;
|
100
|
+
}
|
101
|
+
h2 {
|
102
|
+
color: white;
|
103
|
+
margin: 25px 0 10px 0;
|
104
|
+
width: 200px;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
.bottombar {
|
109
|
+
background: url("../images/adventure/bars.png");
|
110
|
+
width: 100%;
|
111
|
+
height: 50px;
|
112
|
+
position: fixed;
|
113
|
+
text-align: left;
|
114
|
+
bottom: 0;
|
115
|
+
left: 0;
|
116
|
+
ul {
|
117
|
+
float: right;
|
118
|
+
margin: 0;
|
119
|
+
padding: 0;
|
120
|
+
list-style-type: none;
|
121
|
+
font-weight: bold;
|
122
|
+
display: block;
|
123
|
+
text-align: left;
|
124
|
+
li {
|
125
|
+
font-size: 14px;
|
126
|
+
font-weight: bold;
|
127
|
+
font-family: sans-serif;
|
128
|
+
font-variant: small-caps;
|
129
|
+
float: left;
|
130
|
+
border-left: 1px solid #575253;
|
131
|
+
a {
|
132
|
+
line-height: 50px;
|
133
|
+
height: 50px;
|
134
|
+
display: block;
|
135
|
+
padding: 0px 12px 0px 12px;
|
136
|
+
color: white;
|
137
|
+
text-decoration: none;
|
138
|
+
&:hover {
|
139
|
+
background-color: #0B6492;
|
140
|
+
background-position: bottom;
|
141
|
+
color: white;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
146
|
+
.title {
|
147
|
+
color: white;
|
148
|
+
float: left;
|
149
|
+
padding: 0px;
|
150
|
+
margin: 0 0 14px 14px;
|
151
|
+
h1 {
|
152
|
+
font-size: 20px;
|
153
|
+
font-weight: bold;
|
154
|
+
font-variant: small-caps;
|
155
|
+
a {
|
156
|
+
text-decoration: none;
|
157
|
+
background-position: bottom;
|
158
|
+
color: white
|
159
|
+
}
|
160
|
+
}
|
161
|
+
}
|
162
|
+
.slogan {
|
163
|
+
padding: 0px;
|
164
|
+
float: left;
|
165
|
+
margin: 8px 0 18px 14px;
|
166
|
+
h2 {
|
167
|
+
font-size: 15px;
|
168
|
+
padding: 0px;
|
169
|
+
font-variant: small-caps;
|
170
|
+
font-weight: 100;
|
171
|
+
text-decoration: none;
|
172
|
+
color: #B7C2C3;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
.main {
|
178
|
+
margin-bottom: 75px;
|
179
|
+
float: left;
|
180
|
+
}
|
181
|
+
|
182
|
+
.blog-posting {
|
183
|
+
background: url("../images/adventure/blog_posting_bg.png");
|
184
|
+
font-family: sans-serif;
|
185
|
+
font-size: 13px;
|
186
|
+
line-height: 20px;
|
187
|
+
width: 740px;
|
188
|
+
height: auto;
|
189
|
+
padding: 10px;
|
190
|
+
text-align: left;
|
191
|
+
border: 3px solid #4A4646;
|
192
|
+
-moz-border-radius: 6px;
|
193
|
+
-khtml-border-radius: 6px;
|
194
|
+
-webkit-border-radius: 6px;
|
195
|
+
border-radius: 6px;
|
196
|
+
border-image: initial;
|
197
|
+
margin-bottom: 20px;
|
198
|
+
}
|