assetify 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -1
- data/Gemfile.lock +6 -0
- data/Jsfile +5 -0
- data/README.md +16 -2
- data/VERSION +1 -1
- data/assetify.gemspec +9 -2
- data/lib/assetify.rb +6 -1
- data/lib/assetify/asset.rb +32 -10
- data/lib/assetify/colored.rb +91 -0
- data/lib/assetify/dsl.rb +9 -3
- data/lib/assetify/helpers.rb +41 -9
- data/lib/assetify/pkg.rb +2 -6
- data/lib/assetify/tui.rb +19 -0
- data/spec/assetify/asset_spec.rb +6 -1
- data/spec/assetify/dsl_spec.rb +14 -1
- data/spec/assetify/helpers_spec.rb +28 -0
- data/spec/assetify/pkg_spec.rb +9 -4
- data/spec/spec_helper.rb +4 -0
- metadata +21 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
addressable (2.2.6)
|
5
|
+
crack (0.1.8)
|
4
6
|
diff-lcs (1.1.2)
|
5
7
|
git (1.2.5)
|
6
8
|
jeweler (1.6.0)
|
@@ -16,6 +18,9 @@ GEM
|
|
16
18
|
rspec-expectations (2.5.0)
|
17
19
|
diff-lcs (~> 1.1.2)
|
18
20
|
rspec-mocks (2.5.0)
|
21
|
+
webmock (1.6.4)
|
22
|
+
addressable (~> 2.2, > 2.2.5)
|
23
|
+
crack (>= 0.1.7)
|
19
24
|
|
20
25
|
PLATFORMS
|
21
26
|
ruby
|
@@ -24,3 +29,4 @@ DEPENDENCIES
|
|
24
29
|
bundler (>= 1.0.0)
|
25
30
|
jeweler (>= 1.6.0)
|
26
31
|
rspec (>= 2.3.0)
|
32
|
+
webmock
|
data/Jsfile
ADDED
data/README.md
CHANGED
@@ -26,7 +26,7 @@ Jsfile
|
|
26
26
|
|
27
27
|
Just like a Gemfile, but you choose the filetype before:
|
28
28
|
|
29
|
-
type "name", "url", <version>
|
29
|
+
type "name", "url", <"version"> or <:options>
|
30
30
|
|
31
31
|
js "jquery", "http://code.jquery.com/jquery-{VERSION}.min.js", "1.6"
|
32
32
|
js "tipsy", "https://github.com/jaz303/tipsy/.../jquery.tipsy.js"
|
@@ -62,6 +62,19 @@ This downloads and 'cherry pick' the files.
|
|
62
62
|
|
63
63
|
|
64
64
|
|
65
|
+
Other
|
66
|
+
-----
|
67
|
+
|
68
|
+
Set a different location per file:
|
69
|
+
|
70
|
+
|
71
|
+
js "other", "http://lib.../other.js", :to => "different/path"
|
72
|
+
|
73
|
+
Filename will be: ./different/path/other.js
|
74
|
+
This works for namespaces too, change "to" with "ns".
|
75
|
+
|
76
|
+
|
77
|
+
|
65
78
|
Options
|
66
79
|
-------
|
67
80
|
|
@@ -72,7 +85,6 @@ Change some default settings:
|
|
72
85
|
csspath "public/stylesheets"
|
73
86
|
imgpath "public/images"
|
74
87
|
|
75
|
-
|
76
88
|
If newname is set to true (default) the file will be renamed. Ex:
|
77
89
|
|
78
90
|
js "validator", "http//.../jquery.validator.min.js"
|
@@ -80,6 +92,8 @@ If newname is set to true (default) the file will be renamed. Ex:
|
|
80
92
|
Filename will be: "validator.js"
|
81
93
|
|
82
94
|
|
95
|
+
|
96
|
+
|
83
97
|
Contributing
|
84
98
|
------------
|
85
99
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.1
|
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.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marcos Piccinini"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-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}
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
".rspec",
|
23
23
|
"Gemfile",
|
24
24
|
"Gemfile.lock",
|
25
|
+
"Jsfile",
|
25
26
|
"README.md",
|
26
27
|
"Rakefile",
|
27
28
|
"VERSION",
|
@@ -29,11 +30,14 @@ Gem::Specification.new do |s|
|
|
29
30
|
"bin/assetify",
|
30
31
|
"lib/assetify.rb",
|
31
32
|
"lib/assetify/asset.rb",
|
33
|
+
"lib/assetify/colored.rb",
|
32
34
|
"lib/assetify/dsl.rb",
|
33
35
|
"lib/assetify/helpers.rb",
|
34
36
|
"lib/assetify/pkg.rb",
|
37
|
+
"lib/assetify/tui.rb",
|
35
38
|
"spec/assetify/asset_spec.rb",
|
36
39
|
"spec/assetify/dsl_spec.rb",
|
40
|
+
"spec/assetify/helpers_spec.rb",
|
37
41
|
"spec/assetify/pkg_spec.rb",
|
38
42
|
"spec/assetify_spec.rb",
|
39
43
|
"spec/fixtures/fancy.tgz",
|
@@ -53,15 +57,18 @@ Gem::Specification.new do |s|
|
|
53
57
|
s.add_development_dependency(%q<rspec>, [">= 2.3.0"])
|
54
58
|
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
55
59
|
s.add_development_dependency(%q<jeweler>, [">= 1.6.0"])
|
60
|
+
s.add_development_dependency(%q<webmock>, [">= 0"])
|
56
61
|
else
|
57
62
|
s.add_dependency(%q<rspec>, [">= 2.3.0"])
|
58
63
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
59
64
|
s.add_dependency(%q<jeweler>, [">= 1.6.0"])
|
65
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
60
66
|
end
|
61
67
|
else
|
62
68
|
s.add_dependency(%q<rspec>, [">= 2.3.0"])
|
63
69
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
64
70
|
s.add_dependency(%q<jeweler>, [">= 1.6.0"])
|
71
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
65
72
|
end
|
66
73
|
end
|
67
74
|
|
data/lib/assetify.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
require "assetify/colored"
|
1
2
|
require "assetify/helpers"
|
2
3
|
require "assetify/asset"
|
4
|
+
require "assetify/tui"
|
3
5
|
require "assetify/dsl"
|
4
6
|
require "assetify/pkg"
|
5
7
|
|
@@ -15,6 +17,9 @@ module Assetify
|
|
15
17
|
:newname => true
|
16
18
|
}
|
17
19
|
|
20
|
+
TSIZE = 80
|
21
|
+
LINE = TUI.new
|
22
|
+
|
18
23
|
class << self
|
19
24
|
|
20
25
|
def no_jsfile!
|
@@ -80,7 +85,7 @@ TXT
|
|
80
85
|
end
|
81
86
|
|
82
87
|
def bar
|
83
|
-
puts "-" *
|
88
|
+
puts "-" * TSIZE
|
84
89
|
end
|
85
90
|
|
86
91
|
def work!(params)
|
data/lib/assetify/asset.rb
CHANGED
@@ -11,9 +11,9 @@ module Assetify
|
|
11
11
|
raise "NoName" unless name
|
12
12
|
raise "NoURL" unless url
|
13
13
|
@type, @name = type, name
|
14
|
-
@ver = ver
|
15
|
-
@url = @ver ? url.gsub(/{VERSION}/, @ver) : url
|
14
|
+
@url = (@ver = ver) ? url.gsub(/{VERSION}/, @ver) : url
|
16
15
|
@ns = params[:ns] || ""
|
16
|
+
@to = params[:to] || ""
|
17
17
|
@pkg = params[:pkg]
|
18
18
|
end
|
19
19
|
|
@@ -25,7 +25,14 @@ module Assetify
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def path
|
28
|
-
|
28
|
+
args = if @to.empty?
|
29
|
+
tpath = Opt["#{type}path".to_sym]
|
30
|
+
raise "Don`t know where to put #{type} files..." unless tpath
|
31
|
+
[tpath, @ns ? @ns.to_s : ""]
|
32
|
+
else
|
33
|
+
[Dir.pwd, @to]
|
34
|
+
end
|
35
|
+
@path = File.join(args)
|
29
36
|
end
|
30
37
|
|
31
38
|
def fullpath
|
@@ -36,15 +43,30 @@ module Assetify
|
|
36
43
|
File.exists? fullpath
|
37
44
|
end
|
38
45
|
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
return print_result "Installed" if !force && check?
|
43
|
-
@data ||= @pkg ? @pkg.get(url) : download
|
44
|
-
write
|
45
|
-
print_result :ok
|
46
|
+
def print_version
|
47
|
+
v = find_version(@data)
|
48
|
+
v ? "v#{v[0]} " : nil
|
46
49
|
end
|
47
50
|
|
51
|
+
def install!(force = false)
|
52
|
+
LINE.p "-> #{name}.#{type}"
|
53
|
+
if !force && check?
|
54
|
+
@data = File.read(fullpath)
|
55
|
+
return LINE.f "#{print_version}Installed"
|
56
|
+
end
|
57
|
+
begin
|
58
|
+
points = Thread.new { loop do; LINE.p "."; sleep 1; end }
|
59
|
+
@data ||= @pkg ? @pkg.get(url) : get_data(url)
|
60
|
+
write @data
|
61
|
+
LINE.f "#{print_version}ok"
|
62
|
+
rescue => e
|
63
|
+
LINE.f :FAIL, :red
|
64
|
+
p "Fail: #{e}"
|
65
|
+
ensure
|
66
|
+
points.kill
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
48
70
|
|
49
71
|
end
|
50
72
|
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'Win32/Console/ANSI' if RUBY_PLATFORM =~ /win32/
|
2
|
+
|
3
|
+
##
|
4
|
+
# cute.
|
5
|
+
#
|
6
|
+
# >> "this is red".red
|
7
|
+
#
|
8
|
+
# >> "this is red with a blue background (read: ugly)".red_on_blue
|
9
|
+
#
|
10
|
+
# >> "this is red with an underline".red.underline
|
11
|
+
#
|
12
|
+
# >> "this is really bold and really blue".bold.blue
|
13
|
+
#
|
14
|
+
# >> Colored.red "This is red" # but this part is mostly untested
|
15
|
+
module Colored
|
16
|
+
extend self
|
17
|
+
|
18
|
+
COLORS = {
|
19
|
+
'black' => 30,
|
20
|
+
'red' => 31,
|
21
|
+
'green' => 32,
|
22
|
+
'yellow' => 33,
|
23
|
+
'blue' => 34,
|
24
|
+
'magenta' => 35,
|
25
|
+
'cyan' => 36,
|
26
|
+
'white' => 37
|
27
|
+
}
|
28
|
+
|
29
|
+
EXTRAS = {
|
30
|
+
'clear' => 0,
|
31
|
+
'bold' => 1,
|
32
|
+
'underline' => 4,
|
33
|
+
'reversed' => 7
|
34
|
+
}
|
35
|
+
|
36
|
+
COLORS.each do |color, value|
|
37
|
+
define_method(color) do
|
38
|
+
colorize(self, :foreground => color)
|
39
|
+
end
|
40
|
+
|
41
|
+
define_method("on_#{color}") do
|
42
|
+
colorize(self, :background => color)
|
43
|
+
end
|
44
|
+
|
45
|
+
COLORS.each do |highlight, value|
|
46
|
+
next if color == highlight
|
47
|
+
define_method("#{color}_on_#{highlight}") do
|
48
|
+
colorize(self, :foreground => color, :background => highlight)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
EXTRAS.each do |extra, value|
|
54
|
+
next if extra == 'clear'
|
55
|
+
define_method(extra) do
|
56
|
+
colorize(self, :extra => extra)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
define_method(:to_eol) do
|
61
|
+
tmp = sub(/^(\e\[[\[\e0-9;m]+m)/, "\\1\e[2K")
|
62
|
+
if tmp == self
|
63
|
+
return "\e[2K" << self
|
64
|
+
end
|
65
|
+
tmp
|
66
|
+
end
|
67
|
+
|
68
|
+
def colorize(string, options = {})
|
69
|
+
colored = [color(options[:foreground]), color("on_#{options[:background]}"), extra(options[:extra])].compact * ''
|
70
|
+
colored << string
|
71
|
+
colored << extra(:clear)
|
72
|
+
end
|
73
|
+
|
74
|
+
def colors
|
75
|
+
@@colors ||= COLORS.keys.sort
|
76
|
+
end
|
77
|
+
|
78
|
+
def extra(extra_name)
|
79
|
+
extra_name = extra_name.to_s
|
80
|
+
"\e[#{EXTRAS[extra_name]}m" if EXTRAS[extra_name]
|
81
|
+
end
|
82
|
+
|
83
|
+
def color(color_name)
|
84
|
+
background = color_name.to_s =~ /on_/
|
85
|
+
color_name = color_name.to_s.sub('on_', '')
|
86
|
+
return unless color_name && COLORS[color_name]
|
87
|
+
"\e[#{COLORS[color_name] + (background ? 10 : 0)}m"
|
88
|
+
end
|
89
|
+
end unless Object.const_defined? :Colored
|
90
|
+
|
91
|
+
String.send(:include, Colored)
|
data/lib/assetify/dsl.rb
CHANGED
@@ -4,8 +4,10 @@ module Assetify
|
|
4
4
|
|
5
5
|
def pkg name, url, &block
|
6
6
|
@pkg = Pkg.new name, url
|
7
|
+
@ns = name
|
7
8
|
instance_exec(&block)
|
8
|
-
@
|
9
|
+
@ns = nil
|
10
|
+
assets
|
9
11
|
end
|
10
12
|
|
11
13
|
def group name, &block
|
@@ -19,8 +21,12 @@ module Assetify
|
|
19
21
|
@assets
|
20
22
|
end
|
21
23
|
|
22
|
-
def method_missing method, name, uri,
|
23
|
-
|
24
|
+
def method_missing method, name, uri, *params
|
25
|
+
params, ver = params.partition { |param| param.is_a?(Hash) }
|
26
|
+
opts = {:ns => @ns, :pkg => @pkg}
|
27
|
+
params.each { |hsh| opts.merge! hsh }
|
28
|
+
ver = ver[0]
|
29
|
+
(@assets ||= []) << Asset.new(method.to_sym, name, uri, ver, opts)
|
24
30
|
end
|
25
31
|
|
26
32
|
class << self
|
data/lib/assetify/helpers.rb
CHANGED
@@ -1,24 +1,56 @@
|
|
1
|
+
require 'pry'
|
2
|
+
|
1
3
|
module Assetify
|
2
4
|
module Helpers
|
3
|
-
|
4
5
|
private
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
#
|
8
|
+
# Detects numerical software version from text.
|
9
|
+
#
|
10
|
+
def find_version(txt)
|
11
|
+
version = txt.match /(?:(\d+)\.)?(?:(\d+)\.)?(\d+)?\.?(\d+)/
|
12
|
+
# If matches a dot, it`s text. Otherwise make it number.
|
13
|
+
v = version.to_a.reject(&:nil?).map { |d| d =~ /\./ ? d : d.to_i }
|
14
|
+
v.empty? || 0 == v[0] ? nil : v
|
8
15
|
end
|
9
16
|
|
10
|
-
def download
|
11
|
-
|
12
|
-
|
13
|
-
|
17
|
+
def download url_str, limit = 10
|
18
|
+
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
|
19
|
+
uri = URI.parse url_str
|
20
|
+
# # response = ""
|
21
|
+
http = Net::HTTP.start(uri.host, :use_ssl => url_str =~ /https/)# do |http|
|
22
|
+
response = http.get(uri.path.empty? ? "/" : uri.path)
|
23
|
+
# # end
|
24
|
+
# response = Net::HTTP.get_response(URI.parse(url_str) )# ,:use_ssl => url_str =~ /https/ )
|
25
|
+
case response
|
26
|
+
when Net::HTTPSuccess then @data = response
|
27
|
+
when Net::HTTPRedirection then download(redirect_url(response), limit - 1)
|
28
|
+
else
|
29
|
+
p "response code: #{response.code}!"
|
30
|
+
response.error!
|
14
31
|
end
|
15
32
|
end
|
16
33
|
|
17
|
-
def
|
34
|
+
def get_data(str)
|
35
|
+
@data = if str =~ /http/
|
36
|
+
download(str).body
|
37
|
+
else
|
38
|
+
File.open(str)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def write(binary)
|
18
43
|
FileUtils.mkdir_p path unless Dir.exists? path
|
19
|
-
File.open(fullpath, "w") { |f| f.puts(
|
44
|
+
File.open(fullpath, "w") { |f| f.puts(binary) }
|
20
45
|
end
|
21
46
|
|
47
|
+
def redirect_url response
|
48
|
+
if response['location'].nil?
|
49
|
+
response.body.match(/<a href=\"([^>]+)\">/i)[1]
|
50
|
+
else
|
51
|
+
response['location']
|
52
|
+
end
|
53
|
+
end
|
22
54
|
|
23
55
|
end
|
24
56
|
end
|
data/lib/assetify/pkg.rb
CHANGED
@@ -11,7 +11,7 @@ module Assetify
|
|
11
11
|
def initialize(name, url)
|
12
12
|
@name = name
|
13
13
|
@pkgname = url.split("/").last
|
14
|
-
@url =
|
14
|
+
@url = url
|
15
15
|
end
|
16
16
|
|
17
17
|
def path
|
@@ -23,6 +23,7 @@ module Assetify
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def get(file)
|
26
|
+
get_data(url) unless File.exists? File.join(PATH, @pkgname)
|
26
27
|
data = nil
|
27
28
|
Archive.read_open_filename(fullpath) do |ar|
|
28
29
|
while entry = ar.next_header
|
@@ -35,11 +36,6 @@ module Assetify
|
|
35
36
|
data
|
36
37
|
end
|
37
38
|
|
38
|
-
def ensure
|
39
|
-
download unless File.exists? File.join(PATH, @pkgname)
|
40
|
-
unpack
|
41
|
-
end
|
42
|
-
|
43
39
|
end
|
44
40
|
|
45
41
|
end
|
data/lib/assetify/tui.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Assetify
|
2
|
+
|
3
|
+
class TUI
|
4
|
+
def initialize(size = TSIZE)
|
5
|
+
@size = size
|
6
|
+
@chars = 0
|
7
|
+
end
|
8
|
+
|
9
|
+
def p txt
|
10
|
+
@chars += txt.size
|
11
|
+
print txt
|
12
|
+
end
|
13
|
+
|
14
|
+
def f txt, color = :green
|
15
|
+
puts "[#{txt}]".send(color).bold.rjust (TSIZE - @chars + 17)
|
16
|
+
@chars = 0
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/assetify/asset_spec.rb
CHANGED
data/spec/assetify/dsl_spec.rb
CHANGED
@@ -8,6 +8,13 @@ describe DSL do
|
|
8
8
|
a.fullpath.should eql("public/javascripts/foo.js")
|
9
9
|
end
|
10
10
|
|
11
|
+
it "should accept a especific location with :to" do
|
12
|
+
Dir.should_receive(:pwd).and_return("/home/nofxx/git/assetify")
|
13
|
+
a = Assetify::DSL.parse("rb 'foo', 'foolink', :to => 'spec/rock'")[0]
|
14
|
+
a.should be_an Asset
|
15
|
+
a.fullpath.should eql("/home/nofxx/git/assetify/spec/rock/foo.rb")
|
16
|
+
end
|
17
|
+
|
11
18
|
|
12
19
|
describe "Group Assets" do
|
13
20
|
|
@@ -36,7 +43,13 @@ describe DSL do
|
|
36
43
|
it "should group and use a namespace" do
|
37
44
|
a = Assetify::DSL.parse "pkg 'fancy', 'http://fancy.zip' do; js 'foo', 'foolink'; end"
|
38
45
|
a[0].should be_an Asset
|
39
|
-
a[0].fullpath.should eql("public/javascripts/
|
46
|
+
a[0].fullpath.should eql("public/javascripts/fancy/foo.js")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should fetch inside archive" do
|
50
|
+
a = Assetify::DSL.parse "pkg 'fancy', 'http://fancy.zip' do; js 'foo', 'foolink'; end"
|
51
|
+
a[0].should be_an Asset
|
52
|
+
a[0].fullpath.should eql("public/javascripts/fancy/foo.js")
|
40
53
|
end
|
41
54
|
|
42
55
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe Helpers do
|
4
|
+
include Helpers
|
5
|
+
it "download stuff" do
|
6
|
+
|
7
|
+
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should find from a long version" do
|
11
|
+
find_version("frips 1.5.7.786").should eql(["1.5.7.786", 1, 5, 7, 786])
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should find version from text" do
|
15
|
+
find_version("Foo v 1.5.6").should eql(["1.5.6", 1, 5, 6])
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should find version from text" do
|
19
|
+
find_version("/*!\n * jQuery JavaScript Library v1.6\n * http://jquery.com/\n *\n * Copyright 2011, John Resig\n * Date: Mon May 2 13:50:00 2011 -0400").
|
20
|
+
should eql(["1.6", 1, 6])
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should rescue fine if there isn`t version" do
|
24
|
+
find_version("/* -------------------------------------------------------------- reset.css * Resets default browser CSS.").
|
25
|
+
should be_nil
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/spec/assetify/pkg_spec.rb
CHANGED
@@ -2,8 +2,15 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
2
2
|
|
3
3
|
describe Pkg do
|
4
4
|
|
5
|
+
|
6
|
+
before do
|
7
|
+
`mkdir /tmp/fancy` unless Dir.exists? "/tmp/fancy"
|
8
|
+
`cp spec/fixtures/fancy.tgz /tmp/fancy`
|
9
|
+
end
|
10
|
+
|
5
11
|
it "should spawn!" do
|
6
|
-
|
12
|
+
stub_request(:get, "http://cool.js/fancy.tgz").to_return(:body => "Hi")
|
13
|
+
as = Pkg.new "cool", "http://cool.js/fancy.tgz"
|
7
14
|
as.should be_instance_of Pkg
|
8
15
|
end
|
9
16
|
|
@@ -13,9 +20,7 @@ describe Pkg do
|
|
13
20
|
end
|
14
21
|
|
15
22
|
it "should get file from unpack" do
|
16
|
-
|
17
|
-
`cp spec/fixtures/fancy.tgz /tmp/fancy`
|
18
|
-
as = Pkg.new "fancy", "http://fancy.tgz"
|
23
|
+
as = Pkg.new "fancy", "/tmp/fancy/fancy.tgz"
|
19
24
|
as.get("fancy/fancy.css").should eql("// Fancy css!\n\n#foo {\n padding: 10px;\n}\n")
|
20
25
|
|
21
26
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
require 'rspec'
|
4
|
+
require 'webmock/rspec'
|
4
5
|
require 'assetify'
|
6
|
+
|
5
7
|
include Assetify
|
8
|
+
|
9
|
+
|
6
10
|
def mock_jsfile(d = 'js "cool", "http://cool.js/down"')
|
7
11
|
File.should_receive(:open).once.with("Jsfile").and_return(d)
|
8
12
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 2
|
7
8
|
- 1
|
8
|
-
|
9
|
-
version: 0.1.1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Marcos Piccinini
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-05-
|
17
|
+
date: 2011-05-30 00:00:00 -03:00
|
18
18
|
default_executable: assetify
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -62,6 +62,19 @@ dependencies:
|
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: webmock
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: *id004
|
65
78
|
description: Downloads/updates assets based on a Jsfile. Any framework.
|
66
79
|
email: x@nofxx.com
|
67
80
|
executables:
|
@@ -75,6 +88,7 @@ files:
|
|
75
88
|
- .rspec
|
76
89
|
- Gemfile
|
77
90
|
- Gemfile.lock
|
91
|
+
- Jsfile
|
78
92
|
- README.md
|
79
93
|
- Rakefile
|
80
94
|
- VERSION
|
@@ -82,11 +96,14 @@ files:
|
|
82
96
|
- bin/assetify
|
83
97
|
- lib/assetify.rb
|
84
98
|
- lib/assetify/asset.rb
|
99
|
+
- lib/assetify/colored.rb
|
85
100
|
- lib/assetify/dsl.rb
|
86
101
|
- lib/assetify/helpers.rb
|
87
102
|
- lib/assetify/pkg.rb
|
103
|
+
- lib/assetify/tui.rb
|
88
104
|
- spec/assetify/asset_spec.rb
|
89
105
|
- spec/assetify/dsl_spec.rb
|
106
|
+
- spec/assetify/helpers_spec.rb
|
90
107
|
- spec/assetify/pkg_spec.rb
|
91
108
|
- spec/assetify_spec.rb
|
92
109
|
- spec/fixtures/fancy.tgz
|
@@ -105,7 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
122
|
requirements:
|
106
123
|
- - ">="
|
107
124
|
- !ruby/object:Gem::Version
|
108
|
-
hash:
|
125
|
+
hash: 119346050710265348
|
109
126
|
segments:
|
110
127
|
- 0
|
111
128
|
version: "0"
|