green_monkey 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -5,4 +5,5 @@ rvm:
5
5
  gemfile:
6
6
  - Gemfile.rails-3.0.11
7
7
  - Gemfile.rails-3.1.3
8
+ - Gemfile.rails-3.2
8
9
  - Gemfile.haml-edge
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source :rubygems
2
2
  gemspec
3
+ gem "rails", "3.2.0.rc2"
3
4
  gem 'chronic_duration', git: 'git://github.com/Paxa/chronic_duration.git', ref: '8c0d0e101b'
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- green_monkey (0.1)
12
+ green_monkey (0.1.1)
13
13
  chronic_duration
14
14
  haml (>= 3.1.0)
15
15
  mida (>= 0.3.3)
@@ -18,43 +18,43 @@ PATH
18
18
  GEM
19
19
  remote: http://rubygems.org/
20
20
  specs:
21
- actionmailer (3.1.3)
22
- actionpack (= 3.1.3)
21
+ actionmailer (3.2.0.rc2)
22
+ actionpack (= 3.2.0.rc2)
23
23
  mail (~> 2.3.0)
24
- actionpack (3.1.3)
25
- activemodel (= 3.1.3)
26
- activesupport (= 3.1.3)
24
+ actionpack (3.2.0.rc2)
25
+ activemodel (= 3.2.0.rc2)
26
+ activesupport (= 3.2.0.rc2)
27
27
  builder (~> 3.0.0)
28
28
  erubis (~> 2.7.0)
29
- i18n (~> 0.6)
30
- rack (~> 1.3.5)
29
+ journey (~> 1.0.0.rc1)
30
+ rack (~> 1.4.0)
31
31
  rack-cache (~> 1.1)
32
- rack-mount (~> 0.8.2)
33
32
  rack-test (~> 0.6.1)
34
- sprockets (~> 2.0.3)
35
- activemodel (3.1.3)
36
- activesupport (= 3.1.3)
33
+ sprockets (~> 2.1.2)
34
+ activemodel (3.2.0.rc2)
35
+ activesupport (= 3.2.0.rc2)
37
36
  builder (~> 3.0.0)
38
- i18n (~> 0.6)
39
- activerecord (3.1.3)
40
- activemodel (= 3.1.3)
41
- activesupport (= 3.1.3)
42
- arel (~> 2.2.1)
37
+ activerecord (3.2.0.rc2)
38
+ activemodel (= 3.2.0.rc2)
39
+ activesupport (= 3.2.0.rc2)
40
+ arel (~> 3.0.0.rc1)
43
41
  tzinfo (~> 0.3.29)
44
- activeresource (3.1.3)
45
- activemodel (= 3.1.3)
46
- activesupport (= 3.1.3)
47
- activesupport (3.1.3)
42
+ activeresource (3.2.0.rc2)
43
+ activemodel (= 3.2.0.rc2)
44
+ activesupport (= 3.2.0.rc2)
45
+ activesupport (3.2.0.rc2)
46
+ i18n (~> 0.6)
48
47
  multi_json (~> 1.0)
49
- arel (2.2.1)
48
+ arel (3.0.0)
50
49
  blankslate (2.1.2.4)
51
50
  builder (3.0.0)
52
51
  diff-lcs (1.1.3)
53
52
  erubis (2.7.0)
54
- haml (3.1.3)
53
+ haml (3.1.4)
55
54
  hike (1.2.1)
56
55
  i18n (0.6.0)
57
- json (1.6.1)
56
+ journey (1.0.0)
57
+ json (1.6.4)
58
58
  mail (2.3.0)
59
59
  i18n (>= 0.4.0)
60
60
  mime-types (~> 1.16)
@@ -63,55 +63,53 @@ GEM
63
63
  blankslate
64
64
  nokogiri (>= 1.5)
65
65
  mime-types (1.17.2)
66
- multi_json (1.0.3)
66
+ multi_json (1.0.4)
67
67
  nokogiri (1.5.0)
68
68
  numerizer (0.1.1)
69
69
  polyglot (0.3.3)
70
- rack (1.3.5)
70
+ rack (1.4.0)
71
71
  rack-cache (1.1)
72
72
  rack (>= 0.4)
73
- rack-mount (0.8.3)
74
- rack (>= 1.0.0)
75
73
  rack-ssl (1.3.2)
76
74
  rack
77
75
  rack-test (0.6.1)
