assetify 0.7.0.rc1 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +4 -4
- data/README.md +27 -8
- data/VERSION +1 -1
- data/assetify.gemspec +11 -5
- data/bin/assetify +1 -1
- data/lib/assetify.rb +21 -7
- data/lib/assetify/asset.rb +45 -11
- data/lib/assetify/asset/pathfix.rb +41 -0
- data/lib/assetify/{pkg.rb → asset/pkg.rb} +0 -0
- data/lib/assetify/dsl.rb +44 -12
- data/lib/assetify/extensions/string.rb +17 -0
- data/lib/assetify/gui/server.rb +25 -0
- data/lib/assetify/gui/views/home.html.erb +82 -0
- data/lib/assetify/helpers.rb +0 -17
- data/lib/assetify/{colored.rb → tui/colored.rb} +0 -0
- data/lib/assetify/{tui.rb → tui/term.rb} +0 -0
- data/spec/assetify/dsl_spec.rb +30 -0
- data/spec/assetify/path_spec.rb +24 -0
- data/spec/assetify/pkg_spec.rb +4 -0
- data/spec/fixtures/sassify.css +12 -0
- metadata +15 -8
data/Gemfile.lock
CHANGED
@@ -2,10 +2,10 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
addressable (2.2.6)
|
5
|
-
crack (0.1
|
6
|
-
diff-lcs (1.1.
|
5
|
+
crack (0.3.1)
|
6
|
+
diff-lcs (1.1.3)
|
7
7
|
git (1.2.5)
|
8
|
-
jeweler (1.6.
|
8
|
+
jeweler (1.6.4)
|
9
9
|
bundler (~> 1.0)
|
10
10
|
git (>= 1.2.5)
|
11
11
|
rake
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
rspec-expectations (2.6.0)
|
19
19
|
diff-lcs (~> 1.1.2)
|
20
20
|
rspec-mocks (2.6.0)
|
21
|
-
webmock (1.6
|
21
|
+
webmock (1.7.6)
|
22
22
|
addressable (~> 2.2, > 2.2.5)
|
23
23
|
crack (>= 0.1.7)
|
24
24
|
|
data/README.md
CHANGED
@@ -18,18 +18,18 @@ On any project`s root:
|
|
18
18
|
assetify
|
19
19
|
|
20
20
|
|
21
|
-
This will create a Jsfile if not found.
|
21
|
+
This will create a `Jsfile` if not found.
|
22
22
|
|
23
23
|
|
24
24
|
Jsfile
|
25
25
|
======
|
26
26
|
|
27
|
-
|
27
|
+
Like a `Gemfile`, but you choose the filetype (or extension) before:
|
28
28
|
|
29
29
|
type "name", "url", <"version"> or <:options>
|
30
30
|
|
31
31
|
js "jquery", "http://code.jquery.com/jquery-{VERSION}.min.js", "1.6"
|
32
|
-
js "tipsy",
|
32
|
+
js "tipsy", "https://github.com/jaz303/tipsy/.../jquery.tipsy.js"
|
33
33
|
|
34
34
|
Stylesheets:
|
35
35
|
|
@@ -46,11 +46,11 @@ Now just run `assetify` to make sure everything is installed/up-to-date.
|
|
46
46
|
Groups
|
47
47
|
------
|
48
48
|
|
49
|
-
|
50
|
-
in handy:
|
49
|
+
Use groups/namespaces to group related assets together:
|
51
50
|
|
52
51
|
group "forms" do
|
53
|
-
js "validator",
|
52
|
+
js "validator", url
|
53
|
+
js "textmask", url
|
54
54
|
end
|
55
55
|
|
56
56
|
|
@@ -59,9 +59,9 @@ This will install as "vendor/assets/javascripts/forms/validator.js"
|
|
59
59
|
You can nest groups too:
|
60
60
|
|
61
61
|
group "forms" do
|
62
|
-
js "validator",
|
62
|
+
js "validator", url
|
63
63
|
group "extra" do
|
64
|
-
js "another",
|
64
|
+
js "another", url
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -116,6 +116,25 @@ that returns the *first match* inside the archive. Check out libarchive
|
|
116
116
|
or the pkg.rb source for more info.
|
117
117
|
|
118
118
|
|
119
|
+
Global 'a'
|
120
|
+
----------
|
121
|
+
|
122
|
+
If the link contains the file extension, say: 'fu.com/lib.js'
|
123
|
+
You can use just 'a' to specify each asset:
|
124
|
+
|
125
|
+
|
126
|
+
a "tipsy", "http://...tipsy.js"
|
127
|
+
a "tipsy", "http://...tipsy.css"
|
128
|
+
a "video", "http://...video.mpeg"
|
129
|
+
|
130
|
+
|
131
|
+
Versions
|
132
|
+
--------
|
133
|
+
|
134
|
+
Assetify first recognizes the file as text or binary.
|
135
|
+
If the file is human readable, try a X.X.Xxx pattern match
|
136
|
+
that if found, is used, otherwise use md5sum.
|
137
|
+
|
119
138
|
|
120
139
|
Other
|
121
140
|
-----
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0.rc1
|
data/assetify.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{assetify}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "1.0.0.rc1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marcos Piccinini"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-09-30}
|
13
13
|
s.default_executable = %q{assetify}
|
14
14
|
s.description = %q{Downloads/updates assets based on a Jsfile. Any framework.}
|
15
15
|
s.email = %q{x@nofxx.com}
|
@@ -30,18 +30,24 @@ Gem::Specification.new do |s|
|
|
30
30
|
"bin/assetify",
|
31
31
|
"lib/assetify.rb",
|
32
32
|
"lib/assetify/asset.rb",
|
33
|
-
"lib/assetify/
|
33
|
+
"lib/assetify/asset/pathfix.rb",
|
34
|
+
"lib/assetify/asset/pkg.rb",
|
34
35
|
"lib/assetify/dsl.rb",
|
36
|
+
"lib/assetify/extensions/string.rb",
|
37
|
+
"lib/assetify/gui/server.rb",
|
38
|
+
"lib/assetify/gui/views/home.html.erb",
|
35
39
|
"lib/assetify/helpers.rb",
|
36
|
-
"lib/assetify/
|
37
|
-
"lib/assetify/tui.rb",
|
40
|
+
"lib/assetify/tui/colored.rb",
|
41
|
+
"lib/assetify/tui/term.rb",
|
38
42
|
"spec/assetify/asset_spec.rb",
|
39
43
|
"spec/assetify/dsl_spec.rb",
|
40
44
|
"spec/assetify/helpers_spec.rb",
|
45
|
+
"spec/assetify/path_spec.rb",
|
41
46
|
"spec/assetify/pkg_spec.rb",
|
42
47
|
"spec/assetify_spec.rb",
|
43
48
|
"spec/fixtures/complex.tgz",
|
44
49
|
"spec/fixtures/fancy.tgz",
|
50
|
+
"spec/fixtures/sassify.css",
|
45
51
|
"spec/spec_helper.rb"
|
46
52
|
]
|
47
53
|
s.homepage = %q{http://github.com/nofxx/assetify}
|
data/bin/assetify
CHANGED
data/lib/assetify.rb
CHANGED
@@ -18,13 +18,17 @@ module Assetify
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
# Ruby Extensions
|
22
|
+
require "assetify/extensions/string"
|
23
|
+
|
24
|
+
# Text Interface
|
25
|
+
require "assetify/tui/term"
|
26
|
+
require "assetify/tui/colored"
|
27
|
+
|
28
|
+
# Core
|
22
29
|
require "assetify/helpers"
|
23
30
|
require "assetify/asset"
|
24
|
-
require "assetify/path"
|
25
31
|
require "assetify/dsl"
|
26
|
-
require "assetify/pkg"
|
27
|
-
|
28
32
|
|
29
33
|
module Assetify
|
30
34
|
class << self
|
@@ -63,7 +67,7 @@ TXT
|
|
63
67
|
def read_jsfile
|
64
68
|
file = File.open("Jsfile") # ruby 1.8/1.9 (ugly) fix
|
65
69
|
code = file.send(file.respond_to?(:lines) ? :lines : :readlines).map do |line|
|
66
|
-
|
70
|
+
# Parse options
|
67
71
|
if line =~ /^\w{2,3}path/
|
68
72
|
key, val = line.split(" ")
|
69
73
|
Opt[key.to_sym] = val
|
@@ -71,7 +75,7 @@ TXT
|
|
71
75
|
end
|
72
76
|
line
|
73
77
|
end.reject(&:nil?)
|
74
|
-
DSL.parse code.join("
|
78
|
+
DSL.parse code.join("")
|
75
79
|
end
|
76
80
|
|
77
81
|
#
|
@@ -99,6 +103,12 @@ TXT
|
|
99
103
|
when /^u/
|
100
104
|
check_param params, "update"
|
101
105
|
find_assets(params[1]).map { |a| a.install! :force }
|
106
|
+
when /^c/
|
107
|
+
check_param params, "check"
|
108
|
+
find_assets(params[1]).map { |a| a.check! }
|
109
|
+
when /^w/
|
110
|
+
check_param params, "web"
|
111
|
+
gui!
|
102
112
|
else
|
103
113
|
puts "Dunno how to #{params.join}."
|
104
114
|
end
|
@@ -108,13 +118,17 @@ TXT
|
|
108
118
|
puts "-" * TSIZE
|
109
119
|
end
|
110
120
|
|
121
|
+
def gui!
|
122
|
+
require "assetify/gui/server"
|
123
|
+
Sinatra::Application.run!
|
124
|
+
end
|
111
125
|
|
112
126
|
def work!(params)
|
113
127
|
start = Time.now
|
114
128
|
puts "Assetify"
|
115
129
|
bar
|
116
130
|
find_jsfile
|
117
|
-
@assets = read_jsfile
|
131
|
+
Asset.set_all @assets = read_jsfile
|
118
132
|
work_on params
|
119
133
|
bar
|
120
134
|
puts "Done in #{Time.now - start}s"
|
data/lib/assetify/asset.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "net/http"
|
2
|
+
require "fileutils"
|
3
|
+
require "assetify/asset/pkg"
|
4
|
+
require "assetify/asset/pathfix"
|
3
5
|
|
4
6
|
module Assetify
|
7
|
+
|
5
8
|
class Asset
|
6
9
|
include Helpers
|
7
|
-
attr_accessor :type, :name, :url, :ns, :pkg, :ver
|
8
|
-
alias :ext :type
|
10
|
+
attr_accessor :type, :name, :url, :ns, :pkg, :ver, :ext
|
9
11
|
|
10
12
|
def initialize(type, name, url, ver = nil, params={})
|
11
13
|
raise "NoType" unless type
|
@@ -13,16 +15,20 @@ module Assetify
|
|
13
15
|
raise "NoURL" unless url
|
14
16
|
@type, @name = type, name.to_s
|
15
17
|
@url = (@ver = ver) ? url.gsub(/{VERSION}/, @ver) : url
|
18
|
+
if @name =~ /\./
|
19
|
+
@name, @ext = name.split(".")
|
20
|
+
else
|
21
|
+
@ext = @type == :img ? find_ext_for(url) : @type
|
22
|
+
end
|
23
|
+
|
24
|
+
@pkg = params[:pkg]
|
16
25
|
@ns = params[:ns] || ""
|
17
26
|
@to = params[:to] || ""
|
18
|
-
@pkg = params[:pkg]
|
19
27
|
end
|
20
28
|
|
21
29
|
def filename
|
22
30
|
return @filename if @filename
|
23
|
-
@filename =
|
24
|
-
@filename += ".#{type}" unless @filename =~ /\.\w{1,6}$/
|
25
|
-
@filename
|
31
|
+
@filename = "#{name}.#{ext}"
|
26
32
|
end
|
27
33
|
|
28
34
|
def find_path_for txt
|
@@ -33,6 +39,10 @@ module Assetify
|
|
33
39
|
end
|
34
40
|
end
|
35
41
|
|
42
|
+
def find_ext_for file
|
43
|
+
file.split(".").last[0,3]
|
44
|
+
end
|
45
|
+
|
36
46
|
def path
|
37
47
|
args = if @to.empty?
|
38
48
|
tpath = Opt[find_path_for(type)]
|
@@ -48,7 +58,7 @@ module Assetify
|
|
48
58
|
@fullpath ||= File.join(path, filename)
|
49
59
|
end
|
50
60
|
|
51
|
-
def
|
61
|
+
def file_exists?
|
52
62
|
File.exists? fullpath
|
53
63
|
end
|
54
64
|
|
@@ -68,9 +78,23 @@ module Assetify
|
|
68
78
|
@ver ||= find_version(@data)
|
69
79
|
end
|
70
80
|
|
71
|
-
def
|
81
|
+
def header
|
72
82
|
LINE.p "-> #{name}.#{type}"
|
73
|
-
|
83
|
+
end
|
84
|
+
|
85
|
+
def check!
|
86
|
+
header
|
87
|
+
if file_exists? # Return if file is on path
|
88
|
+
@data = File.read(fullpath)
|
89
|
+
LINE.f "#{print_version}Installed"
|
90
|
+
else
|
91
|
+
LINE.f "Not Found", :red
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def install!(force = false)
|
96
|
+
header
|
97
|
+
if !force && file_exists? # Return if file is on path
|
74
98
|
@data = File.read(fullpath)
|
75
99
|
return LINE.f "#{print_version}Installed"
|
76
100
|
end
|
@@ -89,6 +113,16 @@ module Assetify
|
|
89
113
|
|
90
114
|
end
|
91
115
|
|
116
|
+
class << self
|
117
|
+
# Simple cache for Jsfile
|
118
|
+
def self.set_all v
|
119
|
+
@all = v
|
120
|
+
end
|
121
|
+
def self.all
|
122
|
+
@all
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
92
126
|
end
|
93
127
|
|
94
128
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Path
|
2
|
+
class Findr
|
3
|
+
|
4
|
+
def initialize chunk, ns = nil
|
5
|
+
@chunk = chunk
|
6
|
+
@ns = ns
|
7
|
+
matches
|
8
|
+
end
|
9
|
+
|
10
|
+
def sass?
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def replace src
|
15
|
+
if sass?
|
16
|
+
"image-url('#{@ns}#{src}')"
|
17
|
+
else
|
18
|
+
"url('<%= image_path(#{@ns}#{src}) %>)"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def matches
|
23
|
+
@images = @chunk.scan(/url\((.*)\)/).flatten
|
24
|
+
end
|
25
|
+
|
26
|
+
def images
|
27
|
+
@images
|
28
|
+
end
|
29
|
+
|
30
|
+
def fixed
|
31
|
+
sprocketized = @chunk
|
32
|
+
@images.each do |uri|
|
33
|
+
sprocketized["url(#{uri})"] = replace uri.split("/").last
|
34
|
+
#gsub(/\.|\//, "")
|
35
|
+
end
|
36
|
+
sprocketized
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
File without changes
|
data/lib/assetify/dsl.rb
CHANGED
@@ -3,10 +3,13 @@ module Assetify
|
|
3
3
|
class DSL
|
4
4
|
attr_reader :assets
|
5
5
|
|
6
|
-
def set_namespace(name)
|
7
|
-
@ns = @ns.nil? ? name : "#{@ns}/#{name}"
|
8
|
-
end
|
9
6
|
|
7
|
+
#
|
8
|
+
# Makes a pkg, a gz/tar/zip asset/
|
9
|
+
#
|
10
|
+
# pkg :foo, "http://to.tgz" do
|
11
|
+
# end
|
12
|
+
#
|
10
13
|
def pkg name, url, opts = {}, &block
|
11
14
|
@pkg = Pkg.new name, url
|
12
15
|
if block_given?
|
@@ -19,6 +22,13 @@ module Assetify
|
|
19
22
|
assets
|
20
23
|
end
|
21
24
|
|
25
|
+
|
26
|
+
#
|
27
|
+
# Makes a group, a namspace for the assets.
|
28
|
+
#
|
29
|
+
# group :foo do
|
30
|
+
# end
|
31
|
+
#
|
22
32
|
def group name, &block
|
23
33
|
set_namespace name
|
24
34
|
instance_exec &block
|
@@ -40,13 +50,9 @@ module Assetify
|
|
40
50
|
end
|
41
51
|
end
|
42
52
|
|
43
|
-
# Create assets path setters
|
44
|
-
Assetify::ASSETS.each do |asset|
|
45
|
-
define_method asset do |path|
|
46
|
-
Opt[asset] = path
|
47
|
-
end
|
48
|
-
end
|
49
53
|
|
54
|
+
#
|
55
|
+
# Parse the assets.
|
50
56
|
#
|
51
57
|
# js "foo", "http://foo.com"
|
52
58
|
# js "foo", "http://foo.com", :to => "/other/place"
|
@@ -59,12 +65,38 @@ module Assetify
|
|
59
65
|
(@assets ||= []) << Asset.new(method.to_sym, name, uri, ver, opts)
|
60
66
|
end
|
61
67
|
|
62
|
-
|
68
|
+
#
|
69
|
+
# Global command, detects the filetype
|
70
|
+
#
|
71
|
+
# a "jquery", "http://...jquery.js"
|
72
|
+
#
|
73
|
+
def a name, url, *params
|
74
|
+
ext, *rest = url.split(".").reverse
|
75
|
+
send(ext, name, url)
|
76
|
+
end
|
63
77
|
|
64
|
-
|
65
|
-
|
78
|
+
|
79
|
+
# Create Jsfile assets path setters
|
80
|
+
#
|
81
|
+
# javascript "new/path"
|
82
|
+
# ...
|
83
|
+
Assetify::ASSETS.each do |asset|
|
84
|
+
define_method asset do |path|
|
85
|
+
Opt[asset] = path
|
66
86
|
end
|
87
|
+
end
|
67
88
|
|
89
|
+
def set_namespace name
|
90
|
+
@ns = @ns.nil? ? name : "#{@ns}/#{name}"
|
91
|
+
end
|
92
|
+
|
93
|
+
#
|
94
|
+
# DSL.parse()
|
95
|
+
#
|
96
|
+
def self.parse chunk
|
97
|
+
# puts "Assetify - Error Parsing 'Jsfile'."
|
98
|
+
# Instance eval with 2nd, 3rd args to the rescue
|
99
|
+
new.instance_eval(chunk, "Jsfile", 1)
|
68
100
|
end
|
69
101
|
|
70
102
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class String
|
2
|
+
|
3
|
+
#
|
4
|
+
# Adapted ptools - http://rdoc.info/gems/ptools/1.2.1/File.binary%3F
|
5
|
+
#
|
6
|
+
def binary?
|
7
|
+
#s = (File.read(file, File.stat(file).blksize) || "").split(//)
|
8
|
+
s = (self[0..4096].force_encoding("binary") || "") #.split(//)
|
9
|
+
ratio = s.gsub(/\d|\w|\s|[-~\.]/,'').size / s.size.to_f
|
10
|
+
# if Opt[:debug]
|
11
|
+
# print "Detecting #{s}"
|
12
|
+
# puts "Ratio #{ratio}"
|
13
|
+
# end
|
14
|
+
ratio > 0.3
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require 'erb'
|
3
|
+
|
4
|
+
get '/' do
|
5
|
+
@assets = Asset.all
|
6
|
+
erb :"home.html"
|
7
|
+
end
|
8
|
+
|
9
|
+
get '/new' do
|
10
|
+
headers = {} #"Allow" => "BREW, POST, GET, PROPFIND, WHEN", "Refresh" => "Refresh: 20; http://www.ietf.org/rfc/rfc2324.txt"
|
11
|
+
body "T#{Time.now.to_i}"
|
12
|
+
end
|
13
|
+
|
14
|
+
post '/edit' do
|
15
|
+
puts params
|
16
|
+
|
17
|
+
body "OK"
|
18
|
+
end
|
19
|
+
|
20
|
+
get '/i' do
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
get '/u' do
|
25
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6
|
+
<title>Assetify</title>
|
7
|
+
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css" />
|
8
|
+
<script src="http://code.jquery.com/jquery-1.6.3.min.js"></script>
|
9
|
+
<script src="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.js"></script>
|
10
|
+
</head>
|
11
|
+
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<!-- HOME -->
|
15
|
+
<div data-role="page" id="foo">
|
16
|
+
|
17
|
+
<div data-role="header">
|
18
|
+
<h1>Assets</h1>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div data-role="content" id="one">
|
22
|
+
<ul data-role="listview" data-theme="g">
|
23
|
+
<h2>Jsfile</h2>
|
24
|
+
<% for asset in @assets %>
|
25
|
+
<li> asset </li>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<p>Test</p>
|
29
|
+
|
30
|
+
<h3>Asset store:</h3>
|
31
|
+
<p><a href="#two" data-role="button">Show page "two"</a></p>
|
32
|
+
<p><a href="#popup"data-role="button" data-rel="dialog" data-transition="pop">Show page "popup" (as a dialog)</a></p>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
|
36
|
+
<div data-role="footer" data-theme="d">
|
37
|
+
<h4>Assetify</h4>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
|
42
|
+
<!-- NEW -->
|
43
|
+
<div data-role="page" id="two" data-theme="a">
|
44
|
+
|
45
|
+
<div data-role="header">
|
46
|
+
<h1>Two</h1>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div data-role="content" data-theme="a">
|
50
|
+
<h2>Two</h2>
|
51
|
+
<p><a href="#one" data-direction="reverse" data-role="button" data-theme="b">Back to page "one"</a></p>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
|
55
|
+
<div data-role="footer">
|
56
|
+
<h4>Page Footer</h4>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
|
61
|
+
<!-- EDIT -->
|
62
|
+
<div data-role="page" id="popup">
|
63
|
+
|
64
|
+
<div data-role="header" data-theme="e">
|
65
|
+
<h1>Dialog</h1>
|
66
|
+
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<div data-role="content" data-theme="d">
|
70
|
+
<h2>Popup</h2>
|
71
|
+
<p>I have an id of "popup" on my page container and only look like a dialog because the link to me had a <code>data-rel="dialog"</code> attribute which gives</p>
|
72
|
+
<p><a href="#one" data-rel="back" data-role="button" data-inline="true" data-icon="back">Back to page "one"</a></p>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
<div data-role="footer">
|
77
|
+
<h4>Page Footer</h4>
|
78
|
+
</div><!-- /footer -->
|
79
|
+
</div><!-- /page popup -->
|
80
|
+
|
81
|
+
</body>
|
82
|
+
</html>
|
data/lib/assetify/helpers.rb
CHANGED
@@ -1,22 +1,5 @@
|
|
1
|
-
# require 'pry'
|
2
1
|
require 'digest/md5'
|
3
2
|
|
4
|
-
class String
|
5
|
-
#
|
6
|
-
# From ptools - http://rdoc.info/gems/ptools/1.2.1/File.binary%3F
|
7
|
-
#
|
8
|
-
def binary?
|
9
|
-
#s = (File.read(file, File.stat(file).blksize) || "").split(//)
|
10
|
-
s = (self[0..4096].force_encoding("binary") || "") #.split(//)
|
11
|
-
ratio = s.gsub(/\d|\w|\s|[-~\.]/,'').size / s.size.to_f
|
12
|
-
# if Opt[:debug]
|
13
|
-
# print "Detecting #{s}"
|
14
|
-
# puts "Ratio #{ratio}"
|
15
|
-
# end
|
16
|
-
ratio > 0.3
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
3
|
module Assetify
|
21
4
|
module Helpers
|
22
5
|
|
File without changes
|
File without changes
|
data/spec/assetify/dsl_spec.rb
CHANGED
@@ -20,6 +20,36 @@ describe DSL do
|
|
20
20
|
a.fullpath.should eql("vendor/assets/images/foo.gif")
|
21
21
|
end
|
22
22
|
|
23
|
+
it "should parse img nicely from link (gif)" do
|
24
|
+
a = Assetify::DSL.parse("img 'foo', 'foolink.gif'")[0]
|
25
|
+
a.should be_an Asset
|
26
|
+
a.fullpath.should eql("vendor/assets/images/foo.gif")
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should parse img nicely from link (png)" do
|
30
|
+
a = Assetify::DSL.parse("img 'foo', 'foolink-ra.png'")[0]
|
31
|
+
a.should be_an Asset
|
32
|
+
a.fullpath.should eql("vendor/assets/images/foo.png")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should parse js with global 'a' keyword" do
|
36
|
+
a = Assetify::DSL.parse("a 'foo', 'foolink.js'")[0]
|
37
|
+
a.should be_an Asset
|
38
|
+
a.fullpath.should eql("vendor/assets/javascripts/foo.js")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should parse css with global 'a' keyword" do
|
42
|
+
a = Assetify::DSL.parse("a 'foo', 'http://w.foolink/c/?foo.css'")[0]
|
43
|
+
a.should be_an Asset
|
44
|
+
a.fullpath.should eql("vendor/assets/stylesheets/foo.css")
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should parse img with global 'a' keyword" do
|
48
|
+
a = Assetify::DSL.parse("a 'foo.gif', 'foolink.gif'")[0]
|
49
|
+
a.should be_an Asset
|
50
|
+
a.fullpath.should eql("vendor/assets/images/foo.gif")
|
51
|
+
end
|
52
|
+
|
23
53
|
it "should accept a especific location with :to" do
|
24
54
|
Dir.should_receive(:pwd).and_return("/home/nofxx/git/assetify")
|
25
55
|
a = Assetify::DSL.parse("rb 'foo', 'foolink', :to => 'spec/rock'")[0]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe Path do
|
4
|
+
|
5
|
+
it "should spawn!" do
|
6
|
+
f = Path::Findr.new "fu"
|
7
|
+
f.should be_instance_of Path::Findr
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "Instantiated" do
|
11
|
+
|
12
|
+
let (:f) { Path::Findr.new ".tipsy { padding: 5px; background-image: url(../images/tipsy.gif); }" }
|
13
|
+
|
14
|
+
it "should detect images" do
|
15
|
+
f.images.should eql(["../images/tipsy.gif"])
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should change css" do
|
19
|
+
f.fixed.should eql ".tipsy { padding: 5px; background-image: url(../images/tipsy.gif); }"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/spec/assetify/pkg_spec.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
/* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
|
2
|
+
div.rating-cancel,div.star-rating{float:left;width:17px;height:15px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
|
3
|
+
div.rating-cancel,div.rating-cancel a{background:url(delete.gif) no-repeat 0 -16px}
|
4
|
+
div.star-rating,div.star-rating a{background:url(star.gif) no-repeat 0 0px}
|
5
|
+
div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 0px;border:0}
|
6
|
+
div.star-rating-on a{background-position:0 -16px!important}
|
7
|
+
div.star-rating-hover a{background-position:0 -32px}
|
8
|
+
/* Read Only CSS */
|
9
|
+
div.star-rating-readonly a{cursor:default !important}
|
10
|
+
/* Partial Star CSS */
|
11
|
+
div.star-rating{background:transparent!important;overflow:hidden!important}
|
12
|
+
/* END jQuery.Rating Plugin CSS */
|
metadata
CHANGED
@@ -3,11 +3,12 @@ name: assetify
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: true
|
5
5
|
segments:
|
6
|
+
- 1
|
6
7
|
- 0
|
7
|
-
- 7
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
9
|
+
- rc
|
10
|
+
- 1
|
11
|
+
version: 1.0.0.rc1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Marcos Piccinini
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-
|
19
|
+
date: 2011-09-30 00:00:00 -03:00
|
19
20
|
default_executable: assetify
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
@@ -95,18 +96,24 @@ files:
|
|
95
96
|
- bin/assetify
|
96
97
|
- lib/assetify.rb
|
97
98
|
- lib/assetify/asset.rb
|
98
|
-
- lib/assetify/
|
99
|
+
- lib/assetify/asset/pathfix.rb
|
100
|
+
- lib/assetify/asset/pkg.rb
|
99
101
|
- lib/assetify/dsl.rb
|
102
|
+
- lib/assetify/extensions/string.rb
|
103
|
+
- lib/assetify/gui/server.rb
|
104
|
+
- lib/assetify/gui/views/home.html.erb
|
100
105
|
- lib/assetify/helpers.rb
|
101
|
-
- lib/assetify/
|
102
|
-
- lib/assetify/tui.rb
|
106
|
+
- lib/assetify/tui/colored.rb
|
107
|
+
- lib/assetify/tui/term.rb
|
103
108
|
- spec/assetify/asset_spec.rb
|
104
109
|
- spec/assetify/dsl_spec.rb
|
105
110
|
- spec/assetify/helpers_spec.rb
|
111
|
+
- spec/assetify/path_spec.rb
|
106
112
|
- spec/assetify/pkg_spec.rb
|
107
113
|
- spec/assetify_spec.rb
|
108
114
|
- spec/fixtures/complex.tgz
|
109
115
|
- spec/fixtures/fancy.tgz
|
116
|
+
- spec/fixtures/sassify.css
|
110
117
|
- spec/spec_helper.rb
|
111
118
|
has_rdoc: true
|
112
119
|
homepage: http://github.com/nofxx/assetify
|
@@ -122,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
122
129
|
requirements:
|
123
130
|
- - ">="
|
124
131
|
- !ruby/object:Gem::Version
|
125
|
-
hash: -
|
132
|
+
hash: -4058179870759459477
|
126
133
|
segments:
|
127
134
|
- 0
|
128
135
|
version: "0"
|