tipsy 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +6 -11
- data/README.md +24 -1
- data/Rakefile +13 -9
- data/bin/tipsy +4 -2
- data/lib/templates/server/htaccess.erb +14 -0
- data/lib/templates/site/Gemfile +19 -0
- data/lib/templates/site/assets/stylesheets/_config.css.scss +1 -0
- data/lib/templates/site/assets/stylesheets/screen.css.scss +1 -0
- data/lib/templates/site/config.rb +52 -0
- data/lib/templates/site/deploy.yml +27 -0
- data/lib/templates/site/layouts/default.html.erb +41 -0
- data/lib/templates/site/views/index.html.erb +2 -0
- data/lib/tipsy/compressors/{css.rb → css_compressor.rb} +0 -0
- data/lib/tipsy/compressors/javascript_compressor.rb +44 -0
- data/lib/tipsy/configuration.rb +9 -0
- data/lib/tipsy/handler/all.rb +4 -0
- data/lib/tipsy/handler/asset.rb +93 -0
- data/lib/tipsy/handler/erb.rb +42 -0
- data/lib/tipsy/handler/php.rb +36 -0
- data/lib/tipsy/{sass/template.rb → handler/sass/importer.rb} +15 -53
- data/lib/tipsy/handler/sass/resolver.rb +30 -0
- data/lib/tipsy/handler/sass.rb +36 -0
- data/lib/tipsy/handler/static.rb +30 -0
- data/lib/tipsy/helpers/asset_paths.rb +29 -1
- data/lib/tipsy/helpers/asset_tags.rb +1 -1
- data/lib/tipsy/helpers/capture.rb +12 -41
- data/lib/tipsy/helpers/rendering.rb +46 -0
- data/lib/tipsy/helpers/sass.rb +17 -6
- data/lib/tipsy/helpers/tag.rb +6 -9
- data/lib/tipsy/helpers.rb +13 -16
- data/lib/tipsy/runner.rb +82 -0
- data/lib/tipsy/runners/compiler.rb +189 -0
- data/lib/tipsy/runners/deployer.rb +7 -0
- data/lib/tipsy/runners/generator.rb +24 -0
- data/lib/tipsy/server.rb +56 -114
- data/lib/tipsy/site.rb +88 -0
- data/lib/tipsy/utils/logger.rb +47 -0
- data/lib/tipsy/utils/system.rb +115 -0
- data/lib/tipsy/utils/system_test.rb +103 -0
- data/lib/tipsy/version.rb +1 -1
- data/lib/tipsy/view/base.rb +55 -0
- data/lib/tipsy/view/context.rb +28 -0
- data/lib/tipsy/view/path.rb +44 -0
- data/lib/tipsy/view.rb +14 -68
- data/lib/tipsy.rb +30 -67
- data/{lib/tipsy/project/assets/javascripts/site.js → test/fixtures/capture.html.erb} +0 -0
- data/test/helpers/tag_test.rb +22 -0
- data/{lib/tipsy/project/assets/stylesheets/screen.css.scss → test/root/compiled/fake.txt} +0 -0
- data/test/root/{test/assets/javascripts/test.js → compiled/sub-path/fake.txt} +0 -0
- data/test/root/{development/assets/javascripts/test.js → compiled/sub-path-with-skip/fake.txt} +0 -0
- data/test/root/layouts/default.html.erb +0 -0
- data/test/root/views/index.html.erb +0 -0
- data/test/root/views/page.html.erb +0 -0
- data/test/root/views/sub/page.html.erb +0 -0
- data/test/root/views/sub/tertiary/index.html.erb +0 -0
- data/test/runner/compiler_test.rb +49 -0
- data/test/test_helper.rb +160 -21
- data/test/unit/site_test.rb +23 -0
- data/test/unit/tipsy_test.rb +13 -0
- data/test/unit/utils/system_test.rb +26 -0
- data/test/view/base_test.rb +34 -0
- data/test/view/path_test.rb +34 -0
- data/tipsy.gemspec +10 -7
- metadata +113 -84
- data/lib/tipsy/application.rb +0 -86
- data/lib/tipsy/builder.rb +0 -26
- data/lib/tipsy/builders/base.rb +0 -64
- data/lib/tipsy/builders/export.rb +0 -16
- data/lib/tipsy/builders/project.rb +0 -40
- data/lib/tipsy/builders/remote.rb +0 -14
- data/lib/tipsy/compressors/javascript.rb +0 -25
- data/lib/tipsy/logger.rb +0 -62
- data/lib/tipsy/project/Gemfile +0 -8
- data/lib/tipsy/project/config.erb +0 -19
- data/lib/tipsy/project/helpers/site_helper.rb +0 -4
- data/lib/tipsy/project/views/_layout.html.erb +0 -16
- data/test/fixtures/about.html +0 -1
- data/test/fixtures/contact.html +0 -1
- data/test/fixtures/index.html +0 -1
- data/test/functional/page_test.rb +0 -33
- data/test/root/.gitignore +0 -7
- data/test/root/development/assets/stylesheets/screen.css.scss +0 -3
- data/test/root/development/config.rb +0 -6
- data/test/root/development/views/_layout.html.erb +0 -20
- data/test/root/development/views/index.html.erb +0 -3
- data/test/root/test/assets/stylesheets/screen.css.scss +0 -3
- data/test/root/test/config.rb +0 -6
- data/test/root/test/views/_layout.html.erb +0 -1
- data/test/root/test/views/about/index.html +0 -1
- data/test/root/test/views/contact.html +0 -1
- data/test/root/test/views/index.html.erb +0 -1
- data/test/unit/helpers/asset_paths_test.rb +0 -14
- data/test/unit/helpers_test.rb +0 -22
- data/test/unit/server_test.rb +0 -1
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tipsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,33 +9,33 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-09-05 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
16
|
-
requirement: &
|
16
|
+
requirement: &70121952819080 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '1.
|
21
|
+
version: '1.3'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70121952819080
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rack-test
|
27
|
-
requirement: &
|
27
|
+
requirement: &70121952807700 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0.
|
32
|
+
version: '0.6'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70121952807700
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: tilt
|
38
|
-
requirement: &
|
38
|
+
requirement: &70121952807120 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,21 +43,21 @@ dependencies:
|
|
43
43
|
version: '1.3'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70121952807120
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: i18n
|
49
|
-
requirement: &
|
49
|
+
requirement: &70121952806540 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.6'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70121952806540
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: sass
|
60
|
-
requirement: &
|
60
|
+
requirement: &70121952806020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,40 +65,62 @@ dependencies:
|
|
65
65
|
version: '3.1'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70121952806020
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activesupport
|
71
|
+
requirement: &70121952805500 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.1'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70121952805500
|
69
80
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
-
requirement: &
|
81
|
+
name: sprockets
|
82
|
+
requirement: &70121952804900 !ruby/object:Gem::Requirement
|
72
83
|
none: false
|
73
84
|
requirements:
|
74
85
|
- - ~>
|
75
86
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
87
|
+
version: '2.0'
|
77
88
|
type: :runtime
|
78
89
|
prerelease: false
|
79
|
-
version_requirements: *
|
90
|
+
version_requirements: *70121952804900
|
80
91
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
82
|
-
requirement: &
|
92
|
+
name: hike
|
93
|
+
requirement: &70121952804320 !ruby/object:Gem::Requirement
|
83
94
|
none: false
|
84
95
|
requirements:
|
85
|
-
- -
|
96
|
+
- - ~>
|
86
97
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
98
|
+
version: '1.2'
|
88
99
|
type: :runtime
|
89
100
|
prerelease: false
|
90
|
-
version_requirements: *
|
101
|
+
version_requirements: *70121952804320
|
91
102
|
- !ruby/object:Gem::Dependency
|
92
|
-
name:
|
93
|
-
requirement: &
|
103
|
+
name: erubis
|
104
|
+
requirement: &70121952803760 !ruby/object:Gem::Requirement
|
94
105
|
none: false
|
95
106
|
requirements:
|
96
107
|
- - ~>
|
97
108
|
- !ruby/object:Gem::Version
|
98
|
-
version: 2.
|
109
|
+
version: '2.7'
|
99
110
|
type: :runtime
|
100
111
|
prerelease: false
|
101
|
-
version_requirements: *
|
112
|
+
version_requirements: *70121952803760
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: minitest
|
115
|
+
requirement: &70121952803200 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ~>
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '2.5'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *70121952803200
|
102
124
|
description: Tipsy is a mini Rack application for working with static websites using
|
103
125
|
Tilt, and Sprockets.
|
104
126
|
email:
|
@@ -113,53 +135,64 @@ files:
|
|
113
135
|
- README.md
|
114
136
|
- Rakefile
|
115
137
|
- bin/tipsy
|
138
|
+
- lib/templates/server/htaccess.erb
|
139
|
+
- lib/templates/site/Gemfile
|
140
|
+
- lib/templates/site/assets/stylesheets/_config.css.scss
|
141
|
+
- lib/templates/site/assets/stylesheets/screen.css.scss
|
142
|
+
- lib/templates/site/config.rb
|
143
|
+
- lib/templates/site/deploy.yml
|
144
|
+
- lib/templates/site/layouts/default.html.erb
|
145
|
+
- lib/templates/site/views/index.html.erb
|
116
146
|
- lib/tipsy.rb
|
117
|
-
- lib/tipsy/
|
118
|
-
- lib/tipsy/
|
119
|
-
- lib/tipsy/
|
120
|
-
- lib/tipsy/
|
121
|
-
- lib/tipsy/
|
122
|
-
- lib/tipsy/
|
123
|
-
- lib/tipsy/
|
124
|
-
- lib/tipsy/
|
147
|
+
- lib/tipsy/compressors/css_compressor.rb
|
148
|
+
- lib/tipsy/compressors/javascript_compressor.rb
|
149
|
+
- lib/tipsy/configuration.rb
|
150
|
+
- lib/tipsy/handler/all.rb
|
151
|
+
- lib/tipsy/handler/asset.rb
|
152
|
+
- lib/tipsy/handler/erb.rb
|
153
|
+
- lib/tipsy/handler/php.rb
|
154
|
+
- lib/tipsy/handler/sass.rb
|
155
|
+
- lib/tipsy/handler/sass/importer.rb
|
156
|
+
- lib/tipsy/handler/sass/resolver.rb
|
157
|
+
- lib/tipsy/handler/static.rb
|
125
158
|
- lib/tipsy/helpers.rb
|
126
159
|
- lib/tipsy/helpers/asset_paths.rb
|
127
160
|
- lib/tipsy/helpers/asset_tags.rb
|
128
161
|
- lib/tipsy/helpers/capture.rb
|
162
|
+
- lib/tipsy/helpers/rendering.rb
|
129
163
|
- lib/tipsy/helpers/sass.rb
|
130
164
|
- lib/tipsy/helpers/tag.rb
|
131
|
-
- lib/tipsy/
|
132
|
-
- lib/tipsy/
|
133
|
-
- lib/tipsy/
|
134
|
-
- lib/tipsy/
|
135
|
-
- lib/tipsy/project/config.erb
|
136
|
-
- lib/tipsy/project/helpers/site_helper.rb
|
137
|
-
- lib/tipsy/project/views/_layout.html.erb
|
138
|
-
- lib/tipsy/sass/template.rb
|
165
|
+
- lib/tipsy/runner.rb
|
166
|
+
- lib/tipsy/runners/compiler.rb
|
167
|
+
- lib/tipsy/runners/deployer.rb
|
168
|
+
- lib/tipsy/runners/generator.rb
|
139
169
|
- lib/tipsy/server.rb
|
170
|
+
- lib/tipsy/site.rb
|
171
|
+
- lib/tipsy/utils/logger.rb
|
172
|
+
- lib/tipsy/utils/system.rb
|
173
|
+
- lib/tipsy/utils/system_test.rb
|
140
174
|
- lib/tipsy/version.rb
|
141
175
|
- lib/tipsy/view.rb
|
142
|
-
-
|
143
|
-
-
|
144
|
-
-
|
145
|
-
- test/
|
146
|
-
- test/
|
147
|
-
- test/root/
|
148
|
-
- test/root/
|
149
|
-
- test/root/
|
150
|
-
- test/root/
|
151
|
-
- test/root/
|
152
|
-
- test/root/
|
153
|
-
- test/root/
|
154
|
-
- test/root/
|
155
|
-
- test/
|
156
|
-
- test/root/test/views/about/index.html
|
157
|
-
- test/root/test/views/contact.html
|
158
|
-
- test/root/test/views/index.html.erb
|
176
|
+
- lib/tipsy/view/base.rb
|
177
|
+
- lib/tipsy/view/context.rb
|
178
|
+
- lib/tipsy/view/path.rb
|
179
|
+
- test/fixtures/capture.html.erb
|
180
|
+
- test/helpers/tag_test.rb
|
181
|
+
- test/root/compiled/fake.txt
|
182
|
+
- test/root/compiled/sub-path-with-skip/fake.txt
|
183
|
+
- test/root/compiled/sub-path/fake.txt
|
184
|
+
- test/root/layouts/default.html.erb
|
185
|
+
- test/root/views/index.html.erb
|
186
|
+
- test/root/views/page.html.erb
|
187
|
+
- test/root/views/sub/page.html.erb
|
188
|
+
- test/root/views/sub/tertiary/index.html.erb
|
189
|
+
- test/runner/compiler_test.rb
|
159
190
|
- test/test_helper.rb
|
160
|
-
- test/unit/
|
161
|
-
- test/unit/
|
162
|
-
- test/unit/
|
191
|
+
- test/unit/site_test.rb
|
192
|
+
- test/unit/tipsy_test.rb
|
193
|
+
- test/unit/utils/system_test.rb
|
194
|
+
- test/view/base_test.rb
|
195
|
+
- test/view/path_test.rb
|
163
196
|
- tipsy.gemspec
|
164
197
|
homepage: https://github.com/kurbmedia/tipsy
|
165
198
|
licenses: []
|
@@ -186,24 +219,20 @@ signing_key:
|
|
186
219
|
specification_version: 3
|
187
220
|
summary: A mini Rack application server for developing static sites.
|
188
221
|
test_files:
|
189
|
-
- test/fixtures/
|
190
|
-
- test/
|
191
|
-
- test/
|
192
|
-
- test/
|
193
|
-
- test/root
|
194
|
-
- test/root/
|
195
|
-
- test/root/
|
196
|
-
- test/root/
|
197
|
-
- test/root/
|
198
|
-
- test/root/
|
199
|
-
- test/
|
200
|
-
- test/root/test/assets/stylesheets/screen.css.scss
|
201
|
-
- test/root/test/config.rb
|
202
|
-
- test/root/test/views/_layout.html.erb
|
203
|
-
- test/root/test/views/about/index.html
|
204
|
-
- test/root/test/views/contact.html
|
205
|
-
- test/root/test/views/index.html.erb
|
222
|
+
- test/fixtures/capture.html.erb
|
223
|
+
- test/helpers/tag_test.rb
|
224
|
+
- test/root/compiled/fake.txt
|
225
|
+
- test/root/compiled/sub-path-with-skip/fake.txt
|
226
|
+
- test/root/compiled/sub-path/fake.txt
|
227
|
+
- test/root/layouts/default.html.erb
|
228
|
+
- test/root/views/index.html.erb
|
229
|
+
- test/root/views/page.html.erb
|
230
|
+
- test/root/views/sub/page.html.erb
|
231
|
+
- test/root/views/sub/tertiary/index.html.erb
|
232
|
+
- test/runner/compiler_test.rb
|
206
233
|
- test/test_helper.rb
|
207
|
-
- test/unit/
|
208
|
-
- test/unit/
|
209
|
-
- test/unit/
|
234
|
+
- test/unit/site_test.rb
|
235
|
+
- test/unit/tipsy_test.rb
|
236
|
+
- test/unit/utils/system_test.rb
|
237
|
+
- test/view/base_test.rb
|
238
|
+
- test/view/path_test.rb
|
data/lib/tipsy/application.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'rack'
|
2
|
-
|
3
|
-
##
|
4
|
-
# Base class for all applications. Handles configuration of options,
|
5
|
-
# and processing of command line arguments.
|
6
|
-
#
|
7
|
-
module Tipsy
|
8
|
-
class Application
|
9
|
-
|
10
|
-
class_attribute :config, :instance_writer => false
|
11
|
-
attr_reader :app
|
12
|
-
|
13
|
-
def self.create(name = nil)
|
14
|
-
raise "Missing project name for 'tipsy new'" unless name
|
15
|
-
Tipsy::Builder.build!(:project, name)
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.build
|
19
|
-
Tipsy::Builder.build!(:export)
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.deploy
|
23
|
-
Tipsy::Builder.build!(:remote)
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.initialize!
|
27
|
-
self.config = Tipsy.options
|
28
|
-
begin
|
29
|
-
require File.join(Tipsy.root, 'config.rb')
|
30
|
-
rescue LoadError
|
31
|
-
puts "To configure additional settings, create a config.rb in your root path. (#{Tipsy.root})"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.run
|
36
|
-
initialize!
|
37
|
-
self.new
|
38
|
-
end
|
39
|
-
|
40
|
-
def initialize
|
41
|
-
require 'tipsy/helpers/sass'
|
42
|
-
@app = Tipsy::Server.init!
|
43
|
-
|
44
|
-
Tipsy.logger.info("Tipsy #{Tipsy::VERSION} running on #{config.address}:#{config.port}")
|
45
|
-
|
46
|
-
begin run_thin
|
47
|
-
rescue LoadError
|
48
|
-
begin run_mongrel
|
49
|
-
rescue LoadError
|
50
|
-
run_webrick
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
private
|
56
|
-
|
57
|
-
def server_opts
|
58
|
-
{ :Port => config.port, :Host => config.address }
|
59
|
-
end
|
60
|
-
|
61
|
-
def run_thin
|
62
|
-
handler = Rack::Handler.get('thin')
|
63
|
-
handler.run app, server_opts do |server|
|
64
|
-
puts "Running Tipsy with Thin (#{Thin::VERSION::STRING})."
|
65
|
-
end
|
66
|
-
exit(0)
|
67
|
-
end
|
68
|
-
|
69
|
-
def run_mongrel
|
70
|
-
handler = Rack::Handler.get('mongrel')
|
71
|
-
handler.run app, server_opts do |server|
|
72
|
-
puts "Running Tipsy with Mongrel (#{Mongrel::Const::MONGREL_VERSION})."
|
73
|
-
end
|
74
|
-
exit(0)
|
75
|
-
end
|
76
|
-
|
77
|
-
def run_webrick
|
78
|
-
handler = Rack::Handler.get('webrick')
|
79
|
-
handler.run app, server_opts do |server|
|
80
|
-
puts "Running Tipsy with Webrick. To use Mongrel or Thin (recommended), add them to your Gemfile"
|
81
|
-
trap("INT"){ server.shutdown }
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
end
|
86
|
-
end
|
data/lib/tipsy/builder.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'active_support/inflector'
|
2
|
-
|
3
|
-
##
|
4
|
-
# Handles building source files into a final project, for
|
5
|
-
# either deployment or output to a directory
|
6
|
-
#
|
7
|
-
module Tipsy
|
8
|
-
module Builder
|
9
|
-
|
10
|
-
autoload :Base, 'tipsy/builders/base'
|
11
|
-
autoload :ProjectBuilder, 'tipsy/builders/project'
|
12
|
-
autoload :ExportBuilder, 'tipsy/builders/local'
|
13
|
-
autoload :RemoteBuilder, 'tipsy/builders/remote'
|
14
|
-
|
15
|
-
def self.build!(type = :project, *args)
|
16
|
-
handler = case type
|
17
|
-
when :project then ProjectBuilder.new(*args)
|
18
|
-
when :export then ExportBuilder.new(*args)
|
19
|
-
when :remote then RemoteBuilder.new(*args)
|
20
|
-
else raise 'No builder specified'
|
21
|
-
end
|
22
|
-
handler.build!
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
data/lib/tipsy/builders/base.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
module Tipsy
|
2
|
-
module Builder
|
3
|
-
class Base
|
4
|
-
attr_reader :source_path, :dest_path
|
5
|
-
|
6
|
-
def excludes
|
7
|
-
@excludes ||= ['.git', '.gitignore', '.sass-cache', 'config.erb', '*.rb', '.', '..']
|
8
|
-
end
|
9
|
-
|
10
|
-
def build!
|
11
|
-
process_location(source_path, dest_path)
|
12
|
-
end
|
13
|
-
|
14
|
-
protected
|
15
|
-
|
16
|
-
def excluded?(file)
|
17
|
-
return true if excludes.include?(file)
|
18
|
-
excludes.detect{ |exc| File.basename(exc).to_s.match(exc) }.nil?
|
19
|
-
end
|
20
|
-
|
21
|
-
def log_action(action, name)
|
22
|
-
name = name.gsub(dest_path, '').sub(/^\//, '')
|
23
|
-
Tipsy.logger.log_action(action, name)
|
24
|
-
end
|
25
|
-
|
26
|
-
##
|
27
|
-
# By default make_file copies from one location to another
|
28
|
-
# Overridden in non-local scenarios
|
29
|
-
#
|
30
|
-
def make_file(source, destination)
|
31
|
-
log_action("create", destination)
|
32
|
-
FileUtils.cp(source, destination)
|
33
|
-
end
|
34
|
-
|
35
|
-
##
|
36
|
-
# By default make_folder makes a matching folder in destination from source
|
37
|
-
# Overridden in non-local scenarios
|
38
|
-
#
|
39
|
-
def make_folder(dirname)
|
40
|
-
log_action("create", dirname)
|
41
|
-
FileUtils.mkdir(dirname)
|
42
|
-
end
|
43
|
-
|
44
|
-
##
|
45
|
-
# Iterate through a file tree and process each file and folder.
|
46
|
-
#
|
47
|
-
def process_location(src, dest)
|
48
|
-
Dir.foreach(src) do |file|
|
49
|
-
next if excluded?(file)
|
50
|
-
source = File.join(src, file)
|
51
|
-
destination = File.join(dest, file)
|
52
|
-
|
53
|
-
if File.directory?(source)
|
54
|
-
make_folder(destination)
|
55
|
-
process_location(source, destination)
|
56
|
-
else
|
57
|
-
make_file(source, destination)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Tipsy
|
2
|
-
module Builder
|
3
|
-
class ExportBuilder < Base
|
4
|
-
|
5
|
-
def initialize
|
6
|
-
@source_path = Tipsy.root
|
7
|
-
@dest_path = Tipsy.options.build_path
|
8
|
-
end
|
9
|
-
|
10
|
-
def build!
|
11
|
-
FileUtils.mkdir(dest_path) unless File.exists?(dest_path) && File.directory?(dest_path)
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'erb'
|
3
|
-
|
4
|
-
module Tipsy
|
5
|
-
module Builder
|
6
|
-
class ProjectBuilder < Base
|
7
|
-
attr_reader :project
|
8
|
-
|
9
|
-
def initialize(name)
|
10
|
-
@project = name.camelize
|
11
|
-
@dest_path = File.join(Tipsy.root, name.underscore)
|
12
|
-
@source_path = File.expand_path("../../project", __FILE__)
|
13
|
-
end
|
14
|
-
|
15
|
-
def build!
|
16
|
-
|
17
|
-
FileUtils.mkdir(dest_path) unless File.exists?(dest_path)
|
18
|
-
super
|
19
|
-
cvars = Conf.new
|
20
|
-
cvars.root = dest_path
|
21
|
-
cvars.classname = @project
|
22
|
-
template = File.read(File.join(source_path, 'config.erb'))
|
23
|
-
config = ERB.new(template).result(cvars.get_binding)
|
24
|
-
|
25
|
-
File.open(File.join(dest_path, 'config.rb'), 'w'){ |io| io.write(config) }
|
26
|
-
log_action('create', File.join(dest_path, 'config.rb'))
|
27
|
-
|
28
|
-
Tipsy.logger.info("\n Project #{project} created in #{dest_path}.")
|
29
|
-
Tipsy.logger.info(" Run 'tipsy' from the root folder to start the server.\n\n")
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
class Conf
|
34
|
-
attr_accessor :classname, :root
|
35
|
-
def get_binding; binding; end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Interface to Google's Online Closure Compiler.
|
3
|
-
# Uglifier is recommended (gem install uglifier) however to support environments where Node.js
|
4
|
-
# is unavailable this can be used as a fallback.
|
5
|
-
#
|
6
|
-
require 'net/http'
|
7
|
-
require 'uri'
|
8
|
-
|
9
|
-
module Tipsy
|
10
|
-
module Compressors
|
11
|
-
# http://closure-compiler.appspot.com/compile
|
12
|
-
class JavascriptCompressor
|
13
|
-
def compress(js)
|
14
|
-
return js if js.to_s.blank?
|
15
|
-
post_data = {
|
16
|
-
'compilation_level' => 'SIMPLE_OPTIMIZATIONS',
|
17
|
-
'js_code' => js.to_s,
|
18
|
-
'output_format' => 'text'
|
19
|
-
}
|
20
|
-
request = Net::HTTP.post_form(URI.parse('http://closure-compiler.appspot.com/compile'), post_data)
|
21
|
-
request.body.to_s
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/tipsy/logger.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'logger'
|
2
|
-
|
3
|
-
module Tipsy
|
4
|
-
class Logger
|
5
|
-
|
6
|
-
COLOR_VALUES = {
|
7
|
-
:clear => 0,
|
8
|
-
:red => 31,
|
9
|
-
:green => 32,
|
10
|
-
:yellow => 33
|
11
|
-
}
|
12
|
-
|
13
|
-
attr_accessor :cache
|
14
|
-
attr_reader :stdout
|
15
|
-
|
16
|
-
def initialize(o)
|
17
|
-
@stdout = o
|
18
|
-
@cache = []
|
19
|
-
end
|
20
|
-
|
21
|
-
def append(msg)
|
22
|
-
@cache << msg
|
23
|
-
end
|
24
|
-
|
25
|
-
def flush!
|
26
|
-
cache.each{ |c| print c }
|
27
|
-
end
|
28
|
-
|
29
|
-
def log_action(name, action)
|
30
|
-
print colorize(:green, (name.rjust(12, ' ') << " "), :clear, action)
|
31
|
-
end
|
32
|
-
|
33
|
-
def info(msg)
|
34
|
-
print msg
|
35
|
-
end
|
36
|
-
|
37
|
-
def warn(msg)
|
38
|
-
print colorize(:yellow, "Warning: ", :clear, msg)
|
39
|
-
end
|
40
|
-
|
41
|
-
def error
|
42
|
-
print colorize(:red, "Error: ", :clear, msg)
|
43
|
-
end
|
44
|
-
|
45
|
-
def colorize(*args)
|
46
|
-
output = args.inject([]) do |arr, option|
|
47
|
-
unless option.is_a?(Symbol) && COLOR_VALUES[option]
|
48
|
-
arr << option
|
49
|
-
else
|
50
|
-
arr << "\e[#{COLOR_VALUES[option]}m"
|
51
|
-
end
|
52
|
-
arr
|
53
|
-
end
|
54
|
-
output.push("\e[0m").join("")
|
55
|
-
end
|
56
|
-
|
57
|
-
def print(msg)
|
58
|
-
puts msg
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
end
|
data/lib/tipsy/project/Gemfile
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
class <%= classname %> < Tipsy::Application
|
2
|
-
|
3
|
-
# Configure assets to be precompiled
|
4
|
-
config.assets.precompile << "site.js"
|
5
|
-
config.assets.precompile << "screen.css"
|
6
|
-
|
7
|
-
# Add assets to the load path
|
8
|
-
# config.assets.paths << "/some/path"
|
9
|
-
|
10
|
-
# The path where build files will go when compiled
|
11
|
-
# config.build_path = <%= File.join(root, 'build') %>
|
12
|
-
|
13
|
-
# The path where public files exist (default root/public)
|
14
|
-
# config.public_path = <%= File.join(root, 'public') %>
|
15
|
-
|
16
|
-
# The path where assets will be stored on build (default public_path/assets)
|
17
|
-
# config.asset_path = <%= File.join(root, 'assets') %>
|
18
|
-
|
19
|
-
end
|