theme_bandit 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc589066445b4257641f73b8bd7d9916ab226f77
4
- data.tar.gz: 81ea5575b0132159a2bb684f2ca5b2ea69869c9b
3
+ metadata.gz: 4c1feaabd974b8c53b878efa185272e62cd157d4
4
+ data.tar.gz: fdf1c431def302ee0ccafba20e617de569254a5f
5
5
  SHA512:
6
- metadata.gz: 2ef26a8702620eb23ec1841a993dff3761e0a9d2c5ec5ac93bb6a230ae87d69a97b1aaf6df8c374a5ef303b8e7f308364e0317ad14e804561b63d8c56bccdc85
7
- data.tar.gz: 43475a0b29b2f3cee58c5257157801c0d5b3a426de15cd6c601303f3726aee891aadadbf76590bcd8c51a99e7231b0abf766a8b0cf80087fdc1ff1979d5cf754
6
+ metadata.gz: a96154643d9addc33d62ddb79686713478552784f2c0e37047176492cd15e48683711e07631539b3ca7b2641e3ed207f4760541f1df3bda025173d8daac82b17
7
+ data.tar.gz: 7591c424dc88e71b98f53a5a0d71466ad52b6c8831dc491fca558ee606c51894555ea9af461ad0273239f0f9282bdbe48afb4eedd1f1437731c701f85b5019d7
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # ThemeBandit
1
+ # theme_bandit
2
2
 
3
3
  Enjoy rapid prototyping with theme bandit :heart:
4
4
 
5
5
  Wordpress themes are beautiful - now you can easily convert your favorite themes to a small ruby app
6
6
 
