assetify 0.4.0 → 0.7.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +15 -5
- data/VERSION +1 -1
- data/assetify.gemspec +3 -3
- data/bin/assetify +1 -1
- data/lib/assetify.rb +19 -14
- data/lib/assetify/asset.rb +9 -1
- data/lib/assetify/dsl.rb +7 -0
- data/spec/assetify/asset_spec.rb +1 -1
- data/spec/assetify/dsl_spec.rb +22 -10
- data/spec/assetify/pkg_spec.rb +1 -1
- data/spec/assetify_spec.rb +2 -2
- metadata +11 -8
data/README.md
CHANGED
@@ -54,7 +54,7 @@ in handy:
|
|
54
54
|
end
|
55
55
|
|
56
56
|
|
57
|
-
This will install as "
|
57
|
+
This will install as "vendor/assets/javascripts/forms/validator.js"
|
58
58
|
|
59
59
|
You can nest groups too:
|
60
60
|
|
@@ -93,6 +93,7 @@ Results in:
|
|
93
93
|
Also, please check out the note about link inside pkgs below.
|
94
94
|
|
95
95
|
|
96
|
+
|
96
97
|
Dir
|
97
98
|
___
|
98
99
|
|
@@ -114,6 +115,8 @@ Note: Have in mind that the "link" inside dir/packages *is a regex*
|
|
114
115
|
that returns the *first match* inside the archive. Check out libarchive
|
115
116
|
or the pkg.rb source for more info.
|
116
117
|
|
118
|
+
|
119
|
+
|
117
120
|
Other
|
118
121
|
-----
|
119
122
|
|
@@ -132,10 +135,10 @@ Options
|
|
132
135
|
|
133
136
|
Change some default settings:
|
134
137
|
|
135
|
-
newname
|
136
|
-
|
137
|
-
|
138
|
-
|
138
|
+
newname true || false
|
139
|
+
javascripts "public/javascripts"
|
140
|
+
stylesheets "public/stylesheets"
|
141
|
+
images "public/images"
|
139
142
|
|
140
143
|
If newname is set to true (default) the file will be renamed. Ex:
|
141
144
|
|
@@ -145,6 +148,13 @@ Filename will be: "validator.js"
|
|
145
148
|
|
146
149
|
|
147
150
|
|
151
|
+
Rails
|
152
|
+
-----
|
153
|
+
|
154
|
+
Out of the box support for rails 3.1, defaults to 'vendor/assets'.
|
155
|
+
Rails 3.0< users should change the options as above.
|
156
|
+
|
157
|
+
|
148
158
|
|
149
159
|
Contributing
|
150
160
|
------------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.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 = "0.7.0.rc1"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
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-07-14}
|
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}
|
data/bin/assetify
CHANGED
data/lib/assetify.rb
CHANGED
@@ -1,28 +1,32 @@
|
|
1
|
-
require "assetify/colored"
|
2
|
-
require "assetify/helpers"
|
3
|
-
require "assetify/asset"
|
4
1
|
require "assetify/tui"
|
5
|
-
require "assetify/dsl"
|
6
|
-
require "assetify/pkg"
|
7
|
-
|
8
2
|
module Assetify
|
9
3
|
|
4
|
+
Opt = {
|
5
|
+
:vendor => "public/vendor",
|
6
|
+
:newname => true
|
7
|
+
}
|
8
|
+
|
10
9
|
TSIZE = 80
|
11
|
-
LINE
|
10
|
+
LINE = TUI.new
|
11
|
+
ASSETS_PATH = "vendor/assets"
|
12
12
|
ASSETS = [:javascripts, :stylesheets, :images]
|
13
|
+
ASSETS.each do |asset|
|
14
|
+
Opt.merge!(asset => "#{ASSETS_PATH}/#{asset}")
|
15
|
+
end
|
13
16
|
|
14
17
|
class NoJSFile < StandardError
|
15
18
|
end
|
19
|
+
end
|
16
20
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
}
|
21
|
+
require "assetify/colored"
|
22
|
+
require "assetify/helpers"
|
23
|
+
require "assetify/asset"
|
24
|
+
require "assetify/path"
|
25
|
+
require "assetify/dsl"
|
26
|
+
require "assetify/pkg"
|
24
27
|
|
25
28
|
|
29
|
+
module Assetify
|
26
30
|
class << self
|
27
31
|
|
28
32
|
#
|
@@ -104,6 +108,7 @@ TXT
|
|
104
108
|
puts "-" * TSIZE
|
105
109
|
end
|
106
110
|
|
111
|
+
|
107
112
|
def work!(params)
|
108
113
|
start = Time.now
|
109
114
|
puts "Assetify"
|
data/lib/assetify/asset.rb
CHANGED
@@ -25,9 +25,17 @@ module Assetify
|
|
25
25
|
@filename
|
26
26
|
end
|
27
27
|
|
28
|
+
def find_path_for txt
|
29
|
+
case txt
|
30
|
+
when /js/ then :javascripts
|
31
|
+
when /css|style/ then :stylesheets
|
32
|
+
else :images
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
28
36
|
def path
|
29
37
|
args = if @to.empty?
|
30
|
-
tpath = Opt[
|
38
|
+
tpath = Opt[find_path_for(type)]
|
31
39
|
raise "Don`t know where to put #{type} files..." unless tpath
|
32
40
|
[tpath, @ns ? @ns.to_s : ""]
|
33
41
|
else
|
data/lib/assetify/dsl.rb
CHANGED
@@ -40,6 +40,13 @@ module Assetify
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
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
|
+
|
43
50
|
#
|
44
51
|
# js "foo", "http://foo.com"
|
45
52
|
# js "foo", "http://foo.com", :to => "/other/place"
|
data/spec/assetify/asset_spec.rb
CHANGED
data/spec/assetify/dsl_spec.rb
CHANGED
@@ -5,19 +5,19 @@ describe DSL do
|
|
5
5
|
it "should parse js nicely" do
|
6
6
|
a = Assetify::DSL.parse("js 'foo', 'foolink'")[0]
|
7
7
|
a.should be_an Asset
|
8
|
-
a.fullpath.should eql("
|
8
|
+
a.fullpath.should eql("vendor/assets/javascripts/foo.js")
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should parse css nicely" do
|
12
12
|
a = Assetify::DSL.parse("css 'foo', 'foolink'")[0]
|
13
13
|
a.should be_an Asset
|
14
|
-
a.fullpath.should eql("
|
14
|
+
a.fullpath.should eql("vendor/assets/stylesheets/foo.css")
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should parse img nicely (gif)" do
|
18
18
|
a = Assetify::DSL.parse("img 'foo.gif', 'foolink'")[0]
|
19
19
|
a.should be_an Asset
|
20
|
-
a.fullpath.should eql("
|
20
|
+
a.fullpath.should eql("vendor/assets/images/foo.gif")
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should accept a especific location with :to" do
|
@@ -38,25 +38,25 @@ describe DSL do
|
|
38
38
|
it "should group and use a namespace" do
|
39
39
|
a = Assetify::DSL.parse "group 'common' do; js 'foo', 'foolink'; end"
|
40
40
|
a[0].should be_an Asset
|
41
|
-
a[0].fullpath.should eql("
|
41
|
+
a[0].fullpath.should eql("vendor/assets/javascripts/common/foo.js")
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should group and use a namespace 2" do
|
45
45
|
a = Assetify::DSL.parse "group 'common' do; js 'foo', 'foolink'; js 'rock', 'rocklink'; end"
|
46
46
|
a[0].should be_an Asset
|
47
|
-
a[0].fullpath.should eql("
|
47
|
+
a[0].fullpath.should eql("vendor/assets/javascripts/common/foo.js")
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should go back to root" do
|
51
51
|
a = Assetify::DSL.parse "group 'common' do; js 'foo', 'foolink'; end; js 'rock', 'rocklink'"
|
52
52
|
a[1].should be_an Asset
|
53
|
-
a[1].fullpath.should eql("
|
53
|
+
a[1].fullpath.should eql("vendor/assets/javascripts/rock.js")
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should work with nested namespaces" do
|
57
57
|
a = Assetify::DSL.parse "group 'common' do; group 'nice' do; js 'foo', 'foolink'; end; end"
|
58
58
|
a[0].should be_an Asset
|
59
|
-
a[0].fullpath.should eql("
|
59
|
+
a[0].fullpath.should eql("vendor/assets/javascripts/common/nice/foo.js")
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
@@ -66,19 +66,19 @@ describe DSL do
|
|
66
66
|
it "should group and use a namespace" do
|
67
67
|
a = Assetify::DSL.parse "pkg 'fancy', 'http://fancy.zip' do; js 'foo', 'foolink'; end"
|
68
68
|
a[0].should be_an Asset
|
69
|
-
a[0].fullpath.should eql("
|
69
|
+
a[0].fullpath.should eql("vendor/assets/javascripts/fancy/foo.js")
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should accept shallow too" do
|
73
73
|
a = Assetify::DSL.parse "pkg 'fancy', 'http://fancy.zip', :shallow => true do; js 'foo', 'foolink'; end"
|
74
74
|
a[0].should be_an Asset
|
75
|
-
a[0].fullpath.should eql("
|
75
|
+
a[0].fullpath.should eql("vendor/assets/javascripts/foo.js")
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should fetch inside archive" do
|
79
79
|
a = Assetify::DSL.parse "pkg 'fancy', 'http://fancy.zip' do; js 'foo', 'foolink'; end"
|
80
80
|
a[0].should be_an Asset
|
81
|
-
a[0].fullpath.should eql("
|
81
|
+
a[0].fullpath.should eql("vendor/assets/javascripts/fancy/foo.js")
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should unpack to vendor if no block given" do
|
@@ -103,7 +103,19 @@ describe DSL do
|
|
103
103
|
as[0].fullpath.should eql("/home/nofxx/git/assetify/images/complex/two.png")
|
104
104
|
end
|
105
105
|
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "Paths" do
|
106
109
|
|
110
|
+
it "should change js path" do
|
111
|
+
Assetify::DSL.parse "javascripts 'other/foo'"
|
112
|
+
Opt[:javascripts].should eql('other/foo')
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should change css path" do
|
116
|
+
Assetify::DSL.parse "stylesheets 'other/foo'"
|
117
|
+
Opt[:javascripts].should eql('other/foo')
|
118
|
+
end
|
107
119
|
end
|
108
120
|
|
109
121
|
end
|
data/spec/assetify/pkg_spec.rb
CHANGED
@@ -35,7 +35,7 @@ describe Pkg do
|
|
35
35
|
as = Pkg.new "complex", "/tmp/complex/complex.tgz"
|
36
36
|
as.unpack_to_vendor #.should be_a Hash #(hash_including "complex/images/3.png"=>"Im a png image..3\n")
|
37
37
|
File.exists?("public/vendor/complex/src/main.js").should be_true
|
38
|
-
`rm -rf
|
38
|
+
`rm -rf vendor/assets/vendor`
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
data/spec/assetify_spec.rb
CHANGED
@@ -32,7 +32,7 @@ describe Assetify do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should have fullpath" do
|
35
|
-
asset.fullpath.should eql("
|
35
|
+
asset.fullpath.should eql("vendor/assets/stylesheets/grid.css")
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
@@ -58,7 +58,7 @@ describe Assetify do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should have fullpath" do
|
61
|
-
asset.fullpath.should eql("
|
61
|
+
asset.fullpath.should eql("vendor/assets/javascripts/cool.js")
|
62
62
|
end
|
63
63
|
|
64
64
|
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assetify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: true
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 7
|
8
8
|
- 0
|
9
|
-
|
9
|
+
- rc1
|
10
|
+
version: 0.7.0.rc1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Marcos Piccinini
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-
|
18
|
+
date: 2011-07-14 00:00:00 -03:00
|
18
19
|
default_executable: assetify
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
@@ -121,18 +122,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
122
|
requirements:
|
122
123
|
- - ">="
|
123
124
|
- !ruby/object:Gem::Version
|
124
|
-
hash: -
|
125
|
+
hash: -1037575616706131439
|
125
126
|
segments:
|
126
127
|
- 0
|
127
128
|
version: "0"
|
128
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
130
|
none: false
|
130
131
|
requirements:
|
131
|
-
- - "
|
132
|
+
- - ">"
|
132
133
|
- !ruby/object:Gem::Version
|
133
134
|
segments:
|
134
|
-
-
|
135
|
-
|
135
|
+
- 1
|
136
|
+
- 3
|
137
|
+
- 1
|
138
|
+
version: 1.3.1
|
136
139
|
requirements: []
|
137
140
|
|
138
141
|
rubyforge_project:
|