78
76
  rack (>= 1.0)
79
- rails (3.1.3)
80
- actionmailer (= 3.1.3)
81
- actionpack (= 3.1.3)
82
- activerecord (= 3.1.3)
83
- activeresource (= 3.1.3)
84
- activesupport (= 3.1.3)
77
+ rails (3.2.0.rc2)
78
+ actionmailer (= 3.2.0.rc2)
79
+ actionpack (= 3.2.0.rc2)
80
+ activerecord (= 3.2.0.rc2)
81
+ activeresource (= 3.2.0.rc2)
82
+ activesupport (= 3.2.0.rc2)
85
83
  bundler (~> 1.0)
86
- railties (= 3.1.3)
87
- railties (3.1.3)
88
- actionpack (= 3.1.3)
89
- activesupport (= 3.1.3)
84
+ railties (= 3.2.0.rc2)
85
+ railties (3.2.0.rc2)
86
+ actionpack (= 3.2.0.rc2)
87
+ activesupport (= 3.2.0.rc2)
90
88
  rack-ssl (~> 1.3.2)
91
89
  rake (>= 0.8.7)
92
90
  rdoc (~> 3.4)
93
91
  thor (~> 0.14.6)
94
92
  rake (0.9.2.2)
95
- rdoc (3.11)
93
+ rdoc (3.12)
96
94
  json (~> 1.4)
97
- rspec (2.7.0)
98
- rspec-core (~> 2.7.0)
99
- rspec-expectations (~> 2.7.0)
100
- rspec-mocks (~> 2.7.0)
101
- rspec-core (2.7.1)
102
- rspec-expectations (2.7.0)
95
+ rspec (2.8.0)
96
+ rspec-core (~> 2.8.0)
97
+ rspec-expectations (~> 2.8.0)
98
+ rspec-mocks (~> 2.8.0)
99
+ rspec-core (2.8.0)
100
+ rspec-expectations (2.8.0)
103
101
  diff-lcs (~> 1.1.2)
104
- rspec-mocks (2.7.0)
105
- rspec-rails (2.7.0)
106
- actionpack (~> 3.0)
107
- activesupport (~> 3.0)
108
- railties (~> 3.0)
109
- rspec (~> 2.7.0)
110
- sprockets (2.0.3)
102
+ rspec-mocks (2.8.0)
103
+ rspec-rails (2.8.1)
104
+ actionpack (>= 3.0)
105
+ activesupport (>= 3.0)
106
+ railties (>= 3.0)
107
+ rspec (~> 2.8.0)
108
+ sprockets (2.1.2)
111
109
  hike (~> 1.2)
112
110
  rack (~> 1.0)
113
111
  tilt (~> 1.1, != 1.3.0)
114
- sqlite3 (1.3.4)
112
+ sqlite3 (1.3.5)
115
113
  thor (0.14.6)
116
114
  tilt (1.3.3)
117
115
  treetop (1.4.10)
@@ -126,6 +124,7 @@ DEPENDENCIES
126
124
  bundler (>= 1.0.0)
127
125
  chronic_duration!
128
126
  green_monkey!
127
+ rails (= 3.2.0.rc2)
129
128
  rspec (>= 2.7.0)
130
129
  rspec-rails
131
130
  sqlite3
data/Gemfile.rails-3.2 ADDED
@@ -0,0 +1,4 @@
1
+ source :rubygems
2
+ gemspec
3
+ gem "rails", "3.2.0.rc2"
4
+ gem 'chronic_duration', git: 'git://github.com/Paxa/chronic_duration.git', ref: '8c0d0e101b'
data/Rakefile CHANGED
@@ -5,11 +5,3 @@ task :default => :spec
5
5
  desc "Run Specs"
6
6
  require 'rspec/core/rake_task'
7
7
  RSpec::Core::RakeTask.new(:spec)
8
-
9
- html5 microdata tags easy with green_monkey
10
-
11
- I just launched <a href="http://">plugin saving time and let you make nice haml templates</a>
12
-
13
- 904a3032
14
- Unlock Code = 39329878
15
- Flash Code= 62867076
data/green_monkey.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "green_monkey"
5
- s.version = '0.1'
5
+ s.version = '0.1.1'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Pavel Evstigneev"]
8
8
  s.email = ["pavel.evst@gmail.com"]
@@ -11,7 +11,7 @@ module ActionView::Helpers::TagHelper
11
11
  attrs << key.to_s if value
