sundawg-sinatra-assetpack-fork 0.0.12.pre1 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/.gitignore +1 -1
  2. data/.travis.yml +17 -0
  3. data/CONTRIBUTING.md +27 -0
  4. data/Gemfile +2 -1
  5. data/Gemfile.lock +72 -0
  6. data/HISTORY.md +60 -1
  7. data/README.md +54 -11
  8. data/examples/basic/app.rb +12 -1
  9. data/lib/sinatra/assetpack.rb +1 -1
  10. data/lib/sinatra/assetpack/class_methods.rb +8 -6
  11. data/lib/sinatra/assetpack/compressor.rb +1 -0
  12. data/lib/sinatra/assetpack/css.rb +1 -1
  13. data/lib/sinatra/assetpack/engines/less.rb +11 -0
  14. data/lib/sinatra/assetpack/helpers.rb +13 -3
  15. data/lib/sinatra/assetpack/html_helpers.rb +12 -0
  16. data/lib/sinatra/assetpack/image.rb +2 -2
  17. data/lib/sinatra/assetpack/options.rb +24 -9
  18. data/lib/sinatra/assetpack/package.rb +15 -8
  19. data/lib/sinatra/assetpack/version.rb +1 -1
  20. data/sinatra-assetpack.gemspec +5 -0
  21. data/test/app/app.rb +8 -1
  22. data/test/app/app/fonts/cantarell-regular-webfont.eot +0 -0
  23. data/test/app/app/fonts/cantarell-regular-webfont.svg +18 -0
  24. data/test/app/app/fonts/cantarell-regular-webfont.ttf +0 -0
  25. data/test/app/app/fonts/cantarell-regular-webfont.woff +0 -0
  26. data/test/app/app/js/jquery-1.8.0.min.js +1 -0
  27. data/test/app/app/packages/a_package/package.css +1 -0
  28. data/test/app/app/packages/a_package/package.js +1 -0
  29. data/test/app/app/packages/a_package/package.png +0 -0
  30. data/test/app/config.ru +2 -0
  31. data/test/arity_test.rb +8 -2
  32. data/test/cache_test.rb +17 -1
  33. data/test/glob_test.rb +3 -0
  34. data/test/ignore_test.rb +2 -2
  35. data/test/img_test.rb +2 -2
  36. data/test/local_file_test.rb +6 -0
  37. data/test/mime_type_test.rb +20 -0
  38. data/test/redundant_test.rb +1 -0
  39. data/test/sqwish_test.rb +4 -3
  40. data/test/test_helper.rb +6 -1
  41. data/test/tilt_test.rb +1 -0
  42. data/test/unit_test.rb +42 -5
  43. metadata +207 -189
  44. data/lib/sinatra/assetpack/hasharray.rb +0 -66
@@ -1,66 +0,0 @@
1
- module Sinatra
2
- module AssetPack
3
- # Class: HashArray
4
- # A stopgap solution to Ruby 1.8's lack of ordered hashes.
5
- #
6
- # A HashArray, for all intents and purposes, acts like an array. However, the
7
- # common stuff are overloaded to work with hashes.
8
- #
9
- # ## Basic usage
10
- #
11
- # #### Creating
12
- # You can create a HashArray by passing it an array.
13
- #
14
- # dict = HashArray.new([
15
- # { :good_morning => "Bonjour" },
16
- # { :goodbye => "Au revoir" },
17
- # { :good_evening => "Bon nuit" }
18
- # ])
19
- #
20
- # #### Converting
21
- # You may also use it like so:
22
- #
23
- # letters = [ { :a => "Aye"}, { :b => "Bee" } ].to_hash_array
24
- #
25
- # #### Iterating
26
- # Now you can use the typical enumerator functions:
27
- #
28
- # dict.each do |(key, value)|
29
- # puts "#{key} is #{value}"
30
- # end
31
- #
32
- # #=> :good_morning is "Bonjour"
33
- # # :goodbye is "Au revoir"
34
- # # :good_evening is "Bon nuit"
35
- #
36
- class HashArray < Array
37
- def self.[](*arr)
38
- new arr.each_slice(2).map { |(k, v)| Hash[k, v] }
39
- end
40
-
41
- # Works like Hash#values.
42
- def values
43
- inject([]) { |a, (k, v)| a << v; a }
44
- end
45
-
46
- # Returns everything as a hash.
47
- def to_hash
48
- inject({}) { |hash, (k, v)| hash[k] = v; hash }
49
- end
50
-
51
- def keys
52
- inject([]) { |a, (k, v)| a << k; a }
53
- end
54
-
55
- [:each, :map, :map!, :reject, :reject!, :select, :select!].each do |meth|
56
- send(:define_method, meth) { |*a, &block|
57
- if block.respond_to?(:call)
58
- super(*a) { |hash| block.call *hash.to_a }
59
- else
60
- super(*a)
61
- end
62
- }
63
- end
64
- end
65
- end
66
- end