tau 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +99 -93
- data/Rakefile +7 -0
- data/bin/tau +1 -1
- data/features/builder.feature +41 -41
- data/features/making_projects.feature +20 -20
- data/features/step_definitions/fs.rb +20 -20
- data/features/support/env.rb +9 -9
- data/lib/tau/builder.rb +29 -34
- data/lib/tau/cli.rb +35 -35
- data/lib/tau/config.rb +15 -0
- data/lib/tau/enginer.rb +42 -0
- data/lib/tau/engines/abstract_engine.rb +71 -0
- data/lib/tau/engines/coffee.rb +15 -0
- data/lib/tau/engines/haml.rb +15 -0
- data/lib/tau/engines/sass.rb +15 -0
- data/lib/tau/engines/scss.rb +15 -0
- data/lib/tau/projecter.rb +43 -30
- data/lib/tau/server.rb +18 -37
- data/lib/tau/server/file_listing.rb +58 -0
- data/lib/tau/server/views/file_listing.haml +20 -0
- data/lib/tau/version.rb +1 -1
- data/tau.gemspec +2 -2
- metadata +75 -52
- data/lib/tau/renderer.rb +0 -55
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 38c4dff2363ca430cd01fca3bff75b5d3cebbb11
|
4
|
+
data.tar.gz: 6ab29e90496e18e8b035d0c0e1d0a51191b6e4e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e2882456f5986a5ea2ab5b8979739829fa61668b6c45065a9a54679271815f939641aa72e3740e3331489c410ae4ece9367e91f8175b67ce34d3db095347b685
|
7
|
+
data.tar.gz: 6188a8b0c7d8898cd9a406259f16e0867ec2ec354e411347c889021206f3abefe4017845d26a1a8b3e4ee41549575c536fde929d97624d9fab1865c6de4dafc0
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Dmitry Zhlobo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,93 +1,99 @@
|
|
1
|
-
Tau
|
2
|
-
===
|
3
|
-
|
4
|
-
Tau provides you write code of webpages using modern technologies such as
|
5
|
-
haml, sass, coffee-script. You dont't need to compile your code to HTML and
|
6
|
-
CSS by hand everytime you something change.
|
7
|
-
|
8
|
-
|
9
|
-
------------
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
**code/
|
58
|
-
http://localhost:15000/
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
```
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
1
|
+
Tau [![Build Status](https://secure.travis-ci.org/Proghat/tau.png?branch=master)](http://travis-ci.org/Proghat/tau) [![Gem Version](https://badge.fury.io/rb/tau.png)](http://badge.fury.io/rb/tau)
|
2
|
+
===
|
3
|
+
|
4
|
+
Tau provides you write code of webpages using modern technologies such as
|
5
|
+
haml, sass, coffee-script. You dont't need to compile your code to HTML and
|
6
|
+
CSS by hand everytime you something change.
|
7
|
+
|
8
|
+
Requirements
|
9
|
+
------------
|
10
|
+
|
11
|
+
You need ruby version **1.9.3** installed. See [rvm](https://rvm.io/).
|
12
|
+
|
13
|
+
|
14
|
+
Installation
|
15
|
+
------------
|
16
|
+
|
17
|
+
gem install tau
|
18
|
+
|
19
|
+
Usage
|
20
|
+
-----
|
21
|
+
|
22
|
+
It's pretty simple.
|
23
|
+
|
24
|
+
### Getting started
|
25
|
+
|
26
|
+
1. Start new coding project and switch to that. In the command prompt run:
|
27
|
+
|
28
|
+
`tau new example.com; cd example.com` *(where example.com is the project name)*
|
29
|
+
|
30
|
+
2. Create html or haml file on code directory:
|
31
|
+
|
32
|
+
`echo '%h1 Hello <strong>tau</strong>!' > code/hello.haml`
|
33
|
+
|
34
|
+
3. Start server and go to [http://localhost:15000/hello.html](http://localhost:15000/hello.html):
|
35
|
+
|
36
|
+
`tau server`
|
37
|
+
|
38
|
+
Attend even if you write hello.**haml** file you can see it by hello.**html**
|
39
|
+
in browser.
|
40
|
+
|
41
|
+
### Creating new project
|
42
|
+
|
43
|
+
Run `tau new projectname` and tau will make directory tree for you:
|
44
|
+
|
45
|
+
projectname
|
46
|
+
|--code - for your .html and .haml files
|
47
|
+
| |--js - for .js and .coffee files
|
48
|
+
| |--css - for .css, .sass and .scss
|
49
|
+
| `--img - for any type of images
|
50
|
+
|
|
51
|
+
`--tau.yaml - config file
|
52
|
+
|
53
|
+
### Coding
|
54
|
+
|
55
|
+
Run `tau server` in your project directory. Then put any html or haml files
|
56
|
+
into **code** directory, js or coffee files into **code/js**, css, sass or
|
57
|
+
scss into **code/css**. Now you can view files in browser by
|
58
|
+
http://localhost:15000/page.html or http://localhost:15000/css/style.css or
|
59
|
+
http://localhost:15000/js/script.js.
|
60
|
+
|
61
|
+
Attend that tau changes files extensions in browser from haml to html, from
|
62
|
+
coffee to js, from sass and scss to css. For example if you have
|
63
|
+
**code/js/myscript.coffee** file you can see it in browser by
|
64
|
+
http://localhost:15000/js/myscript.js.
|
65
|
+
|
66
|
+
In html or haml file you can include scripts written in coffee and styles
|
67
|
+
written in sass or scss. For example if you have **code/js/script.coffee**
|
68
|
+
script and **code/js/style.sass** spreadsheet you can include it to html by
|
69
|
+
lines:
|
70
|
+
```html
|
71
|
+
<script src='js/script.js'></script>
|
72
|
+
<link rel="stylesheet" href="css/style.css">
|
73
|
+
```
|
74
|
+
Anytime you change any file you can see updated version in browser. You don't
|
75
|
+
need to compile anything by hand.
|
76
|
+
|
77
|
+
### Building project
|
78
|
+
|
79
|
+
If you want to compile all files for releasing it in internet you don't need do
|
80
|
+
it by hand. `tau build` command compiles all sass, haml and other files and put
|
81
|
+
them into **build/** directory. Any files from **img** directory and not a haml, sass
|
82
|
+
or coffee-script files will copied without any changes. For example:
|
83
|
+
```
|
84
|
+
code/index.haml -> build/index.html
|
85
|
+
code/js/script.coffee -> build/js/script.js
|
86
|
+
code/img/logo.png -> build/img/logo.png
|
87
|
+
code/humans.txt -> build/humans.txt
|
88
|
+
etc...
|
89
|
+
```
|
90
|
+
|
91
|
+
License
|
92
|
+
-------
|
93
|
+
|
94
|
+
You can use tau by MIT License.
|
95
|
+
|
96
|
+
Contributing
|
97
|
+
------------
|
98
|
+
|
99
|
+
Feel free to fork and pull request.
|
data/Rakefile
CHANGED
data/bin/tau
CHANGED
data/features/builder.feature
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
Feature: Builder
|
2
|
-
In order to avoid compiling all files by hand
|
3
|
-
As a web developer
|
4
|
-
I want tau compile all files for me
|
5
|
-
|
6
|
-
Background: making project
|
7
|
-
Given I successfully run `tau new project2build`
|
8
|
-
And I cd to "project2build"
|
9
|
-
|
10
|
-
Scenario: building project
|
11
|
-
Given a file named "code/hamltest.haml" with:
|
12
|
-
"""
|
13
|
-
%h1 Hello, world!
|
14
|
-
%strong I'm tau ;)
|
15
|
-
"""
|
16
|
-
And a file named "code/js/coffeetest.coffee" with:
|
17
|
-
"""
|
18
|
-
square = (x) -> x * x
|
19
|
-
cube = (x) -> square(x) * x
|
20
|
-
"""
|
21
|
-
And a file named "code/css/sasstest.sass" with:
|
22
|
-
"""
|
23
|
-
$blue: #3bbfce
|
24
|
-
.content-navigation
|
25
|
-
border-color: $blue
|
26
|
-
color: darken($blue, 9%)
|
27
|
-
"""
|
28
|
-
And a file named "code/css/scsstest.scss" with:
|
29
|
-
"""
|
30
|
-
$blue: #3bbfce;
|
31
|
-
.content-navigation {
|
32
|
-
border-color: $blue;
|
33
|
-
color:
|
34
|
-
darken($blue, 9%);
|
35
|
-
}
|
36
|
-
"""
|
37
|
-
When I successfully run `tau build`
|
38
|
-
Then I should see file "build/hamltest.html" compiled from haml in "code/hamltest.haml"
|
39
|
-
And I should see file "build/js/coffeetest.js" compiled from coffee-script in "code/js/coffeetest.coffee"
|
40
|
-
And I should see file "build/css/sasstest.css" compiled from sass in "code/css/sasstest.sass"
|
41
|
-
And I should see file "build/css/scsstest.css" compiled from scss in "code/css/scsstest.scss"
|
1
|
+
Feature: Builder
|
2
|
+
In order to avoid compiling all files by hand
|
3
|
+
As a web developer
|
4
|
+
I want tau compile all files for me
|
5
|
+
|
6
|
+
Background: making project
|
7
|
+
Given I successfully run `tau new project2build`
|
8
|
+
And I cd to "project2build"
|
9
|
+
|
10
|
+
Scenario: building project
|
11
|
+
Given a file named "code/hamltest.haml" with:
|
12
|
+
"""
|
13
|
+
%h1 Hello, world!
|
14
|
+
%strong I'm tau ;)
|
15
|
+
"""
|
16
|
+
And a file named "code/js/coffeetest.coffee" with:
|
17
|
+
"""
|
18
|
+
square = (x) -> x * x
|
19
|
+
cube = (x) -> square(x) * x
|
20
|
+
"""
|
21
|
+
And a file named "code/css/sasstest.sass" with:
|
22
|
+
"""
|
23
|
+
$blue: #3bbfce
|
24
|
+
.content-navigation
|
25
|
+
border-color: $blue
|
26
|
+
color: darken($blue, 9%)
|
27
|
+
"""
|
28
|
+
And a file named "code/css/scsstest.scss" with:
|
29
|
+
"""
|
30
|
+
$blue: #3bbfce;
|
31
|
+
.content-navigation {
|
32
|
+
border-color: $blue;
|
33
|
+
color:
|
34
|
+
darken($blue, 9%);
|
35
|
+
}
|
36
|
+
"""
|
37
|
+
When I successfully run `tau build`
|
38
|
+
Then I should see file "build/hamltest.html" compiled from haml in "code/hamltest.haml"
|
39
|
+
And I should see file "build/js/coffeetest.js" compiled from coffee-script in "code/js/coffeetest.coffee"
|
40
|
+
And I should see file "build/css/sasstest.css" compiled from sass in "code/css/sasstest.sass"
|
41
|
+
And I should see file "build/css/scsstest.css" compiled from scss in "code/css/scsstest.scss"
|
@@ -1,20 +1,20 @@
|
|
1
|
-
Feature: Making new projects
|
2
|
-
In order to avoid making project directory myself
|
3
|
-
As a web developer
|
4
|
-
I want tau make project for me
|
5
|
-
|
6
|
-
Scenario: making new project by tau
|
7
|
-
When I successfully run `tau new test_project`
|
8
|
-
Then there should be right project directory "test_project"
|
9
|
-
|
10
|
-
Scenario: making project with dot in project name
|
11
|
-
When I successfully run `tau new .test.project.`
|
12
|
-
Then there should be right project directory ".test.project."
|
13
|
-
|
14
|
-
Scenario: making project with cyrillic name
|
15
|
-
When I successfully run `tau new тест`
|
16
|
-
Then there should be right project directory "тест"
|
17
|
-
|
18
|
-
Scenario: making project with "-" symbol in project name
|
19
|
-
When I successfully run `tau new -test-project-`
|
20
|
-
Then there should be right project directory "-test-project-"
|
1
|
+
Feature: Making new projects
|
2
|
+
In order to avoid making project directory myself
|
3
|
+
As a web developer
|
4
|
+
I want tau make project for me
|
5
|
+
|
6
|
+
Scenario: making new project by tau
|
7
|
+
When I successfully run `tau new test_project`
|
8
|
+
Then there should be right project directory "test_project"
|
9
|
+
|
10
|
+
Scenario: making project with dot in project name
|
11
|
+
When I successfully run `tau new .test.project.`
|
12
|
+
Then there should be right project directory ".test.project."
|
13
|
+
|
14
|
+
Scenario: making project with cyrillic name
|
15
|
+
When I successfully run `tau new тест`
|
16
|
+
Then there should be right project directory "тест"
|
17
|
+
|
18
|
+
Scenario: making project with "-" symbol in project name
|
19
|
+
When I successfully run `tau new -test-project-`
|
20
|
+
Then there should be right project directory "-test-project-"
|
@@ -1,20 +1,20 @@
|
|
1
|
-
Then /^there should be right project directory "(.*)"$/ do |project_dir|
|
2
|
-
tau_dirs = ['/code', 'code/js', 'code/css', 'code/img'].map { |dir| "#{project_dir}/#{dir}" }
|
3
|
-
check_directory_presence(tau_dirs, true)
|
4
|
-
tau_files = ['tau.yml'].map { |file| "#{project_dir}/#{file}" }
|
5
|
-
check_file_presence(tau_files, true)
|
6
|
-
end
|
7
|
-
|
8
|
-
Then /^I should see file "(.*)" compiled from (haml|sass|scss|coffee-script) in "(.*)"$/ do |compiled_file, lang, src_file|
|
9
|
-
compiled_file_content = nil
|
10
|
-
src_file_content = nil
|
11
|
-
in_current_dir do
|
12
|
-
compiled_file_content = File.read compiled_file
|
13
|
-
src_file_content = File.read src_file
|
14
|
-
end
|
15
|
-
compiled_file_content.should == render(src_file_content, lang)
|
16
|
-
end
|
17
|
-
|
18
|
-
Given /^I'm on sandbox project directory$/ do
|
19
|
-
@dirs = [SANDBOX_PROJECT_DIR]
|
20
|
-
end
|
1
|
+
Then /^there should be right project directory "(.*)"$/ do |project_dir|
|
2
|
+
tau_dirs = ['/code', 'code/js', 'code/css', 'code/img'].map { |dir| "#{project_dir}/#{dir}" }
|
3
|
+
check_directory_presence(tau_dirs, true)
|
4
|
+
tau_files = ['tau.yml'].map { |file| "#{project_dir}/#{file}" }
|
5
|
+
check_file_presence(tau_files, true)
|
6
|
+
end
|
7
|
+
|
8
|
+
Then /^I should see file "(.*)" compiled from (haml|sass|scss|coffee-script) in "(.*)"$/ do |compiled_file, lang, src_file|
|
9
|
+
compiled_file_content = nil
|
10
|
+
src_file_content = nil
|
11
|
+
in_current_dir do
|
12
|
+
compiled_file_content = File.read compiled_file
|
13
|
+
src_file_content = File.read src_file
|
14
|
+
end
|
15
|
+
compiled_file_content.should == render(src_file_content, lang)
|
16
|
+
end
|
17
|
+
|
18
|
+
Given /^I'm on sandbox project directory$/ do
|
19
|
+
@dirs = [SANDBOX_PROJECT_DIR]
|
20
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Include useful steps.
|
1
|
+
# Include useful steps.
|
2
2
|
# See full list at https://github.com/cucumber/aruba/blob/master/lib/aruba/cucumber.rb
|
3
3
|
require 'aruba/cucumber'
|
4
4
|
|
@@ -6,6 +6,12 @@ require 'aruba/cucumber'
|
|
6
6
|
# See https://github.com/cucumber/aruba/blob/master/lib/aruba/api.rb for more information
|
7
7
|
require 'aruba/api'
|
8
8
|
|
9
|
+
# Prepare test environment.
|
10
|
+
# Build and intall our gem.
|
11
|
+
# `tau something` command will be executed in test environment.
|
12
|
+
require File.expand_path("#{File.dirname(__FILE__)}/cukegem.rb")
|
13
|
+
CukeGem.setup('tau.gemspec')
|
14
|
+
|
9
15
|
# Making test project and start server on it
|
10
16
|
require 'childprocess'
|
11
17
|
FileUtils::mkdir_p('tmp/sandbox')
|
@@ -13,11 +19,11 @@ server_process = nil
|
|
13
19
|
Dir.chdir('tmp/sandbox') do
|
14
20
|
FileUtils::rm_rf('servertesting')
|
15
21
|
# Create new project. TODO: think what if tau projecter not works correctly
|
16
|
-
ChildProcess.build('tau new servertesting').start.wait
|
22
|
+
ChildProcess.build('tau', 'new', 'servertesting').start.wait
|
17
23
|
|
18
24
|
# Run server on test project directory
|
19
25
|
Dir.chdir('servertesting') do
|
20
|
-
server_process = ChildProcess.build('tau server')
|
26
|
+
server_process = ChildProcess.build('tau', 'server')
|
21
27
|
server_process.start
|
22
28
|
end
|
23
29
|
end
|
@@ -27,9 +33,3 @@ SANDBOX_PROJECT_DIR = File.expand_path('tmp/sandbox/servertesting')
|
|
27
33
|
at_exit do
|
28
34
|
server_process.stop
|
29
35
|
end
|
30
|
-
|
31
|
-
# Prepare test environment.
|
32
|
-
# Build and intall our gem.
|
33
|
-
# `tau something` command will be executed in test environment.
|
34
|
-
require File.expand_path("#{File.dirname(__FILE__)}/cukegem.rb")
|
35
|
-
CukeGem.setup('tau.gemspec')
|