codemerger 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.Gemfile.swp ADDED
Binary file
Binary file
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ .redcar/*
5
+ *.swo
6
+ *.swp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in codemerger.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require 'bundler'
2
+ task :fake do
3
+
4
+ end
5
+ Bundler::GemHelper.install_tasks :name => 'codemerger'
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "codemerger/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "codemerger"
7
+ s.version = Codemerger::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Rodrigo Urubatan"]
10
+ s.email = ["rodrigo@urubatan.com.br"]
11
+ s.homepage = "http://www.urubatan.com.br"
12
+ s.summary = %q{Used to create blog posts and tecnical articles that need code samples, the code samples will be taken from the actual source code file instead of a copy paste approach}
13
+ s.description = %q{Used to create blog posts and tecnical articles that need code samples, the code samples will be taken from the actual source code file instead of a copy paste approach}
14
+
15
+ s.rubyforge_project = "codemerger"
16
+ s.add_dependency 'maruku'
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+ end
@@ -0,0 +1,40 @@
1
+ namespace "codemerger" do
2
+ desc "Merge all the markdown files and the source files to create the output/post.html file"
3
+ task :merge do
4
+ require 'fileutils'
5
+ FileUtils.rm_rf 'output'
6
+ FileUtils.mkdir_p 'output'
7
+ in_files = Dir.glob("*.{markdown,html}")
8
+ in_files.sort.each do |file|
9
+ in_lines = IO.readlines(file).to_s
10
+ in_lines = Maruku.new(in_lines).to_html if file =~ /markdown$/
11
+ out_fname = file[/^.*\./]
12
+ out_f = File.new('output/#{out_fname}html', 'w')
13
+ out_f << in_lines.gsub(/(\{\{[\/a-zA-Z0-9_]+(?>\.[a-zA-Z0-9]{2,}){0,3}\}\})/) do |f_name_match|
14
+ f_name = f_name_match[2..-3]
15
+ ext = f_name[/(\.[a-zA-Z]+)/]
16
+ lang_str = case ext
17
+ when ".yml"; "lang=\"yaml\""
18
+ when ".xml"; "lang=\"xml\""
19
+ when ".html"; "lang=\"xml\""
20
+ when ".rb"; "lang=\"ruby\""
21
+ when ".java"; "lang=\"java\""
22
+ when ".erb"; "lang=\"ruby\""
23
+ when ".xsl"; "lang=\"xml\""
24
+ when ".css"; "lang=\"css\""
25
+ when ".js"; "lang=\"javascript\""
26
+ when ".xhtml"; "lang=\"xml\""
27
+ when nil; "lang=\"ruby\""
28
+ else; ""
29
+ end
30
+
31
+ <<_EOF_
32
+ <b>#{f_name}</b>
33
+ <pre line="1" #{lang_str}>
34
+ #{IO.readlines(f_name).to_s}
35
+ </pre>
36
+ _EOF_
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ module Codemerger
2
+ VERSION = "0.0.6"
3
+ end
data/lib/codemerger.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Codemerger
2
+ # Your code goes here...
3
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: codemerger
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 6
10
+ version: 0.0.6
11
+ platform: ruby
12
+ authors:
13
+ - Rodrigo Urubatan
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-13 00:00:00 -02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: maruku
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: Used to create blog posts and tecnical articles that need code samples, the code samples will be taken from the actual source code file instead of a copy paste approach
36
+ email:
37
+ - rodrigo@urubatan.com.br
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .Gemfile.swp
46
+ - .codemerger.gemspec.swp
47
+ - .gitignore
48
+ - Gemfile
49
+ - Rakefile
50
+ - codemerger.gemspec
51
+ - lib/codemerger.rb
52
+ - lib/codemerger/rake_tasks.rb
53
+ - lib/codemerger/version.rb
54
+ has_rdoc: true
55
+ homepage: http://www.urubatan.com.br
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ hash: 3
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 3
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ requirements: []
82
+
83
+ rubyforge_project: codemerger
84
+ rubygems_version: 1.3.7
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Used to create blog posts and tecnical articles that need code samples, the code samples will be taken from the actual source code file instead of a copy paste approach
88
+ test_files: []
89
+