hmachine 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/README.md +4 -133
  2. data/hmachine.gemspec +15 -79
  3. metadata +22 -89
  4. data/.gitignore +0 -3
  5. data/Gemfile +0 -11
  6. data/Gemfile.lock +0 -51
  7. data/Rakefile +0 -53
  8. data/bin/hmachine +0 -99
  9. data/test/fixtures/hcard/commercenet.html +0 -21
  10. data/test/fixtures/hcard/geo.html +0 -28
  11. data/test/fixtures/huffduffer.html +0 -466
  12. data/test/fixtures/likeorhate.html +0 -48
  13. data/test/fixtures/rel_license.html +0 -4
  14. data/test/fixtures/test-fixture/hcard/hcard1.html +0 -147
  15. data/test/fixtures/test-fixture/hcard/hcard11.html +0 -123
  16. data/test/fixtures/test-fixture/hcard/hcard12.html +0 -178
  17. data/test/fixtures/test-fixture/hcard/hcard17.html +0 -165
  18. data/test/fixtures/test-fixture/hcard/hcard2.html +0 -264
  19. data/test/fixtures/test-fixture/hcard/hcard3.html +0 -144
  20. data/test/fixtures/test-fixture/hcard/hcard4.html +0 -117
  21. data/test/fixtures/test-fixture/hcard/hcard5.html +0 -119
  22. data/test/fixtures/test-fixture/hcard/hcard6.html +0 -188
  23. data/test/fixtures/test-fixture/hcard/hcard7.html +0 -188
  24. data/test/fixtures/test-fixture/hcard/hcard8.html +0 -130
  25. data/test/fixtures/test-fixture/hcard/hcard9.html +0 -111
  26. data/test/fixtures/test-fixture/hcard/hcard99.html +0 -215
  27. data/test/fixtures/test-fixture/value-class-date-time/value-dt-test-YYYY-MM-DD--HH-MM.html +0 -9
  28. data/test/fixtures/test-fixture/value-class-date-time/value-dt-test-abbr-YYYY-MM-DD--HH-MM.html +0 -4
  29. data/test/fixtures/xfn.html +0 -198
  30. data/test/fixtures/xmdp.html +0 -32
  31. data/test/fixtures/xoxo.html +0 -51
  32. data/test/hmachine_test.rb +0 -133
  33. data/test/microformat/adr_test.rb +0 -47
  34. data/test/microformat/geo_test.rb +0 -66
  35. data/test/microformat/hcard_test.rb +0 -510
  36. data/test/microformat/rellicense_test.rb +0 -36
  37. data/test/microformat/reltag_test.rb +0 -61
  38. data/test/microformat/votelinks_test.rb +0 -44
  39. data/test/microformat/xfn_test.rb +0 -28
  40. data/test/microformat/xmdp_test.rb +0 -16
  41. data/test/microformat/xoxo_test.rb +0 -51
  42. data/test/microformat_test.rb +0 -20
  43. data/test/pattern/date_time_test.rb +0 -55
  44. data/test/pattern/value_class_test.rb +0 -33
  45. data/test/pattern_test.rb +0 -132
  46. data/test/posh/anchor_test.rb +0 -41
  47. data/test/posh/base_test.rb +0 -150
  48. data/test/posh/definition_list_test.rb +0 -38
  49. data/test/test_helper.rb +0 -32
data/README.md CHANGED
@@ -1,135 +1,6 @@
1
- # hMachine
1
+ # HMACHINE HAS MOVED
2
2
 
3
- **Ruby microformat parser and HTML toolkit**
3
+ ## It is now called _Prism_
4
4
 