7
- This gem converts any site template (Wordpress, Joomla, HTML) into
8
- simple sinatra rack application, resolving both javascript and css.
7
+ This gem converts any site template (Wordpress, Joomla, HTML) into a
8
+ simple [sinatra](http://www.sinatrarb.com/) rack application.
9
9
 
10
10
  Usage from the command line: `bandit`
11
11
 
@@ -15,11 +15,29 @@ Usage from the command line: `bandit`
15
15
 
16
16
  You wouldn't download a website ... would you?!
17
17
 
18
- ## Installation
18
+ ## CLI usage
19
+ `bandit` -> Builds a rack application in a `theme` directory of
20
+ your current working directory.
21
+
22
+ ## TODO / Coming Soon
23
+ - Support for binaries (images + fonts + embeds)
24
+ - Fetch asynchronous resources
25
+ - Support for multiple pages
26
+
27
+ ## template issues
28
+ Not all templating engines play nicely with html. If you run into
29
+ templating issues, `erb` will be your safest bet because it renders as
30
+ pure html.
31
+
32
+ Example: The gem converts html for page A to slim, erb, or haml.
33
+ If the html for page A is messy, it will produce bad slim
34
+ and cause the application to blow up until adjusted.
35
+
36
+ ## installation
19
37
 
20
38
  Add this line to your application's Gemfile:
21
39
 
22
- gem 'theme_bandit', '~> 0.0.5'
40
+ gem 'theme_bandit', '~> 0.0.7'
23
41
 
24
42
  And then execute:
25
43
 
@@ -29,34 +47,13 @@ Or install it yourself as:
29
47
 
30
48
  $ gem install theme_bandit
31
49
 
32
- ## Usage
33
- `bandit` -> Builds a rack application in the `theme` directory of
34
- your project root.
35
-
36
- ## Caveats
37
- Not all templating engines play nicely with html. If you run into
38
- templating issues, `erb` will be your safest bet because it renders as
39
- pure html.
40
-
41
- Example: The gem converts html for page A to slim, erb, or haml.
42
- Sometimes the html for page A is messy and in turn produces bad slim,
43
- which can cause the application to blow up until corrected.
44
-
45
- ## TODO / Coming Soon
46
- - _Replace & fetch @import declarations in CSS_ added in v0.0.5
47
- - Support for binaries (images + fonts + embeds)
48
- - Fetch ajax resources
49
- - HTML Sanitization
50
- - Support for multiple pages
51
- - HTML Formatting
52
- - Verfiy inline tags
53
50
 
54
- ## Tests
51
+ ## tests
55
52
 
56
53
  ```
57
- rake test
54
+ bundle exec rake test
58
55
  ```
59
- ## Contributing
56
+ ## contributing
60
57
 
61
58
  1. Fork it
62
59
  2. Create your feature branch (`git checkout -b my-new-feature`)
@@ -1,3 +1,4 @@
1
+ require 'pry'
1
2
  module ThemeBandit
2
3
  module HTMLParser
3
4
  def revise_head_tags
@@ -13,11 +14,17 @@ module ThemeBandit
13
14
  end
14
15
 
15
16
  def remove_link_tags
16
- document.search('link').remove
17
+ document.search('link').each do |node|
18
+ if node[:rel] == 'stylesheet'
19
+ node.remove
20
+ end
21
+ end
17
22
  end
18
23
 
19
24
  def remove_script_tags
20
- document.search('script').remove
25
+ document.search('script').each do |node|
26
+ node.remove if node[:src]
27
+ end
21
28
  end
22
29
 
23
30
  def local_link_names
@@ -1,3 +1,3 @@
1
1
  module ThemeBandit
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
@@ -6,6 +6,7 @@
6
6
  <basefont size=4>
7
7
  <link rel='stylesheet' href='/css/style.css'></link>
8
8
  <link rel='stylesheet' href='/css/style_with_import.css'></link>
9
+ <link rel='foo' href='bar'></link>
9
10
  <script type='text/javascripts' src='/js/script.js'></script>
10
11
  <script type='text/javascripts' src='/js/script_2.js'></script>
11
12
  </head>
@@ -41,44 +42,45 @@
41
42
  <h2>How about a nice ordered list!</h2>
42
43
  <ol>
43
44
  <li>This little piggy went to market
44
- <li>This little piggy went to SB228 class
45
- <li>This little piggy went to an expensive restaurant in Downtown Palo Alto
46
- <li>This little piggy ate too much at Indian Buffet.
47
- <li>This little piggy got lost
48
- </ol>
49
-
50
- <h2>Unordered list</h2>
51
- <ul>
52
- <li>First element
53
- <li>Second element
54
- <li>Third element
55
- </ul>
56
-
57
- <hr>
58
-
59
- <h2>Nested Lists!</h2>
60
- <ul>
61
- <li>Things to to today:
62
- <ol>
63
- <li>Walk the dog
64
- <li>Feed the cat
65
- <li>Mow the lawn
66
- </ol>
67
- <li>Things to do tomorrow:
68
- <ol>
69
- <li>Lunch with mom
70
- <li>Feed the hamster
71
- <li>Clean kitchen
72
- </ol>
73
- </ul>
74
-
75
- <p>And finally, how about some <a href=http://www.yahoo.com/>Links?</a></p>
76
-
77
- <p>Or let's just link to <a href=../../index.html>another page on this server</a></p>
78
-
79
- <p>Remember, you can view the HTMl code from this or any other page by using the "View Page Source" command of your browser.</p>
80
-
81
- </body>
82
-
83
- </html>
45
+ <li>This little piggy went to SB228 class
46
+ <li>This little piggy went to an expensive restaurant in Downtown Palo Alto
47
+ <li>This little piggy ate too much at Indian Buffet.
48
+ <li>This little piggy got lost
49
+ </ol>
50
+
51
+ <h2>Unordered list</h2>
52
+ <ul>
53
+ <li>First element
54
+ <li>Second element
55
+ <li>Third element
56
+ </ul>
57
+
58
+ <hr>
59
+
60
+ <h2>Nested Lists!</h2>
61
+ <ul>
62
+ <li>Things to to today:
63
+ <ol>
64
+ <li>Walk the dog
65
+ <li>Feed the cat
66
+ <li>Mow the lawn
67
+ </ol>
68
+ <li>Things to do tomorrow:
69
+ <ol>
70
+ <li>Lunch with mom
71
+ <li>Feed the hamster
72
+ <li>Clean kitchen
73
+ </ol>
74
+ </ul>
75
+
76
+ <p>And finally, how about some <a href=http://www.yahoo.com/>Links?</a></p>
77
+
78
+ <p>Or let's just link to <a href=../../index.html>another page on this server</a></p>
79
+
80
+ <p>Remember, you can view the HTMl code from this or any other page by using the "View Page Source" command of your browser.</p>
81
+
82
+ <script>var foo = 'bar';</script>
83
+ </body>
84
+
85
+ </html>
84
86
 
@@ -34,7 +34,6 @@ describe ThemeBandit::DocumentWriter do
34
34
  end
35
35
 
36
36
  it 'writes styles' do
37
-
38
37
  assert File.file?("#{Dir.pwd}/theme/public/css/0_style.css")
39
38
  end
40
39
 
@@ -48,6 +47,10 @@ describe ThemeBandit::DocumentWriter do
48
47
  end
49
48
  end
50
49
 
50
+ it 'preserves inline scripts' do
51
+ assert @subject.document.search('script')[2]
52
+ end
53
+
51
54
  describe 'import output' do
52
55
  it 'merges css files' do
53
56
  contents = File.read(File.open("#{Dir.pwd}/theme/public/css/0_style_with_import.css", 'r'))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: theme_bandit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Fender
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-25 00:00:00.000000000 Z
11
+ date: 2014-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty