tipsy 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +6 -11
  3. data/README.md +24 -1
  4. data/Rakefile +13 -9
  5. data/bin/tipsy +4 -2
  6. data/lib/templates/server/htaccess.erb +14 -0
  7. data/lib/templates/site/Gemfile +19 -0
  8. data/lib/templates/site/assets/stylesheets/_config.css.scss +1 -0
  9. data/lib/templates/site/assets/stylesheets/screen.css.scss +1 -0
  10. data/lib/templates/site/config.rb +52 -0
  11. data/lib/templates/site/deploy.yml +27 -0
  12. data/lib/templates/site/layouts/default.html.erb +41 -0
  13. data/lib/templates/site/views/index.html.erb +2 -0
  14. data/lib/tipsy/compressors/{css.rb → css_compressor.rb} +0 -0
  15. data/lib/tipsy/compressors/javascript_compressor.rb +44 -0
  16. data/lib/tipsy/configuration.rb +9 -0
  17. data/lib/tipsy/handler/all.rb +4 -0
  18. data/lib/tipsy/handler/asset.rb +93 -0
  19. data/lib/tipsy/handler/erb.rb +42 -0
  20. data/lib/tipsy/handler/php.rb +36 -0
  21. data/lib/tipsy/{sass/template.rb → handler/sass/importer.rb} +15 -53
  22. data/lib/tipsy/handler/sass/resolver.rb +30 -0
  23. data/lib/tipsy/handler/sass.rb +36 -0
  24. data/lib/tipsy/handler/static.rb +30 -0
  25. data/lib/tipsy/helpers/asset_paths.rb +29 -1
  26. data/lib/tipsy/helpers/asset_tags.rb +1 -1
  27. data/lib/tipsy/helpers/capture.rb +12 -41
  28. data/lib/tipsy/helpers/rendering.rb +46 -0
  29. data/lib/tipsy/helpers/sass.rb +17 -6
  30. data/lib/tipsy/helpers/tag.rb +6 -9
  31. data/lib/tipsy/helpers.rb +13 -16
  32. data/lib/tipsy/runner.rb +82 -0
  33. data/lib/tipsy/runners/compiler.rb +189 -0
  34. data/lib/tipsy/runners/deployer.rb +7 -0
  35. data/lib/tipsy/runners/generator.rb +24 -0
  36. data/lib/tipsy/server.rb +56 -114
  37. data/lib/tipsy/site.rb +88 -0
  38. data/lib/tipsy/utils/logger.rb +47 -0
  39. data/lib/tipsy/utils/system.rb +115 -0
  40. data/lib/tipsy/utils/system_test.rb +103 -0
  41. data/lib/tipsy/version.rb +1 -1
  42. data/lib/tipsy/view/base.rb +55 -0
  43. data/lib/tipsy/view/context.rb +28 -0
  44. data/lib/tipsy/view/path.rb +44 -0
  45. data/lib/tipsy/view.rb +14 -68
  46. data/lib/tipsy.rb +30 -67
  47. data/{lib/tipsy/project/assets/javascripts/site.js → test/fixtures/capture.html.erb} +0 -0
  48. data/test/helpers/tag_test.rb +22 -0
  49. data/{lib/tipsy/project/assets/stylesheets/screen.css.scss → test/root/compiled/fake.txt} +0 -0
  50. data/test/root/{test/assets/javascripts/test.js → compiled/sub-path/fake.txt} +0 -0
  51. data/test/root/{development/assets/javascripts/test.js → compiled/sub-path-with-skip/fake.txt} +0 -0
  52. data/test/root/layouts/default.html.erb +0 -0
  53. data/test/root/views/index.html.erb +0 -0
  54. data/test/root/views/page.html.erb +0 -0
  55. data/test/root/views/sub/page.html.erb +0 -0
  56. data/test/root/views/sub/tertiary/index.html.erb +0 -0
  57. data/test/runner/compiler_test.rb +49 -0
  58. data/test/test_helper.rb +160 -21
  59. data/test/unit/site_test.rb +23 -0
  60. data/test/unit/tipsy_test.rb +13 -0
  61. data/test/unit/utils/system_test.rb +26 -0
  62. data/test/view/base_test.rb +34 -0
  63. data/test/view/path_test.rb +34 -0
  64. data/tipsy.gemspec +10 -7
  65. metadata +113 -84
  66. data/lib/tipsy/application.rb +0 -86
  67. data/lib/tipsy/builder.rb +0 -26
  68. data/lib/tipsy/builders/base.rb +0 -64
  69. data/lib/tipsy/builders/export.rb +0 -16
  70. data/lib/tipsy/builders/project.rb +0 -40
  71. data/lib/tipsy/builders/remote.rb +0 -14
  72. data/lib/tipsy/compressors/javascript.rb +0 -25
  73. data/lib/tipsy/logger.rb +0 -62
  74. data/lib/tipsy/project/Gemfile +0 -8
  75. data/lib/tipsy/project/config.erb +0 -19
  76. data/lib/tipsy/project/helpers/site_helper.rb +0 -4
  77. data/lib/tipsy/project/views/_layout.html.erb +0 -16
  78. data/test/fixtures/about.html +0 -1
  79. data/test/fixtures/contact.html +0 -1
  80. data/test/fixtures/index.html +0 -1
  81. data/test/functional/page_test.rb +0 -33
  82. data/test/root/.gitignore +0 -7
  83. data/test/root/development/assets/stylesheets/screen.css.scss +0 -3
  84. data/test/root/development/config.rb +0 -6
  85. data/test/root/development/views/_layout.html.erb +0 -20
  86. data/test/root/development/views/index.html.erb +0 -3
  87. data/test/root/test/assets/stylesheets/screen.css.scss +0 -3
  88. data/test/root/test/config.rb +0 -6
  89. data/test/root/test/views/_layout.html.erb +0 -1
  90. data/test/root/test/views/about/index.html +0 -1
  91. data/test/root/test/views/contact.html +0 -1
  92. data/test/root/test/views/index.html.erb +0 -1
  93. data/test/unit/helpers/asset_paths_test.rb +0 -14
  94. data/test/unit/helpers_test.rb +0 -22
  95. 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.2
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-08-08 00:00:00.000000000Z
12
+ date: 2011-09-05 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &70124632101280 !ruby/object:Gem::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.2'
21
+ version: '1.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70124632101280
24
+ version_requirements: *70121952819080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rack-test
27
- requirement: &70124632100660 !ruby/object:Gem::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.5'
32
+ version: '0.6'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70124632100660
35
+ version_requirements: *70121952807700
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: tilt
38
- requirement: &70124632100080 !ruby/object:Gem::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: *70124632100080
46
+ version_requirements: *70121952807120
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: i18n
49
- requirement: &70124632099500 !ruby/object:Gem::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.5'
54
+ version: '0.6'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70124632099500
57
+ version_requirements: *70121952806540
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sass
60
- requirement: &70124632098860 !ruby/object:Gem::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: *70124632098860
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: compass
71
- requirement: &70124632098360 !ruby/object:Gem::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: '11.5'
87
+ version: '2.0'
77
88
  type: :runtime