5
- [RDoc](http://rdoc.info/projects/mwunsch/hmachine) | [Gem](http://rubygems.org/gems/hmachine) | [Metrics](http://getcaliper.com/caliper/project?repo=git%3A%2F%2Fgithub.com%2Fmwunsch%2Fhmachine.git)
6
-
7
- ## What hMachine is:
8
-
9
- + A robust microformat parser
10
- + A command-line tool for parsing microformats from a url or a string of markup
11
- + A DSL for defining semantic markup patterns
12
- + Export microformats to other standards:
13
- + hCard => vCard
14
-
15
- It is your [lowercase semantic web](http://tantek.com/presentations/2004etech/realworldsemanticspres.html) friend.
16
-
17
- >Designed for humans first and machines second, microformats are a set of simple, open data formats built upon existing and widely adopted standards. Instead of throwing away what works today, microformats intend to solve simpler problems first by adapting to current behaviors and usage patterns (e.g. XHTML, blogging).
18
-
19
- Learn more about Microformats at http://microformats.org.
20
-
21
- ## Usage
22
-
23
- The command line tool takes a SOURCE from the Standard Input or as an argument:
24
-
25
- $: curl http://markwunsch.com | hmachine --hcard > ~/Desktop/me.vcf
26
-
27
- OR
28
-
29
- $: hmachine --hcard http://markwunsch.com > ~/Desktop/me.vcf
30
-
31
- ## Installation
32
-
33
- With Ruby and Rubygems:
34
-
35
- gem install hmachine
36
-
37
- Or clone the repository and run `bundle install` to get the development dependencies.
38
-
39
- #### Requirements:
40
-
41
- + [Nokogiri](http://github.com/tenderlove/nokogiri)
42
-
43
- ## Microformats supported (right now, as of this very moment)
44
-
45
- + [rel-tag](http://microformats.org/wiki/rel-tag)
46
- + [rel-license](http://microformats.org/wiki/rel-license)
47
- + [VoteLinks](http://microformats.org/wiki/vote-links)
48
- + [XFN](http://microformats.org/wiki/XFN)
49
- + [XOXO](http://microformats.org/wiki/xoxo)
50
- + [XMDP](http://microformats.org/wiki/XMDP)
51
- + [geo](http://microformats.org/wiki/geo)
52
- + [adr](http://microformats.org/wiki/adr)
53
- + [hCard](http://microformats.org/wiki/hcard)
54
-
55
- More on the way.
56
-
57
- ## Finding Microformats:
58
-
59
- # All microformats
60
- HMachine.find 'http://foobar.com'
61
-
62
- # A specific microformat
63
- HMachine.find 'http://foobar.com', :hcard
64
-
65
- # Search HTML too
66
- HMachine.find big_string_of_html
67
-
68
- ### Parsing Microformats:
69
-
70
- twitter_contacts = HMachine.find 'http://twitter.com/markwunsch', :hcard
71
- me = twitter_contacts.first
72
- me.fn
73
- #=> "Mark Wunsch"
74
- me.n.family_name
75
- #=> "Wunsch"
76
- me.url
77
- #=> "http://markwunsch.com/"
78
- File.open('mark.vcf','w') {|f| f.write me.to_vcard }
79
- ## Add me to your address book!
80
-
81
- ## POSH DSL
82
-
83
- The `HMachine` module defines a group of methods to search, validate, and extract nodes out of a Nokogiri document.
84
-
85
- All microformats inherit from `HMachine::POSH::Base`, because all microformats begin as [POSH formats](http://microformats.org/wiki/posh). If you wanted to create your own POSH format, you'd do something like this:
86
-
87
- class Navigation < HMachine::POSH::Base
88
- search {|document| document.css('ul#navigation') }
89
- # Search a Nokogiri document for nodes of a certain type
90
-
91
- validate {|node| node.matches?('ul#navigation') }
92
- # Validate that a node is the right element we want
93
-
94
- has_many :items do
95
- search {|doc| doc.css('li') }
96
- end
97
- # has_many and has_one define Properties of the POSH format (HMachine::Property)
98
- # Each Property object includes the HMachine module, so they can search, validate, and extract
99
- end
100
-
101
- Now you can do:
102
-
103
- nav = Navigation.parse_first(document)
104
- # document is a Nokogiri document.
105
- # parse_first extracts just the first example of the format out of the document
106
-
107
- nav.items
108
- # Returns an array of contents
109
- # This method comes from the has_many call up above that defines the Property
110
-
111
- ## Other Microformat parsers
112
-
113
- + [Mofo](http://mofo.rubyforge.org/) is a Ruby microformat parser backed by Hpricot.
114
- + [Sumo](http://www.danwebb.net/2007/2/9/sumo-a-generic-microformats-parser-for-javascript) is a JavaScript microformat parser.
115
- + [Operator](https://addons.mozilla.org/en-US/firefox/addon/4106) is a Firefox extension.
116
- + [hKit](http://code.google.com/p/hkit/) is a microformat parser for PHP.
117
- + [Oomph](http://visitmix.com/labs/oomph/) is a microformat toolkit add-in for Internet Explorer.
118
-
119
- ## Feature wishlist:
120
-
121
- + HTML outliner (using HTML5 sectioning)
122
- + Extensions so you can do something like: `String.is_a_valid? :hcard` in your tests
123
- + Extensions to turn Ruby objects into semantic HTML. Hash.to_definition_list, Array.to_ordered_list, etc.
124
-
125
- ## TODO:
126
-
127
- + Handle nested microformats better (I like HMachine::Pattern::ValueClass's search implementation the best)
128
- + Code is ugly. Especially XOXO.
129
- + Better recursive parsing of trees. See above.
130
- + Tests are all kinds of disorganized.
131
- + Broader support for some of the weirder Patterns, like object[data]
132
-
133
- ## License
134
-
135
- hMachine is licensed under the [MIT License](http://creativecommons.org/licenses/MIT/) and is Copyright (c) 2010 Mark Wunsch.
5
+ UPDATE YOUR BOOKMARKS:
6
+ http://github.com/mwunsch/prism
data/hmachine.gemspec CHANGED
@@ -5,27 +5,19 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hmachine}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mark Wunsch"]
12
- s.date = %q{2010-02-24}
13
- s.default_executable = %q{hmachine}
14
- s.description = %q{A Ruby microformat parser and HTML toolkit powered by Nokogiri}
12
+ s.date = %q{2010-02-25}
13
+ s.description = %q{This project has been renamed to Prism. `gem install prism`}
15
14
  s.email = ["mark@markwunsch.com"]
16
- s.executables = ["hmachine"]
17
15
  s.extra_rdoc_files = [
18
16
  "LICENSE",
19
17
  "README.md"
20
18
  ]
21
19
  s.files = [
22
- ".gitignore",
23
- "Gemfile",
24
- "Gemfile.lock",
25
- "LICENSE",
26
- "README.md",
27
- "Rakefile",
28
- "bin/hmachine",
20
+ "README.md",
29
21
  "hmachine.gemspec",
30
22
  "lib/hmachine.rb",
31
23
  "lib/hmachine/microformat.rb",
@@ -47,86 +39,30 @@ Gem::Specification.new do |s|
47
39
  "lib/hmachine/posh.rb",
48
40
  "lib/hmachine/posh/anchor.rb",
49
41
  "lib/hmachine/posh/base.rb",
50
- "lib/hmachine/posh/definition_list.rb",
51
- "test/fixtures/hcard/commercenet.html",
52
- "test/fixtures/hcard/geo.html",
53
- "test/fixtures/huffduffer.html",
54
- "test/fixtures/likeorhate.html",
55
- "test/fixtures/rel_license.html",
56
- "test/fixtures/test-fixture/hcard/hcard1.html",
57
- "test/fixtures/test-fixture/hcard/hcard11.html",
58
- "test/fixtures/test-fixture/hcard/hcard12.html",
59
- "test/fixtures/test-fixture/hcard/hcard17.html",
60
- "test/fixtures/test-fixture/hcard/hcard2.html",
61
- "test/fixtures/test-fixture/hcard/hcard3.html",
62
- "test/fixtures/test-fixture/hcard/hcard4.html",
63
- "test/fixtures/test-fixture/hcard/hcard5.html",
64
- "test/fixtures/test-fixture/hcard/hcard6.html",
65
- "test/fixtures/test-fixture/hcard/hcard7.html",
66
- "test/fixtures/test-fixture/hcard/hcard8.html",
67
- "test/fixtures/test-fixture/hcard/hcard9.html",
68
- "test/fixtures/test-fixture/hcard/hcard99.html",
69
- "test/fixtures/test-fixture/value-class-date-time/value-dt-test-YYYY-MM-DD--HH-MM.html",
70
- "test/fixtures/test-fixture/value-class-date-time/value-dt-test-abbr-YYYY-MM-DD--HH-MM.html",
71
- "test/fixtures/xfn.html",
72
- "test/fixtures/xmdp.html",
73
- "test/fixtures/xoxo.html",
74
- "test/hmachine_test.rb",
75
- "test/microformat/adr_test.rb",
76
- "test/microformat/geo_test.rb",
77
- "test/microformat/hcard_test.rb",
78
- "test/microformat/rellicense_test.rb",
79
- "test/microformat/reltag_test.rb",
80
- "test/microformat/votelinks_test.rb",
81
- "test/microformat/xfn_test.rb",
82
- "test/microformat/xmdp_test.rb",
83
- "test/microformat/xoxo_test.rb",
84
- "test/microformat_test.rb",
85
- "test/pattern/date_time_test.rb",
86
- "test/pattern/value_class_test.rb",
87
- "test/pattern_test.rb",
88
- "test/posh/anchor_test.rb",
89
- "test/posh/base_test.rb",
90
- "test/posh/definition_list_test.rb",
91
- "test/test_helper.rb"
42
+ "lib/hmachine/posh/definition_list.rb"
92
43
  ]
93
- s.homepage = %q{http://github.com/mwunsch/hmachine}
44
+ s.homepage = %q{http://github.com/mwunsch/prism}
45
+ s.post_install_message = %q{
46
+ hMachine is now called Prism.
47
+
48
+ Run `gem install prism` to download it.
49
+
50
+ http://github.com/mwunsch/prism
51
+
52
+ }
94
53
  s.rdoc_options = ["--charset=UTF-8"]
95
54
  s.require_paths = ["lib"]
96
55
  s.rubygems_version = %q{1.3.6}
97
- s.summary = %q{Ruby microformat parser and HTML toolkit}
98
- s.test_files = [
99
- "test/hmachine_test.rb",
100
- "test/microformat/adr_test.rb",
101
- "test/microformat/geo_test.rb",
102
- "test/microformat/hcard_test.rb",
103
- "test/microformat/rellicense_test.rb",
104
- "test/microformat/reltag_test.rb",
105
- "test/microformat/votelinks_test.rb",
106
- "test/microformat/xfn_test.rb",
107
- "test/microformat/xmdp_test.rb",
108
- "test/microformat/xoxo_test.rb",
109
- "test/microformat_test.rb",
110
- "test/pattern/date_time_test.rb",
111
- "test/pattern/value_class_test.rb",
112
- "test/pattern_test.rb",
113
- "test/posh/anchor_test.rb",
114
- "test/posh/base_test.rb",
115
- "test/posh/definition_list_test.rb",
116
- "test/test_helper.rb"
117
- ]
56
+ s.summary = %q{This project is now called Prism. `gem install prism`}
118
57
 
119
58
  if s.respond_to? :specification_version then
120
59
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
121
60
  s.specification_version = 3
122
61
 
123
62
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
124
- s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
125
63
  else
126
- s.add_dependency(%q<nokogiri>, [">= 0"])
127
64
  end
128
65
  else
129
- s.add_dependency(%q<nokogiri>, [">= 0"])
130
66
  end
131
67
  end
132
68
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Wunsch
@@ -14,39 +14,22 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-02-24 00:00:00 -05:00
18
- default_executable: hmachine
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: nokogiri
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
30
- type: :runtime
31
- version_requirements: *id001
32
- description: A Ruby microformat parser and HTML toolkit powered by Nokogiri
17
+ date: 2010-02-25 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: This project has been renamed to Prism. `gem install prism`
33
22
  email:
34
23
  - mark@markwunsch.com
35
- executables:
36
- - hmachine
24
+ executables: []
25
+
37
26
  extensions: []
38
27
 
39
28
  extra_rdoc_files:
40
29
  - LICENSE
41
30
  - README.md
42
31
  files:
43
- - .gitignore
44
- - Gemfile
45
- - Gemfile.lock
46
- - LICENSE
47
32
  - README.md
48
- - Rakefile
49
- - bin/hmachine
50
33
  - hmachine.gemspec
51
34
  - lib/hmachine.rb
52
35
  - lib/hmachine/microformat.rb
@@ -69,52 +52,19 @@ files:
69
52
  - lib/hmachine/posh/anchor.rb
70
53
  - lib/hmachine/posh/base.rb
71
54
  - lib/hmachine/posh/definition_list.rb
72
- - test/fixtures/hcard/commercenet.html
73
- - test/fixtures/hcard/geo.html
74
- - test/fixtures/huffduffer.html
75
- - test/fixtures/likeorhate.html
76
- - test/fixtures/rel_license.html
77
- - test/fixtures/test-fixture/hcard/hcard1.html
78
- - test/fixtures/test-fixture/hcard/hcard11.html
79
- - test/fixtures/test-fixture/hcard/hcard12.html
80
- - test/fixtures/test-fixture/hcard/hcard17.html
81
- - test/fixtures/test-fixture/hcard/hcard2.html
82
- - test/fixtures/test-fixture/hcard/hcard3.html
83
- - test/fixtures/test-fixture/hcard/hcard4.html
84
- - test/fixtures/test-fixture/hcard/hcard5.html
85
- - test/fixtures/test-fixture/hcard/hcard6.html
86
- - test/fixtures/test-fixture/hcard/hcard7.html
87
- - test/fixtures/test-fixture/hcard/hcard8.html
88
- - test/fixtures/test-fixture/hcard/hcard9.html
89
- - test/fixtures/test-fixture/hcard/hcard99.html
90
- - test/fixtures/test-fixture/value-class-date-time/value-dt-test-YYYY-MM-DD--HH-MM.html
91
- - test/fixtures/test-fixture/value-class-date-time/value-dt-test-abbr-YYYY-MM-DD--HH-MM.html
92
- - test/fixtures/xfn.html
93
- - test/fixtures/xmdp.html
94
- - test/fixtures/xoxo.html
95
- - test/hmachine_test.rb
96
- - test/microformat/adr_test.rb
97
- - test/microformat/geo_test.rb
98
- - test/microformat/hcard_test.rb
99
- - test/microformat/rellicense_test.rb
100
- - test/microformat/reltag_test.rb
101
- - test/microformat/votelinks_test.rb
102
- - test/microformat/xfn_test.rb
103
- - test/microformat/xmdp_test.rb
104
- - test/microformat/xoxo_test.rb
105
- - test/microformat_test.rb
106
- - test/pattern/date_time_test.rb
107
- - test/pattern/value_class_test.rb
108
- - test/pattern_test.rb
109
- - test/posh/anchor_test.rb
110
- - test/posh/base_test.rb
111
- - test/posh/definition_list_test.rb
112
- - test/test_helper.rb
55
+ - LICENSE
113
56
  has_rdoc: true
114
- homepage: http://github.com/mwunsch/hmachine
57
+ homepage: http://github.com/mwunsch/prism
115
58
  licenses: []
116
59
 
117
- post_install_message:
60
+ post_install_message: |+
61
+
62
+ hMachine is now called Prism.
63
+
64
+ Run `gem install prism` to download it.
65
+
66
+ http://github.com/mwunsch/prism
67
+
118
68
  rdoc_options:
119
69
  - --charset=UTF-8
120
70
  require_paths:
@@ -139,23 +89,6 @@ rubyforge_project:
139
89
  rubygems_version: 1.3.6
140
90
  signing_key:
141
91
  specification_version: 3
142
- summary: Ruby microformat parser and HTML toolkit
143
- test_files:
144
- - test/hmachine_test.rb
145
- - test/microformat/adr_test.rb
146
- - test/microformat/geo_test.rb
147
- - test/microformat/hcard_test.rb
148
- - test/microformat/rellicense_test.rb
149
- - test/microformat/reltag_test.rb
150
- - test/microformat/votelinks_test.rb
151
- - test/microformat/xfn_test.rb
152
- - test/microformat/xmdp_test.rb
153
- - test/microformat/xoxo_test.rb
154
- - test/microformat_test.rb
155
- - test/pattern/date_time_test.rb
156
- - test/pattern/value_class_test.rb
157
- - test/pattern_test.rb
158
- - test/posh/anchor_test.rb
159
- - test/posh/base_test.rb
160
- - test/posh/definition_list_test.rb
161
- - test/test_helper.rb
92
+ summary: This project is now called Prism. `gem install prism`
93
+ test_files: []
94
+
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- pkg/
2
- doc/
3
- .bundle/
data/Gemfile DELETED
@@ -1,11 +0,0 @@
1
- source :gemcutter
2
-
3
- gem 'nokogiri'
4
-
5
- group :test do
6
- gem 'rake'
7
- gem 'contest'
8
- gem 'redgreen'
9
- gem 'fakeweb'
10
- gem 'jeweler'
11
- end
data/Gemfile.lock DELETED
@@ -1,51 +0,0 @@
1
- ---
2
- dependencies:
3
- fakeweb:
4
- group:
5
- - :test
6
- version: ">= 0"
7
- rake:
8
- group:
9
- - :test
10
- version: ">= 0"
11
- contest:
12
- group:
13
- - :test
14
- version: ">= 0"
15
- jeweler:
16
- group:
17
- - :test
18
- version: ">= 0"
19
- redgreen:
20
- group:
21
- - :test
22
- version: ">= 0"
23
- nokogiri:
24
- group:
25
- - :default
26
- version: ">= 0"
27
- specs:
28
- - nokogiri:
29
- version: 1.4.1
30
- - json_pure:
31
- version: 1.2.0
32
- - git:
33
- version: 1.2.5
34
- - redgreen:
35
- version: 1.2.2
36
- - rubyforge:
37
- version: 2.0.3
38
- - rake:
39
- version: 0.8.7
40
- - gemcutter:
41
- version: 0.3.0
42
- - jeweler:
43
- version: 1.4.0
44
- - contest:
45
- version: 0.1.2
46
- - fakeweb:
47
- version: 1.2.8
48
- hash: a411a98d29121a4b1d05b9fbe457c6e068325a09
49
- sources:
50
- - Rubygems:
51
- uri: http://gemcutter.org