mdown_handler 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ Manifest
2
+ NOTICE.txt
3
+ Rakefile
4
+ VERSION
5
+ config/dependencies.rb
6
+ config/gem.yml
7
+ lib/mdown_handler.rb
8
+ scriptx/console
9
+ scriptx/rebuild
10
+ tasks/echoe.rake
11
+ tasks/validate_db.rake
12
+ test/test.rb
@@ -0,0 +1,8 @@
1
+ IMPORTANT NOTE:
2
+ ===============
3
+
4
+ While this software is accessible to the public it is not "released in the hope someone might
5
+ find it useful." You are welcome to use and to modify it any way you like.
6
+
7
+ That means you might download and use it. Just don't expect it to work ;) And if it works
8
+ it might break between revisions.
@@ -0,0 +1,23 @@
1
+ task :default => :test
2
+
3
+ task :test do
4
+ sh "ruby test/test.rb"
5
+ end
6
+
7
+ task :rcov do
8
+ sh "rcov -T -o coverage -x ruby/.*/gems test/test.rb"
9
+ end
10
+
11
+ task :rebuild => :test do
12
+ sh "rake -f tasks/echoe.rake rebuild"
13
+ end
14
+
15
+ task :manifest do
16
+ sh "rake -f tasks/echoe.rake manifest"
17
+ end
18
+
19
+ SKIP_ECHOE=true
20
+
21
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each do |ext|
22
+ load ext
23
+ end
data/VERSION ADDED
@@ -0,0 +1,2 @@
1
+ 0.1
2
+
@@ -0,0 +1,9 @@
1
+ #
2
+ # require all dependent gems
3
+ require 'nokogiri'
4
+
5
+ require 'etest'
6
+ require 'sanitize'
7
+ require 'htmlentities'
8
+ require 'json'
9
+
@@ -0,0 +1,11 @@
1
+ description: "MdownHandler: markdown views out of the box"
2
+ url: http://github.com/pboy/mdown
3
+ author: pboy
4
+ email: eno-pboy@open-lab.org
5
+ ignore_pattern:
6
+ - "tmp/*"
7
+ - "test/tmp/*"
8
+ - "test/*.sqlite3*"
9
+ - "**/.*"
10
+ - "*.tmproj"
11
+
@@ -0,0 +1,15 @@
1
+ if !defined?(ActionView)
2
+ raise "All of this only makes sense within rails"
3
+ end
4
+
5
+ require "erb"
6
+ require "rdiscount"
7
+
8
+ class ActionView::MdownHandler < ActionView::TemplateHandler
9
+ def render(template, local_assigns)
10
+ txt = ERB.new(template.source).result(@view.send(:binding))
11
+ RDiscount.new(txt).to_html
12
+ end
13
+ end
14
+
15
+ ActionView::Template.register_template_handler :mdown, ActionView::MdownHandler
@@ -0,0 +1,45 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{mdown_handler}
5
+ s.version = "0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["pboy"]
9
+ s.date = %q{2010-04-01}
10
+ s.description = %q{MdownHandler: markdown views out of the box}
11
+ s.email = %q{eno-pboy@open-lab.org}
12
+ s.extra_rdoc_files = ["lib/mdown_handler.rb", "tasks/echoe.rake", "tasks/validate_db.rake"]
13
+ s.files = ["Manifest", "NOTICE.txt", "Rakefile", "VERSION", "config/dependencies.rb", "config/gem.yml", "lib/mdown_handler.rb", "mdown_handler.gemspec", "scriptx/console", "scriptx/rebuild", "tasks/echoe.rake", "tasks/validate_db.rake", "test/test.rb"]
14
+ s.homepage = %q{http://github.com/pboy/mdown}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Mdown_handler"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{mdown_handler}
18
+ s.rubygems_version = %q{1.3.5}
19
+ s.summary = %q{MdownHandler: markdown views out of the box}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
+ s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
27
+ s.add_runtime_dependency(%q<etest>, [">= 0"])
28
+ s.add_runtime_dependency(%q<sanitize>, [">= 0"])
29
+ s.add_runtime_dependency(%q<htmlentities>, [">= 0"])
30
+ s.add_runtime_dependency(%q<json>, [">= 0"])
31
+ else
32
+ s.add_dependency(%q<nokogiri>, [">= 0"])
33
+ s.add_dependency(%q<etest>, [">= 0"])
34
+ s.add_dependency(%q<sanitize>, [">= 0"])
35
+ s.add_dependency(%q<htmlentities>, [">= 0"])
36
+ s.add_dependency(%q<json>, [">= 0"])
37
+ end
38
+ else
39
+ s.add_dependency(%q<nokogiri>, [">= 0"])
40
+ s.add_dependency(%q<etest>, [">= 0"])
41
+ s.add_dependency(%q<sanitize>, [">= 0"])
42
+ s.add_dependency(%q<htmlentities>, [">= 0"])
43
+ s.add_dependency(%q<json>, [">= 0"])
44
+ end
45
+ end
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Start a console that initializes the gem
4
+ #
5
+ require "irb"
6
+ require "rubygems"
7
+
8
+ begin
9
+ require 'wirble'
10
+ Wirble.init
11
+ Wirble.colorize
12
+ rescue LoadError
13
+ STDERR.puts "To enable colorized and tab completed run 'gem install wirble'"
14
+ end
15
+
16
+ $: << "#{File.dirname(__FILE__)}/../lib"
17
+ require "#{File.dirname(__FILE__)}/../init.rb"
18
+
19
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ rake default build_gemspec package || exit 1
3
+ echo "============================================="
4
+ echo "I built the gem for you. To upload, run "
5
+ echo
6
+ echo "gem push $(ls -d pkg/*.gem | tail -n 1)"
7
+
@@ -0,0 +1,52 @@
1
+ unless defined?(SKIP_ECHOE)
2
+
3
+ #
4
+ # GEM settings
5
+ #
6
+ GEM_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..")
7
+
8
+ if gem_config = YAML.load(File.read("#{GEM_ROOT}/config/gem.yml"))
9
+ require 'echoe'
10
+
11
+ #
12
+ # a dependency reader
13
+ module Dependency
14
+ @@dependencies = []
15
+
16
+ def self.require(file)
17
+ @@dependencies << file
18
+ end
19
+
20
+ def self.load
21
+ eval File.read("#{GEM_ROOT}/config/dependencies.rb"), binding
22
+ @@dependencies
23
+ end
24
+ end
25
+
26
+ Echoe.new(File.basename(GEM_ROOT), File.read("#{GEM_ROOT}/VERSION")) do |p|
27
+ gem_config.each do |k,v|
28
+ p.send "#{k}=",v
29
+ end
30
+
31
+ p.runtime_dependencies = Dependency.load
32
+ end
33
+
34
+ desc "Rebuild and install the gem"
35
+ task :rebuild => %w(manifest build_gemspec package) do
36
+ gem = Dir.glob("pkg/*.gem").sort_by do |filename|
37
+ File.new(filename).mtime
38
+ end.last
39
+
40
+ puts "============================================="
41
+ puts "Installing gem..."
42
+
43
+ system "gem install #{gem} --no-test --no-ri --no-rdoc > /dev/null 2>&1"
44
+
45
+ puts ""
46
+ puts "I built and installed the gem for you. To upload, run "
47
+ puts
48
+ puts " gem push #{gem}"
49
+ end
50
+ end
51
+
52
+ end
@@ -0,0 +1,14 @@
1
+ namespace :db do
2
+ desc "Validate all models in the database"
3
+ task :validate => :environment do
4
+ ActiveRecord::Validate.all
5
+ end
6
+
7
+ namespace :validate do
8
+ desc "Purge all invalid models form the database"
9
+ task :purge => :environment do
10
+ ActiveRecord::Validate.purge
11
+ end
12
+ end
13
+
14
+ end
@@ -0,0 +1,31 @@
1
+ DIRNAME = File.expand_path File.dirname(__FILE__)
2
+ Dir.chdir(DIRNAME)
3
+
4
+ require "rubygems"
5
+ require "etest"
6
+ require "active_support"
7
+ require "action_view"
8
+
9
+ $:.push "#{DIRNAME}/../lib"
10
+
11
+ require "mdown_handler"
12
+
13
+ # ---------------------------------------------------------------------
14
+
15
+ require 'mocha'
16
+ require 'ruby-debug'
17
+
18
+ begin
19
+ require 'minitest-rg'
20
+ rescue MissingSourceFile
21
+ STDERR.puts "'gem install minitest-rg' gives you redgreen minitests"
22
+ require 'minitest/unit'
23
+ end
24
+
25
+ #
26
+ # run tests
27
+ dlog "etest #{::Etest::VERSION}"
28
+
29
+ Etest.autorun if defined?(::Etest)
30
+ # MiniTest::Unit.autorun
31
+
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mdown_handler
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.1"
5
+ platform: ruby
6
+ authors:
7
+ - pboy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-04-01 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: nokogiri
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: etest
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: sanitize
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: htmlentities
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: json
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ description: "MdownHandler: markdown views out of the box"
66
+ email: eno-pboy@open-lab.org
67
+ executables: []
68
+
69
+ extensions: []
70
+
71
+ extra_rdoc_files:
72
+ - lib/mdown_handler.rb
73
+ - tasks/echoe.rake
74
+ - tasks/validate_db.rake
75
+ files:
76
+ - Manifest
77
+ - NOTICE.txt
78
+ - Rakefile
79
+ - VERSION
80
+ - config/dependencies.rb
81
+ - config/gem.yml
82
+ - lib/mdown_handler.rb
83
+ - mdown_handler.gemspec
84
+ - scriptx/console
85
+ - scriptx/rebuild
86
+ - tasks/echoe.rake
87
+ - tasks/validate_db.rake
88
+ - test/test.rb
89
+ has_rdoc: true
90
+ homepage: http://github.com/pboy/mdown
91
+ licenses: []
92
+
93
+ post_install_message:
94
+ rdoc_options:
95
+ - --line-numbers
96
+ - --inline-source
97
+ - --title
98
+ - Mdown_handler
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: "0"
106
+ version:
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: "1.2"
112
+ version:
113
+ requirements: []
114
+
115
+ rubyforge_project: mdown_handler
116
+ rubygems_version: 1.3.5
117
+ signing_key:
118
+ specification_version: 3
119
+ summary: "MdownHandler: markdown views out of the box"
120
+ test_files: []
121
+