12
12
  elsif !value.nil?
13
13
  final_value = value.is_a?(Array) ? value.join(" ") : value
14
- final_value = html_escape(final_value) if escape
14
+ final_value = ERB::Util.html_escape(final_value) if escape
15
15
  attrs << %(#{key}="#{final_value}")
16
16
  end
17
17
  end
@@ -3,8 +3,11 @@
3
3
  module GreenMonkey
4
4
  module ModelHelpers
5
5
  extend ActiveSupport::Concern
6
-
7
-
6
+
7
+ def html_schema_type
8
+ self.class.html_schema_type
9
+ end
10
+
8
11
  module ClassMethods
9
12
  def html_schema_type(value = nil)
10
13
  return @html_schema_type unless value
@@ -19,11 +22,5 @@ module GreenMonkey
19
22
  @html_schema_type = value
20
23
  end
21
24
  end
22
-
23
- module InstanceMethods
24
- def html_schema_type
25
- self.class.html_schema_type
26
- end
27
- end
28
25
  end
29
26
  end
@@ -25,6 +25,19 @@ def Mida(itemtype, addition = nil)
25
25
  end
26
26
  end
27
27
 
28
+ class Mida::Vocabulary
29
+
30
+ # this dutty hack fix some strange bug then
31
+ # Mida::Vocabulary.find "http://schema.org/BlogPosting"
32
+ # => Mida::SchemaOrg::Blog
33
+ def self.find(itemtype)
34
+ @vocabularies.sort_by {|v| v.itemtype ? v.itemtype.source.size : 0 }.reverse.each do |vocabulary|
35
+ if ((itemtype || "") =~ vocabulary.itemtype) then return vocabulary end
36
+ end
37
+ nil
38
+ end
39
+ end
40
+
28
41
  require "uri"
29
42
 
30
43
  module URI
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+ require "pathname"
3
+
4
+ $t = 0
5
+
6
+ describe "ActionView hacks" do
7
+ include TestInlineRenderer
8
+
9
+ it "should works with stylesheet_link_tag" do
10
+ tpl = "= stylesheet_link_tag 'application'"
11
+ str = render_haml(tpl)
12
+
13
+ str.should =~ %r{link.+href="/stylesheets/application.css.*"}
14
+ end
15
+ end
data/spec/haml_spec.rb CHANGED
@@ -4,17 +4,7 @@ require "pathname"
4
4
  $t = 0
5
5
 
6
6
  describe "Haml generation" do
7
- def render_file(file, options = {})
8
- ActionController::Base.new.render_to_string(file: file, locals: options)
9
- end
10
-
11
- def render_haml(template, options = {})
12
- $t += 1
13
- file = File.expand_path(File.dirname(__FILE__) + "/../tmp/#{$t}.haml")
14
- File.delete(file) if File.exist?(file)
15
- File.open(file, 'w+') {|f| f.write template }
16
- render_file(file, options)
17
- end
7
+ include TestInlineRenderer
18
8
 
19
9
  it "should render itemscope as a boolean attribute" do
20
10
  render_haml("%b{:itemscope => true}").should =~ /<b\s+itemscope\s*>/
@@ -36,7 +26,7 @@ describe "Haml generation" do
36
26
 
37
27
  it "should generate valid microdata layout" do
38
28
  post = Post.create(title: "Post 1", body: "Some text")
39
- tpl = Pathname.new(__FILE__).dirname.join("post.haml")
29
+ tpl = Pathname.new(__FILE__).dirname.join("post")
40
30
  str = render_file(tpl, post: post)
41
31
 
42
32
  doc = Mida::Document.new(str, "http://example.com/")
data/spec/spec_helper.rb CHANGED
@@ -9,14 +9,16 @@ require 'rails/generators/test_case'
9
9
 
10
10
  require "green_monkey"
11
11
 
12
- class TestApp < Rails::Application
13
- config.root = File.dirname(__FILE__)
14
- config.active_support.deprecation :log
15
- #config.logger = Logger.new(STDOUT)
16
- config.log_level = :error
12
+ module TestApp
13
+ class Application < Rails::Application
14
+ config.root = File.dirname(__FILE__)
15
+ config.active_support.deprecation :log
16
+ #config.logger = Logger.new(STDOUT)
17
+ config.log_level = :error
18
+ end
17
19
  end
18
20
 
19
- Rails.application = TestApp
21
+ Rails.application = TestApp::Application
20
22
 
21
23
  module Rails
22
24
  def self.root
@@ -25,7 +27,7 @@ module Rails
25
27
  end
26
28
 
27
29
  Rails.application.config.root = Rails.root
28
- TestApp.initialize!
30
+ TestApp::Application.initialize!
29
31
 
30
32
  ActiveRecord::Schema.define(:version => 20111023054000) do
31
33
  create_table "posts" do |t|
@@ -52,3 +54,17 @@ end
52
54
  class User < ActiveRecord::Base
53
55
  html_schema_type "http://example.com/User"
54
56
  end
57
+
58
+ module TestInlineRenderer
59
+ def render_file(file, options = {})
60
+ ActionController::Base.new.render_to_string(file: file, locals: options, handlers: [:haml])
61
+ end
62
+
63
+ def render_haml(template, options = {})
64
+ $t += 1
65
+ file = File.expand_path(File.dirname(__FILE__) + "/../tmp/#{$t}.haml")
66
+ File.delete(file) if File.exist?(file)
67
+ File.open(file, 'w+') {|f| f.write template }
68
+ render_file(file.sub(/.haml$/, ''), options)
69
+ end
70
+ end
@@ -0,0 +1,2 @@
1
+ body
2
+ font-size: 0.95em
@@ -0,0 +1,3 @@
1
+ TestApp::Application.configure do
2
+ config.active_support.deprecation = :stderr
3
+ end
@@ -0,0 +1,3 @@
1
+ TestApp::Application.configure do
2
+ config.active_support.deprecation = :stderr
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: green_monkey
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-30 00:00:00.000000000 Z
12
+ date: 2012-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2152695500 !ruby/object:Gem::Requirement
16
+ requirement: &2162334360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2152695500
24
+ version_requirements: *2162334360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: haml
27
- requirement: &2152679260 !ruby/object:Gem::Requirement
27
+ requirement: &2162331100 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2152679260
35
+ version_requirements: *2162331100
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mida
38
- requirement: &2152675760 !ruby/object:Gem::Requirement
38
+ requirement: &2162329080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.3.3
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2152675760
46
+ version_requirements: *2162329080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: chronic_duration
49
- requirement: &2152674300 !ruby/object:Gem::Requirement
49
+ requirement: &2162328080 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2152674300
57
+ version_requirements: *2162328080
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &2152664740 !ruby/object:Gem::Requirement
60
+ requirement: &2162326060 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2152664740
68
+ version_requirements: *2162326060
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &2152648240 !ruby/object:Gem::Requirement
71
+ requirement: &2162325220 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 2.7.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2152648240
79
+ version_requirements: *2162325220
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec-rails
82
- requirement: &2152639820 !ruby/object:Gem::Requirement
82
+ requirement: &2162324800 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2152639820
90
+ version_requirements: *2162324800
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: sqlite3
93
- requirement: &2152633580 !ruby/object:Gem::Requirement
93
+ requirement: &2162324040 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2152633580
101
+ version_requirements: *2162324040
102
102
  description: It hacks Rails and Haml
103
103
  email:
104
104
  - pavel.evst@gmail.com
@@ -114,6 +114,7 @@ files:
114
114
  - Gemfile.lock
115
115
  - Gemfile.rails-3.0.11
116
116
  - Gemfile.rails-3.1.3
117
+ - Gemfile.rails-3.2
117
118
  - README.md
118
119
  - Rakefile
119
120
  - green_monkey.gemspec
@@ -124,13 +125,16 @@ files:
124
125
  - lib/green_monkey/ext/mida.rb
125
126
  - lib/green_monkey/ext/view_helper.rb
126
127
  - lib/green_monkey/railtie.rb
128
+ - spec/action_view_spec.rb
127
129
  - spec/haml_spec.rb
128
130
  - spec/mida_spec.rb
129
131
  - spec/model_spec.rb
130
132
  - spec/post.haml
131
133
  - spec/spec_helper.rb
134
+ - tmp/rails/assets/stylesheets/application.sass
132
135
  - tmp/rails/config/database.yml
133
136
  - tmp/rails/config/environments/development.rb
137
+ - tmp/rails/config/environments/test.rb
134
138
  homepage: https://github.com/paxa/green_monkey
135
139
  licenses: []
136
140
  post_install_message: