tipsy 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +9 -0
- data/README.md +2 -2
- data/Rakefile +10 -0
- data/bin/tipsy +16 -5
- data/lib/tipsy.rb +26 -14
- data/lib/tipsy/application.rb +14 -16
- data/lib/tipsy/builder.rb +17 -4
- data/lib/tipsy/builders/base.rb +64 -0
- data/lib/tipsy/builders/export.rb +16 -0
- data/lib/tipsy/builders/project.rb +40 -0
- data/lib/tipsy/builders/remote.rb +14 -0
- data/lib/tipsy/compressors/css.rb +11 -0
- data/lib/tipsy/compressors/javascript.rb +25 -0
- data/lib/tipsy/helpers.rb +24 -1
- data/lib/tipsy/helpers/asset_paths.rb +19 -0
- data/lib/tipsy/helpers/asset_tags.rb +32 -0
- data/lib/tipsy/helpers/capture.rb +33 -0
- data/lib/tipsy/helpers/sass.rb +40 -0
- data/lib/tipsy/helpers/tag.rb +12 -0
- data/lib/tipsy/logger.rb +54 -3
- data/lib/tipsy/project/Gemfile +8 -0
- data/lib/tipsy/project/config.erb +5 -2
- data/lib/tipsy/sass/template.rb +137 -0
- data/lib/tipsy/server.rb +50 -7
- data/lib/tipsy/version.rb +1 -1
- data/lib/tipsy/view.rb +24 -10
- data/test/fixtures/about.html +1 -0
- data/test/fixtures/contact.html +1 -0
- data/test/fixtures/index.html +1 -0
- data/test/functional/page_test.rb +33 -0
- data/test/root/{assets → development/assets}/javascripts/test.js +0 -0
- data/test/root/{assets → development/assets}/stylesheets/screen.css.scss +0 -0
- data/test/root/{config.rb → development/config.rb} +0 -0
- data/test/root/{views → development/views}/_layout.html.erb +0 -0
- data/test/root/{views → development/views}/index.html.erb +0 -0
- data/test/root/test/assets/javascripts/test.js +0 -0
- data/test/root/test/assets/stylesheets/screen.css.scss +3 -0
- data/test/root/test/config.rb +6 -0
- data/test/root/test/views/_layout.html.erb +1 -0
- data/test/root/test/views/about/index.html +1 -0
- data/test/root/test/views/contact.html +1 -0
- data/test/root/test/views/index.html.erb +1 -0
- data/test/test_helper.rb +33 -0
- data/test/unit/helpers/asset_paths_test.rb +14 -0
- data/test/unit/helpers_test.rb +22 -0
- data/test/unit/server_test.rb +1 -0
- data/tipsy.gemspec +5 -4
- metadata +83 -35
- data/config.ru +0 -26
- data/lib/tipsy/generator.rb +0 -53
data/config.ru
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
#\ -p 4000
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
|
4
|
-
require 'rubygems'
|
5
|
-
require 'bundler'
|
6
|
-
begin
|
7
|
-
Bundler.setup(:default, :development)
|
8
|
-
rescue Bundler::BundlerError => e
|
9
|
-
$stderr.puts e.message
|
10
|
-
$stderr.puts "Missing dependencies. Run `bundle install` to install missing gems."
|
11
|
-
exit e.status_code
|
12
|
-
end
|
13
|
-
|
14
|
-
require 'tipsy'
|
15
|
-
require 'sprockets'
|
16
|
-
|
17
|
-
# Setup the root path and initialize.
|
18
|
-
Tipsy.root = ::File.dirname(__FILE__) + "/test/root"
|
19
|
-
use Rack::CommonLogger
|
20
|
-
use Rack::ShowStatus
|
21
|
-
use Rack::ShowExceptions
|
22
|
-
run Rack::Cascade.new([
|
23
|
-
Rack::URLMap.new({ "/assets" => Tipsy::AssetHandler.new }),
|
24
|
-
Tipsy::Server.new,
|
25
|
-
Rack::Directory.new(Tipsy.root + '/public')
|
26
|
-
])
|
data/lib/tipsy/generator.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'tilt'
|
2
|
-
|
3
|
-
module Tipsy
|
4
|
-
class Generator
|
5
|
-
|
6
|
-
attr_reader :project_class, :dest_path, :source_path
|
7
|
-
|
8
|
-
def self.create_project!(name)
|
9
|
-
self.new(File.join(Tipsy.root, name.underscore), name.camelize)
|
10
|
-
end
|
11
|
-
|
12
|
-
def initialize(dir, klass)
|
13
|
-
Tipsy.root = dir
|
14
|
-
@project_class = klass
|
15
|
-
|
16
|
-
@dest_path = dir
|
17
|
-
@source_path = File.join(File.dirname(__FILE__), 'project')
|
18
|
-
generate!
|
19
|
-
end
|
20
|
-
|
21
|
-
def generate!
|
22
|
-
FileUtils.mkdir(dest_path) unless File.exists?(dest_path)
|
23
|
-
copy_source(source_path, dest_path)
|
24
|
-
config = Tilt.new(File.join(source_path, 'config.erb'), nil)
|
25
|
-
config = config.render(Object.new, {
|
26
|
-
:classname => @project_class,
|
27
|
-
:root => dest_path
|
28
|
-
})
|
29
|
-
File.open(File.join(dest_path, 'config.rb'), 'w'){ |io| io.write(config) }
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def copy_source(src, dest)
|
35
|
-
|
36
|
-
Dir.foreach(src) do |file|
|
37
|
-
next if file == '.' || file == '..' || file == 'config.erb'
|
38
|
-
|
39
|
-
source = File.join(src, file)
|
40
|
-
copyto = File.join(dest, file)
|
41
|
-
|
42
|
-
if File.directory?(source)
|
43
|
-
FileUtils.mkdir(copyto)
|
44
|
-
copy_source(source, copyto)
|
45
|
-
else
|
46
|
-
FileUtils.cp(source, copyto)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|