78
89
  prerelease: false
79
- version_requirements: *70124632098360
90
+ version_requirements: *70121952804900
80
91
  - !ruby/object:Gem::Dependency
81
- name: activesupport
82
- requirement: &70124632097860 !ruby/object:Gem::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: '3.0'
98
+ version: '1.2'
88
99
  type: :runtime
89
100
  prerelease: false
90
- version_requirements: *70124632097860
101
+ version_requirements: *70121952804320
91
102
  - !ruby/object:Gem::Dependency
92
- name: sprockets
93
- requirement: &70124632091080 !ruby/object:Gem::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.0.0.beta.12
109
+ version: '2.7'
99
110
  type: :runtime
100
111
  prerelease: false
101
- version_requirements: *70124632091080
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/application.rb
118
- - lib/tipsy/builder.rb
119
- - lib/tipsy/builders/base.rb
120
- - lib/tipsy/builders/export.rb
121
- - lib/tipsy/builders/project.rb
122
- - lib/tipsy/builders/remote.rb
123
- - lib/tipsy/compressors/css.rb
124
- - lib/tipsy/compressors/javascript.rb
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/logger.rb
132
- - lib/tipsy/project/Gemfile
133
- - lib/tipsy/project/assets/javascripts/site.js
134
- - lib/tipsy/project/assets/stylesheets/screen.css.scss
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
- - test/fixtures/about.html
143
- - test/fixtures/contact.html
144
- - test/fixtures/index.html
145
- - test/functional/page_test.rb
146
- - test/root/.gitignore
147
- - test/root/development/assets/javascripts/test.js
148
- - test/root/development/assets/stylesheets/screen.css.scss
149
- - test/root/development/config.rb
150
- - test/root/development/views/_layout.html.erb
151
- - test/root/development/views/index.html.erb
152
- - test/root/test/assets/javascripts/test.js
153
- - test/root/test/assets/stylesheets/screen.css.scss
154
- - test/root/test/config.rb
155
- - test/root/test/views/_layout.html.erb
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/helpers/asset_paths_test.rb
161
- - test/unit/helpers_test.rb
162
- - test/unit/server_test.rb
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/about.html
190
- - test/fixtures/contact.html
191
- - test/fixtures/index.html
192
- - test/functional/page_test.rb
193
- - test/root/.gitignore
194
- - test/root/development/assets/javascripts/test.js
195
- - test/root/development/assets/stylesheets/screen.css.scss
196
- - test/root/development/config.rb
197
- - test/root/development/views/_layout.html.erb
198
- - test/root/development/views/index.html.erb
199
- - test/root/test/assets/javascripts/test.js
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/helpers/asset_paths_test.rb
208
- - test/unit/helpers_test.rb
209
- - test/unit/server_test.rb
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
@@ -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
@@ -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,14 +0,0 @@
1
- module Tipsy
2
- module Builder
3
-
4
- class RemoteBuilder < Base
5
-
6
- def initialize
7
- @source_path = Tipsy.root
8
- @dest_path = ''
9
- end
10
-
11
- end
12
-
13
- end
14
- 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
@@ -1,8 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "rack", "~> 1.2"
4
- gem "tilt", "~> 1.3"
5
- gem "i18n", "~> 0.5"
6
- gem "sass", "~> 3.1"
7
- gem "activesupport", ">= 3.0"
8
- gem 'sprockets', '~> 2.0.0.beta.12'
@@ -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
@@ -1,4 +0,0 @@
1
- module SiteHelper
2
- # Add your helper methods here. You may also add additional helpers to your helpers folder.
3
- # Helpers should use Rails style naming conventions (site_helper.rb = SiteHelper)
4
- end