color_parser 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/Guardfile +2 -2
  2. data/README.md +4 -19
  3. data/color_parser.gemspec +2 -3
  4. data/lib/color_parser.rb +1 -45
  5. data/lib/color_parser/page.rb +14 -57
  6. data/lib/color_parser/stylesheet.rb +20 -82
  7. data/lib/color_parser/version.rb +1 -1
  8. data/spec/fixtures/css_color/stylesheets/color_styles.css +7 -7
  9. data/spec/fixtures/css_color/stylesheets/frequency.css +9 -9
  10. data/spec/page_spec.rb +27 -182
  11. data/spec/stylesheet_spec.rb +43 -153
  12. metadata +5 -95
  13. data/lib/color_parser/image.rb +0 -20
  14. data/lib/color_parser/request.rb +0 -21
  15. data/spec/color_parser_spec.rb +0 -88
  16. data/spec/fixtures/css/absolute.html +0 -15
  17. data/spec/fixtures/css/inline.html +0 -34
  18. data/spec/fixtures/css/inline_import.html +0 -16
  19. data/spec/fixtures/css/invalid.html +0 -15
  20. data/spec/fixtures/css/relative.html +0 -15
  21. data/spec/fixtures/css/relative_root.html +0 -15
  22. data/spec/fixtures/css/stylesheets/colors.css +0 -0
  23. data/spec/fixtures/css/stylesheets/fonts.css +0 -0
  24. data/spec/fixtures/css/stylesheets/print.css +0 -3
  25. data/spec/fixtures/css/stylesheets/screen.css +0 -16
  26. data/spec/fixtures/css_images/images/apple.png +0 -0
  27. data/spec/fixtures/css_images/images/cantaloupe.png +0 -0
  28. data/spec/fixtures/css_images/images/kiwi.jpg +0 -0
  29. data/spec/fixtures/css_images/images/mango.png +0 -0
  30. data/spec/fixtures/css_images/images/pineapple.png +0 -0
  31. data/spec/fixtures/css_images/paths.html +0 -14
  32. data/spec/fixtures/css_images/stylesheets/import_paths.css +0 -4
  33. data/spec/fixtures/css_images/stylesheets/paths.css +0 -17
  34. data/spec/fixtures/css_images/stylesheets/quotes.css +0 -14
  35. data/spec/fixtures/css_import/index.html +0 -15
  36. data/spec/fixtures/css_import/stylesheets/borders.css +0 -0
  37. data/spec/fixtures/css_import/stylesheets/colors.css +0 -0
  38. data/spec/fixtures/css_import/stylesheets/fonts.css +0 -3
  39. data/spec/fixtures/css_import/stylesheets/ie.css +0 -3
  40. data/spec/fixtures/css_import/stylesheets/images.css +0 -0
  41. data/spec/fixtures/css_import/stylesheets/master.css +0 -12
  42. data/spec/fixtures/css_import/stylesheets/print.css +0 -3
  43. data/spec/fixtures/css_import/stylesheets/screen.css +0 -12
  44. data/spec/fixtures/inline_images/absolute.html +0 -14
  45. data/spec/fixtures/inline_images/images/apple.png +0 -0
  46. data/spec/fixtures/inline_images/images/kiwi.jpg +0 -0
  47. data/spec/fixtures/inline_images/relative.html +0 -14
  48. data/spec/fixtures/inline_images/relative_root.html +0 -14
  49. data/spec/image_spec.rb +0 -33
  50. data/spec/request_spec.rb +0 -12
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
4
-
5
- <head>
6
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
7
- <title>Color Parser</title>
8
-
9
- <link rel="stylesheet" href="stylesheets/paths.css" media="screen" type="text/css" />
10
- </head>
11
- <body>
12
- <img src="images/mango.png" />
13
- </body>
14
- </html>
@@ -1,4 +0,0 @@
1
- /* imported */
2
- h2 {
3
- background: #fff url("/css_images/images/pineapple.png") 0 0 no-repeat;
4
- }
@@ -1,17 +0,0 @@
1
- /* absolute */
2
- body {
3
- background: #fff url("http://example.com/css_images/images/apple.png") 0 0 no-repeat;
4
- }
5
-
6
- /* relative */
7
- div {
8
- background: #fff url("/css_images/images/kiwi.jpg") 0 0 no-repeat;
9
- }
10
-
11
- /* relative root */
12
- ul {
13
- background: #fff url("../images/cantaloupe.png") 0 0 no-repeat;
14
- }
15
-
16
- /* import */
17
- @import url("import_paths.css");
@@ -1,14 +0,0 @@
1
- /* quotes */
2
- dl {
3
- background: #fff url("/css_images/images/apple.png") 0 0 no-repeat;
4
- }
5
-
6
- /* single quotes */
7
- h1 {
8
- background: #fff url('/css_images/images/kiwi.jpg') 0 0 no-repeat;
9
- }
10
-
11
- /* no quotes */
12
- h2 {
13
- background: #fff url(/css_images/images/cantaloupe.png) 0 0 no-repeat;
14
- }
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
4
-
5
- <head>
6
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
7
- <title>Color Parser</title>
8
-
9
- <link rel="stylesheet" href="stylesheets/screen.css" media="screen" type="text/css" />
10
- <link rel="stylesheet" href="stylesheets/print.css" media="screen" type="text/css" />
11
- </head>
12
- <body>
13
- <div></div>
14
- </body>
15
- </html>
File without changes
File without changes
@@ -1,3 +0,0 @@
1
- body {
2
- font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Helvetica, Arial, sans-serif;
3
- }
@@ -1,3 +0,0 @@
1
- div {
2
- background-color: red;
3
- }
File without changes
@@ -1,12 +0,0 @@
1
- a:link {
2
- color: #357ad1;
3
- }
4
- a:visited {
5
- color: #77abf0;
6
- }
7
- a:hover {
8
- color: #333;
9
- }
10
- .shade {
11
- background-color: #f5f5f5;
12
- }
@@ -1,3 +0,0 @@
1
- body {
2
- margin: 0;
3
- }
@@ -1,12 +0,0 @@
1
- body {
2
- color: #444;
3
- background-color: #535353;
4
- }
5
-
6
- @import url("master.css");
7
- @import url('/css_import/stylesheets/fonts.css');
8
- @import url(http://example.com/css_import/stylesheets/ie.css);
9
- @import url "images.css";
10
- @import "borders.css";
11
- @import colors.css;
12
- @import url("invalid.css");
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
4
-
5
- <head>
6
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
7
- <title>Color Parser</title>
8
- </head>
9
- <body>
10
- <img src="http://example.com/inline_images/images/apple.png" />
11
- <p>Something</p>
12
- <img src='http://example.com/inline_images/images/kiwi.jpg' />
13
- </body>
14
- </html>
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
4
-
5
- <head>
6
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
7
- <title>Color Parser</title>
8
- </head>
9
- <body>
10
- <img src="images/apple.png" />
11
- <p>Something</p>
12
- <img src='images/kiwi.jpg' />
13
- </body>
14
- </html>
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
4
-
5
- <head>
6
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
7
- <title>Color Parser</title>
8
- </head>
9
- <body>
10
- <img src="/inline_images/images/apple.png" />
11
- <p>Something</p>
12
- <img src='/inline_images/images/kiwi.jpg' />
13
- </body>
14
- </html>
data/spec/image_spec.rb DELETED
@@ -1,33 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Image do
4
- before(:each) do
5
- ColorParser.request = FakeRequest.new
6
- end
7
-
8
- describe "" do
9
- it "should assign url" do
10
- image = ColorParser::Image.new("http://example.com/foo/bar.png")
11
-
12
- expect(image.url).to eq "http://example.com/foo/bar.png"
13
- end
14
- end
15
-
16
- describe "" do
17
- it "should parse host path and query from url" do
18
- image = ColorParser::Image.new("http://example.com/foo/bar.png?baz=bar")
19
-
20
- expect(image.host).to eq "example.com"
21
- expect(image.path).to eq "/foo/bar.png"
22
- expect(image.query).to eq "baz=bar"
23
- end
24
- end
25
-
26
- describe "" do
27
- it "should parse name" do
28
- image = ColorParser::Image.new("http://example.com/foo/bar.png?baz=bar")
29
-
30
- expect("bar.png").to eq image.name
31
- end
32
- end
33
- end
data/spec/request_spec.rb DELETED
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ColorParser do
4
- describe "#get" do
5
- it "must return results" do
6
- request = Request.new
7
-
8
- # body = request.get("http://google.com")
9
- # expect(body).to include "<html"
10
- end
11
- end
12
- end