tau 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,58 @@
1
+ require 'haml'
2
+
3
+ module Tau
4
+ module ServerHelpers
5
+ module FileListing
6
+ def show_list_of_files_on(dirname, error="")
7
+ @title = "Tau: #{url_for dirname}"
8
+ @error = error
9
+ @file_list = list_of_files_on dirname
10
+ view = File.read File.join(File.dirname(__FILE__),'views/file_listing.haml')
11
+ halt Haml::Engine.new(view).render(self)
12
+ end
13
+
14
+ def list_of_files_on(dirname)
15
+ file_list = []
16
+ file_list << up_dir(dirname) unless upper_dir?(dirname)
17
+ Dir.chdir(dirname) do
18
+ Dir['*'].each do |filename|
19
+ file_list << {
20
+ filename: filename_for(filename),
21
+ type: File.directory?(filename) ? :dir : :file,
22
+ url: url_for(filename)
23
+ }
24
+ end
25
+ end
26
+ file_list.sort! do |one, another|
27
+ if one[:type] == :up or (one[:type] == :dir and another[:type] != :dir)
28
+ -1
29
+ elsif another[:type] == :up or (one[:type] != :dir and another[:type] == :dir)
30
+ 1
31
+ else
32
+ one[:filename] <=> another[:filename]
33
+ end
34
+ end
35
+ end
36
+
37
+ def upper_dir?(dirname)
38
+ dirname.end_with?("/code")
39
+ end
40
+
41
+ def up_dir(dirname)
42
+ {
43
+ filename: '..',
44
+ type: :up,
45
+ url: url_for(dirname.sub(%r(/[[:word:]\.-]+/?\z), '/'))
46
+ }
47
+ end
48
+
49
+ def filename_for(filename)
50
+ Enginer.dst_for filename
51
+ end
52
+
53
+ def url_for(filename)
54
+ File.expand_path(Enginer.dst_for filename).sub(%r(\A.*/code/?), '/')
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,20 @@
1
+ !!! 5
2
+ %html
3
+ %head
4
+ %title= @title
5
+ :css
6
+ #warning-message {
7
+ text-align: center;
8
+ font-size: 28px;
9
+ }
10
+ #file-list {
11
+ list-style-type: none;
12
+ }
13
+ .file {
14
+ font-size: 28px;
15
+ }
16
+ %body
17
+ %p#warning-message= @error
18
+ %ol#file-list
19
+ - @file_list.each do |file|
20
+ %li.file= %(<a href="#{file[:url]}">#{file[:filename]}</a>)
@@ -1,3 +1,3 @@
1
1
  module Tau
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
- s.require_paths = ["lib"]
16
+ s.executables = ['tau']
17
+ s.require_paths = ['lib']
18
18
 
19
19
  ['cucumber', 'aruba', 'childprocess'].each do |dependecy|
20
20
  s.add_development_dependency dependecy
metadata CHANGED
@@ -1,104 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tau
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dmitry Zhlobo
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-05-14 00:00:00.000000000 Z
11
+ date: 2013-10-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: cucumber
16
- requirement: &10883440 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *10883440
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: aruba
27
- requirement: &10940900 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *10940900
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: childprocess
38
- requirement: &10939680 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :development
45
49
  prerelease: false
46
- version_requirements: *10939680
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: sinatra
49
- requirement: &10937760 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :runtime
56
63
  prerelease: false
57
- version_requirements: *10937760
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: sass
60
- requirement: &10936900 !ruby/object:Gem::Requirement
61
- none: false
71
+ requirement: !ruby/object:Gem::Requirement
62
72
  requirements:
63
- - - ! '>='
73
+ - - '>='
64
74
  - !ruby/object:Gem::Version
65
75
  version: '0'
66
76
  type: :runtime
67
77
  prerelease: false
68
- version_requirements: *10936900
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: coffee-script
71
- requirement: &10999060 !ruby/object:Gem::Requirement
72
- none: false
85
+ requirement: !ruby/object:Gem::Requirement
73
86
  requirements:
74
- - - ! '>='
87
+ - - '>='
75
88
  - !ruby/object:Gem::Version
76
89
  version: '0'
77
90
  type: :runtime
78
91
  prerelease: false
79
- version_requirements: *10999060
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
80
97
  - !ruby/object:Gem::Dependency
81
98
  name: haml
82
- requirement: &10998500 !ruby/object:Gem::Requirement
83
- none: false
99
+ requirement: !ruby/object:Gem::Requirement
84
100
  requirements:
85
- - - ! '>='
101
+ - - '>='
86
102
  - !ruby/object:Gem::Version
87
103
  version: '0'
88
104
  type: :runtime
89
105
  prerelease: false
90
- version_requirements: *10998500
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
91
111
  - !ruby/object:Gem::Dependency
92
112
  name: thor
93
- requirement: &10997880 !ruby/object:Gem::Requirement
94
- none: false
113
+ requirement: !ruby/object:Gem::Requirement
95
114
  requirements:
96
- - - ! '>='
115
+ - - '>='
97
116
  - !ruby/object:Gem::Version
98
117
  version: '0'
99
118
  type: :runtime
100
119
  prerelease: false
101
- version_requirements: *10997880
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
102
125
  description: tau provide you write web pages on haml, stylesheets on sass and scripts
103
126
  on coffee.
104
127
  email:
@@ -109,7 +132,9 @@ extensions: []
109
132
  extra_rdoc_files: []
110
133
  files:
111
134
  - .gitignore
135
+ - .travis.yml
112
136
  - Gemfile
137
+ - LICENSE
113
138
  - README.md
114
139
  - Rakefile
115
140
  - bin/tau
@@ -125,42 +150,40 @@ files:
125
150
  - lib/tau.rb
126
151
  - lib/tau/builder.rb
127
152
  - lib/tau/cli.rb
153
+ - lib/tau/config.rb
154
+ - lib/tau/enginer.rb
155
+ - lib/tau/engines/abstract_engine.rb
156
+ - lib/tau/engines/coffee.rb
157
+ - lib/tau/engines/haml.rb
158
+ - lib/tau/engines/sass.rb
159
+ - lib/tau/engines/scss.rb
128
160
  - lib/tau/projecter.rb
129
- - lib/tau/renderer.rb
130
161
  - lib/tau/server.rb
162
+ - lib/tau/server/file_listing.rb
163
+ - lib/tau/server/views/file_listing.haml
131
164
  - lib/tau/version.rb
132
165
  - tau.gemspec
133
166
  homepage: http://github.com/proghat/tau
134
167
  licenses: []
168
+ metadata: {}
135
169
  post_install_message:
136
170
  rdoc_options: []
137
171
  require_paths:
138
172
  - lib
139
173
  required_ruby_version: !ruby/object:Gem::Requirement
140
- none: false
141
174
  requirements:
142
- - - ! '>='
175
+ - - '>='
143
176
  - !ruby/object:Gem::Version
144
177
  version: '0'
145
178
  required_rubygems_version: !ruby/object:Gem::Requirement
146
- none: false
147
179
  requirements:
148
- - - ! '>='
180
+ - - '>='
149
181
  - !ruby/object:Gem::Version
150
182
  version: '0'
151
183
  requirements: []
152
184
  rubyforge_project:
153
- rubygems_version: 1.8.15
185
+ rubygems_version: 2.0.2
154
186
  signing_key:
155
- specification_version: 3
187
+ specification_version: 4
156
188
  summary: Tool for web designers want to use haml, sass, coffee-script and others.
157
- test_files:
158
- - features/builder.feature
159
- - features/cli.feature
160
- - features/making_projects.feature
161
- - features/server.feature
162
- - features/step_definitions/cli.rb
163
- - features/step_definitions/fs.rb
164
- - features/step_definitions/network.rb
165
- - features/support/cukegem.rb
166
- - features/support/env.rb
189
+ test_files: []
@@ -1,55 +0,0 @@
1
- module Tau
2
- class Renderer
3
- class << self
4
-
5
- def render(content, lang)
6
- return sass content if lang == :sass
7
- return scss content if lang == :scss
8
- return haml content if lang == :haml
9
- return coffee content if lang == :coffee
10
- end
11
-
12
- def render_file(filename)
13
- raise "File is not exist" unless File.exist?(filename)
14
-
15
- content = File.read filename
16
- return content unless need_render?(filename)
17
- return sass content if filename.end_with?('.sass')
18
- return scss content if filename.end_with?('.scss')
19
- return haml content if filename.end_with?('.haml')
20
- return coffee content if filename.end_with?('.coffee')
21
- end
22
-
23
- def render_to_file(dst_filename, filename)
24
- File.write dst_filename, render_file(filename)
25
- end
26
-
27
- def need_render?(filename)
28
- return true if filename.end_with?('.sass') or
29
- filename.end_with?('.scss') or
30
- filename.end_with?('.haml') or
31
- filename.end_with?('.coffee')
32
- false
33
- end
34
-
35
- private
36
-
37
- def sass(content)
38
- Sass::Engine.new(content).render
39
- end
40
-
41
- def scss(content)
42
- Sass::Engine.new(content, syntax: :scss).render
43
- end
44
-
45
- def haml(content)
46
- Haml::Engine.new(content).render
47
- end
48
-
49
- def coffee(content)
50
- CoffeeScript.compile(content)
51
- end
52
-
53
- end
54
- end
55
- end