ruby-beamer 0.0.1

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.
@@ -0,0 +1,4 @@
1
+ === 0.0.1 2010-05-29
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
@@ -0,0 +1,22 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ bin/rubylatex
6
+ lib/ruby-beamer.rb
7
+ lib/ruby-beamer/beamer.rb
8
+ lib/ruby-beamer/common.rb
9
+ lib/ruby-beamer/constants.rb
10
+ lib/ruby-beamer/create-beamer-doc.rb
11
+ lib/ruby-beamer/text.rb
12
+ script/console
13
+ script/destroy
14
+ script/generate
15
+ spec/beamer_spec.rb
16
+ spec/common_spec.rb
17
+ spec/create-beamer-doc_spec.rb
18
+ spec/ruby-beamer_spec.rb
19
+ spec/spec.opts
20
+ spec/spec_helper.rb
21
+ spec/text_spec.rb
22
+ tasks/rspec.rake
@@ -0,0 +1,75 @@
1
+ = ruby-beamer
2
+
3
+ * http://github.com/gja/ruby-beamer
4
+
5
+ == DESCRIPTION:
6
+
7
+ * A gem that helps you describe latex documents in a ruby environment
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * Still quite basic, not all latex markup is possible
12
+
13
+ == SYNOPSIS:
14
+
15
+ simple.rb:
16
+ beamer_document :author => "Tejas Dinkar",
17
+ :date => "Today",
18
+ :title => "An Example",
19
+ :theme => "Warsaw",
20
+ :disable_navigation => true do
21
+
22
+ title_frame
23
+
24
+ frame "A Sample Slide" do
25
+ text {"An Itemized List:"}
26
+
27
+ itemized_list do
28
+ item "Itemized Item 1"
29
+ item "Itemized Item 2", :on => "2-"
30
+ item "Itemized Item 3", :on => "3-"
31
+ end
32
+
33
+ vspace{"2cm"}
34
+
35
+ block "A Simple Theorem" do
36
+ "In a right triangle, the square of hypotenuse equals the sum of squares of two other sides"
37
+ end
38
+ end
39
+ end
40
+
41
+ $ rubylatex simple.rb | pdflatex
42
+ $ okular texput.pdf
43
+
44
+ == REQUIREMENTS:
45
+
46
+ * latex
47
+
48
+ == INSTALL:
49
+
50
+ * sudo gem install ruby-latex
51
+
52
+ == LICENSE:
53
+
54
+ (The MIT License)
55
+
56
+ Copyright (c) 2010 Tejas Dinkar
57
+
58
+ Permission is hereby granted, free of charge, to any person obtaining
59
+ a copy of this software and associated documentation files (the
60
+ 'Software'), to deal in the Software without restriction, including
61
+ without limitation the rights to use, copy, modify, merge, publish,
62
+ distribute, sublicense, and/or sell copies of the Software, and to
63
+ permit persons to whom the Software is furnished to do so, subject to
64
+ the following conditions:
65
+
66
+ The above copyright notice and this permission notice shall be
67
+ included in all copies or substantial portions of the Software.
68
+
69
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
70
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
71
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
72
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
73
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
74
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
75
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/ruby-beamer'
6
+
7
+ Hoe.plugin :newgem
8
+ # Hoe.plugin :website
9
+ # Hoe.plugin :cucumberfeatures
10
+
11
+ # Generate all the Rake tasks
12
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
+ $hoe = Hoe.spec 'ruby-beamer' do
14
+ self.developer 'Tejas Dinkar', 'tejas@gja.in'
15
+ self.rubyforge_name = self.name # TODO this is default value
16
+ # self.extra_deps = [['activesupport','>= 2.0.2']]
17
+
18
+ end
19
+
20
+ require 'newgem/tasks'
21
+ Dir['tasks/**/*.rake'].each { |t| load t }
22
+
23
+ # TODO - want other tests/tasks run by default? Add them to the list
24
+ # remove_task :default
25
+ # task :default => [:spec, :features]
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created on 2010-5-29.
4
+ # Copyright (c) 2010. All rights reserved.
5
+
6
+ require 'rubygems'
7
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/ruby-beamer")
8
+ include RubyBeamer
9
+
10
+ module RubyBeamer
11
+ def output(*args)
12
+ print(*args)
13
+ nil
14
+ end
15
+ end
16
+
17
+ script = ARGV[0]
18
+ if script
19
+ ARGV.shift
20
+ load script
21
+ end
@@ -0,0 +1,12 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module RubyBeamer
5
+ VERSION = '0.0.1'
6
+ end
7
+
8
+ require 'ruby-beamer/constants'
9
+ require 'ruby-beamer/common'
10
+ require 'ruby-beamer/create-beamer-doc'
11
+ require 'ruby-beamer/beamer'
12
+ require 'ruby-beamer/text'
@@ -0,0 +1,55 @@
1
+ module RubyBeamer
2
+ def frame(title = nil, *args, &block)
3
+ create_block(:frame, args.to_beamer_hash.merge!(:arguments => "{#{title}}"), &block)
4
+ end
5
+
6
+ def block(title, *args, &passed_block)
7
+ create_block(:block, args.to_beamer_hash.merge!(:arguments => "{#{title}}"), &passed_block)
8
+ end
9
+
10
+ def resize_box(width, height, *args, &block)
11
+ create_oneline_block(:resizebox, args.to_beamer_hash.merge!(:arguments => "{#{width}}{#{height}}"), &block)
12
+ end
13
+
14
+ def itemized_list(*args, &block)
15
+ create_block(:itemize, args.to_beamer_hash, &block)
16
+ end
17
+
18
+ def item(*args, &block)
19
+ text = args.shift if args[0].is_a? String
20
+ block = lambda { text } if text
21
+ create_oneline_block(:item, args.to_beamer_hash, &block)
22
+ end
23
+
24
+ def title_frame(*args)
25
+ hash = args.to_beamer_hash
26
+ hash.set_beamer_arguments_from :plain
27
+ create_block(:frame, hash) { "\\titlepage" }
28
+ end
29
+
30
+ def table_of_contents_frame(title, *arguments)
31
+ hash = arguments.to_beamer_hash
32
+ hash.set_beamer_arguments_from :currentsection, :hideothersubsections, :section, :hideallsubsections
33
+ frame(title) { create_oneline_block(:tableofcontents, hash) }
34
+ end
35
+
36
+ def image(path, *arguments)
37
+ hash = arguments.to_beamer_hash
38
+ hash.set_beamer_arguments_from(:width, :height)
39
+ create_oneline_block(:includegraphics, hash) { path }
40
+ end
41
+
42
+ def __wrap_in_section(type, title, &block)
43
+ create_oneline_block(type) {title}
44
+ content = yield if block
45
+ output content, "\n" if content
46
+ end
47
+
48
+ def section(title, &block)
49
+ __wrap_in_section(:section, title, &block)
50
+ end
51
+
52
+ def sub_section(title, &block)
53
+ __wrap_in_section(:subsection, title, &block)
54
+ end
55
+ end
@@ -0,0 +1,68 @@
1
+ module RubyBeamer
2
+ class Hash < ::Hash
3
+ def remove_key(key)
4
+ answer = has_key? key
5
+ delete key
6
+ answer
7
+ end
8
+
9
+ def pop_entries(*keys)
10
+ keys.inject({}) do |value, key|
11
+ value[key] = self.delete(key) if self.has_key? key
12
+ value
13
+ end
14
+ end
15
+
16
+ def set_beamer_arguments_from(*keys)
17
+ interesting = self.pop_entries(*keys)
18
+ self[:arguments] = __beamer_get_options(interesting)
19
+ self
20
+ end
21
+ end
22
+
23
+ class ::Array
24
+ def to_beamer_hash
25
+ inject(Hash.new) do |values, arg|
26
+ if(arg.is_a? ::Hash)
27
+ values.merge! arg
28
+ else
29
+ values[arg] = nil
30
+ end
31
+ values
32
+ end
33
+ end
34
+ end
35
+
36
+ def __beamer_get_options(*args)
37
+ values = args.to_beamer_hash.inject([]) {|values, tuple| values << "#{tuple[0]}#{"=" if tuple[1]}#{tuple[1]}" }
38
+ return "" if values.empty?
39
+ return "[" + values.join(",") + "]"
40
+ end
41
+
42
+ def __print_block(starting, separator, content_start, ending, args, &block)
43
+ block_args = (args.delete :arguments) || ""
44
+ appear_on = ("<#{args.delete :on}>" if args.has_key? :on) || ""
45
+
46
+ output starting, appear_on, block_args, separator, content_start
47
+ content = yield if block
48
+ output content, separator if content
49
+ output ending, "\n"
50
+ end
51
+
52
+ def create_block(type, args = {}, &block)
53
+ __print_block("\\begin{#{type}}", "\n", "", "\\end{#{type}}", args, &block)
54
+ end
55
+
56
+ def create_oneline_block(type, args = {}, &block)
57
+ __print_block("\\#{type}", "", "{", "}", args, &block)
58
+ end
59
+
60
+ def text
61
+ content = yield
62
+ output content if content
63
+ end
64
+
65
+ def new_line
66
+ text { "\\\\" }
67
+ end
68
+ end
@@ -0,0 +1,12 @@
1
+ module RubyBeamer
2
+ TEXT_WIDTH = "\\textwidth"
3
+ TEXT_HEIGHT = "\\textheight"
4
+
5
+ PAGE_WIDTH = "\\pagewidth"
6
+ PAGE_HEIGHT = "\\pageheight"
7
+
8
+ NEWLINE = "\\\\"
9
+
10
+ SECTION = "\\insertsection"
11
+ SUB_SECTION = "\\insertsubsection"
12
+ end
@@ -0,0 +1,29 @@
1
+ module RubyBeamer
2
+ def __get_property_options(properties)
3
+ return nil if not properties
4
+ return "{#{properties}}" if properties.is_a? String
5
+ return "[#{properties[0]}]{#{properties[1]}}"
6
+ end
7
+
8
+ def __output_line_from(args, property)
9
+ options = __get_property_options args[property]
10
+ output "\\#{property}#{options}\n" if options
11
+ end
12
+
13
+ def beamer_document(args = {}, &block)
14
+ theme = args[:theme] || "default"
15
+ global_options = args[:global_options]
16
+
17
+ output "\\documentclass", ("[#{global_options}]" if global_options) || "", "{beamer}\n"
18
+ output "\\usetheme{#{theme}}\n"
19
+
20
+ __output_line_from args, :title
21
+ __output_line_from args, :subtitle
22
+ __output_line_from args, :author
23
+ __output_line_from args, :date
24
+
25
+ output "\\setbeamertemplate{navigation symbols}{}\n" if args[:disable_navigation]
26
+
27
+ create_block :document, &block
28
+ end
29
+ end
@@ -0,0 +1,25 @@
1
+ module RubyBeamer
2
+ def center(*args, &block)
3
+ create_block(:center, args.to_beamer_hash, &block)
4
+ end
5
+
6
+ ONE_LINERS = {
7
+ :bold => :textbf,
8
+ :em => :em,
9
+ :huge => :huge,
10
+ :footnote => :footnotesize,
11
+ :teletype => :tt,
12
+ :structure => :structure,
13
+ :vspace => :vspace,
14
+ :only => :only
15
+ }
16
+
17
+ def method_missing(method, *args, &block)
18
+ return super if not ONE_LINERS.has_key? method
19
+ create_oneline_block(ONE_LINERS[method], args.to_beamer_hash, &block)
20
+ end
21
+
22
+ def responds_to?(method)
23
+ super or ONE_LINERS.has_key? method
24
+ end
25
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/ruby-beamer.rb'}"
9
+ puts "Loading ruby-beamer gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,90 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Beamer Methods" do
4
+ it "Should create a frame" do
5
+ frame("title") { "foo" }
6
+ printed.should == <<-eos
7
+ \\begin{frame}{title}
8
+ foo
9
+ \\end{frame}
10
+ eos
11
+ end
12
+
13
+ it "Should create a block" do
14
+ block("title") { "foo" }
15
+ printed.should == <<-eos
16
+ \\begin{block}{title}
17
+ foo
18
+ \\end{block}
19
+ eos
20
+ end
21
+
22
+ it "Should create a resizebox" do
23
+ resize_box(TEXT_WIDTH, TEXT_HEIGHT) { "foo" }
24
+ printed.should == "\\resizebox{\\textwidth}{\\textheight}{foo}\n"
25
+ end
26
+
27
+ it "Should be able to create an itemized list" do
28
+ itemized_list do
29
+ item {"First Item"}
30
+ item {"Second Item"}
31
+ end
32
+ printed.should == <<-eos
33
+ \\begin{itemize}
34
+ \\item{First Item}
35
+ \\item{Second Item}
36
+ \\end{itemize}
37
+ eos
38
+ end
39
+
40
+ it "Should be able to specify which slide an item appears on" do
41
+ item(:on => "1-") {"First Item"}
42
+ printed.should == "\\item<1->{First Item}\n"
43
+ end
44
+
45
+ it "Should be possible to pass an item a string" do
46
+ item "string"
47
+ printed.should == "\\item{string}\n"
48
+ end
49
+
50
+ it "Should be able to create a title frame" do
51
+ title_frame :plain
52
+ printed.should == <<-eos
53
+ \\begin{frame}[plain]
54
+ \\titlepage
55
+ \\end{frame}
56
+ eos
57
+ end
58
+
59
+ it "Should be able to create an image" do
60
+ image("foo.png")
61
+ printed.should == "\\includegraphics{foo.png}\n"
62
+ end
63
+
64
+ it "Should be able to set height and width" do
65
+ image("foo.png", :height => "10", :width => "10")
66
+ printed.should == "\\includegraphics[height=10,width=10]{foo.png}\n"
67
+ end
68
+
69
+ it "Should be able to create sections and subsections" do
70
+ section "foo" do
71
+ sub_section "bar" do
72
+ "baz"
73
+ end
74
+ end
75
+ printed.should == <<-eos
76
+ \\section{foo}
77
+ \\subsection{bar}
78
+ baz
79
+ eos
80
+ end
81
+
82
+ it "should be able to create a table of contents frame" do
83
+ table_of_contents_frame "Overview", :hideallsubsections, :section => 1
84
+ printed.should == <<-eos
85
+ \\begin{frame}{Overview}
86
+ \\tableofcontents[hideallsubsections,section=1]{}
87
+ \\end{frame}
88
+ eos
89
+ end
90
+ end
@@ -0,0 +1,119 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Get Options to Block" do
4
+ it "Should Return Empty if nothing is passed to it" do
5
+ __beamer_get_options().should() == ""
6
+ end
7
+
8
+ it "Should Return Parameters passed to it" do
9
+ __beamer_get_options(:foo => "bar", :baz => 0.8).should == "[foo=bar,baz=0.8]"
10
+ __beamer_get_options(:foo, :bar => "baz").should == "[foo,bar=baz]"
11
+ end
12
+
13
+ it "Should be able to generate a beamer hash" do
14
+ array = [:foo, :bar, {:ooga => "ooga", :booga => "booga"}]
15
+ hash = array.to_beamer_hash
16
+
17
+ hash.should have_key :foo
18
+ hash[:foo].should be_nil
19
+ hash.should have_key :bar
20
+ hash[:bar].should be_nil
21
+ hash[:ooga].should == "ooga"
22
+ hash[:booga].should == "booga"
23
+ end
24
+
25
+ it "Should Be Able to Set Arguments from hash" do
26
+ hash = get_beamer_hash(:foo, :bar, :baz => 3)
27
+
28
+ hash.set_beamer_arguments_from :foo, :baz
29
+ hash[:arguments].should == "[foo,baz=3]"
30
+ end
31
+
32
+ it "Should be able to delete a key if present" do
33
+ hash = [:foo, :bar].to_beamer_hash
34
+ hash.remove_key(:foo).should be_true
35
+ hash.remove_key(:foo).should be_false
36
+ end
37
+
38
+ it "Should be able to get interesting elements from the hash" do
39
+ hash = get_beamer_hash(:foo => 1, :bar => 2, :baz => 3)
40
+
41
+ interesting = hash.pop_entries :foo, :bar, :spam
42
+
43
+ interesting[:foo].should == 1
44
+ interesting[:bar].should == 2
45
+
46
+ hash.has_key?(:foo).should be_false
47
+ hash.has_key?(:bar).should be_false
48
+ hash.has_key?(:baz).should be_true
49
+ end
50
+ end
51
+
52
+ describe "Create Beamer Block" do
53
+ it "should be able to create a beamer block" do
54
+ create_block :document
55
+ printed.should == <<EOF
56
+ \\begin{document}
57
+ \\end{document}
58
+ EOF
59
+ end
60
+
61
+ it "Should be able to pass arguments to a beamer block" do
62
+ create_block :document, :arguments => "{foo}"
63
+ printed.should == <<EOF
64
+ \\begin{document}{foo}
65
+ \\end{document}
66
+ EOF
67
+ end
68
+
69
+ it "Should be able to print out a string passed to it as a block" do
70
+ create_block(:document) {"foo"}
71
+ printed.should == <<EOF
72
+ \\begin{document}
73
+ foo
74
+ \\end{document}
75
+ EOF
76
+ end
77
+
78
+ it "Should Be Able to accept another block as parameters" do
79
+ create_block :document do
80
+ create_block :frame
81
+ end
82
+
83
+ printed.should == <<EOF
84
+ \\begin{document}
85
+ \\begin{frame}
86
+ \\end{frame}
87
+ \\end{document}
88
+ EOF
89
+ end
90
+ end
91
+
92
+ describe "Create one line blocks" do
93
+ it "Should be able to create a one line block" do
94
+ create_oneline_block(:em){"foo"}
95
+ printed.should == "\\em{foo}\n"
96
+ end
97
+
98
+ it "Should be able to create a one line block" do
99
+ create_oneline_block(:em){nil}
100
+ printed.should == "\\em{}\n"
101
+ end
102
+
103
+ it "Should be able to create a one line block with arguments" do
104
+ create_oneline_block(:em, :arguments => "[bar]"){"foo"}
105
+ printed.should == "\\em[bar]{foo}\n"
106
+ end
107
+ end
108
+
109
+ describe "Text Block" do
110
+ it "Should be able to create a text block" do
111
+ text {"foo"}
112
+ printed.should == "foo"
113
+ end
114
+
115
+ it "Should be able to print a new line" do
116
+ new_line
117
+ printed.should == "\\\\"
118
+ end
119
+ end
@@ -0,0 +1,69 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Create Beamer Document" do
4
+
5
+ it "should be able to create a default beamer document" do
6
+ beamer_document
7
+ printed.should == <<EOF
8
+ \\documentclass{beamer}
9
+ \\usetheme{default}
10
+ \\begin{document}
11
+ \\end{document}
12
+ EOF
13
+ end
14
+
15
+ it "should be able to set the theme" do
16
+ beamer_document(:theme => :warsaw)
17
+ printed.should include "\\usetheme{warsaw}\n"
18
+ end
19
+
20
+ it "Should be able to disable navigation" do
21
+ beamer_document(:disable_navigation => true)
22
+ printed.should include "\\setbeamertemplate{navigation symbols}{}\n"
23
+ end
24
+
25
+ it "should be possible to pass a block to document" do
26
+ beamer_document do
27
+ create_block :frame
28
+ end
29
+ printed.should == <<EOF
30
+ \\documentclass{beamer}
31
+ \\usetheme{default}
32
+ \\begin{document}
33
+ \\begin{frame}
34
+ \\end{frame}
35
+ \\end{document}
36
+ EOF
37
+ end
38
+
39
+ it "Should be possible to pass global options to the document" do
40
+ beamer_document :global_options => "table"
41
+ printed.should include "\\documentclass[table]{beamer}"
42
+ end
43
+
44
+ it "Should be able to set the title" do
45
+ beamer_document :title => "title"
46
+ printed.should include "\\title{title}\n"
47
+ end
48
+
49
+ it "Should be able to set the subtitle" do
50
+ beamer_document :subtitle => "title"
51
+ printed.should include "\\subtitle{title}\n"
52
+ end
53
+
54
+ it "Should be able to set the title" do
55
+ beamer_document :author => "title"
56
+ printed.should include "\\author{title}\n"
57
+ end
58
+
59
+ it "Should be able to set the title" do
60
+ beamer_document :date => "title"
61
+ printed.should include "\\date{title}\n"
62
+ end
63
+
64
+ it "Should be able to set a short and long title" do
65
+ beamer_document :title => ["short", "title"]
66
+ printed.should include "\\title[short]{title}\n"
67
+ end
68
+
69
+ end
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ # Time to add your specs!
4
+ # http://rspec.info/
5
+ describe "Place your specs here" do
6
+
7
+ it "find this spec in spec directory" do
8
+ # violated "Be sure to write your specs"
9
+ end
10
+
11
+ end
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,27 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'ruby-beamer'
11
+
12
+ include RubyBeamer
13
+
14
+ module RubyBeamer
15
+ def printed
16
+ @printed || ""
17
+ end
18
+
19
+ def output(*args)
20
+ @printed = args.inject(printed){|p, s| p + s}
21
+ nil
22
+ end
23
+
24
+ def get_beamer_hash(*args)
25
+ return args.to_beamer_hash
26
+ end
27
+ end
@@ -0,0 +1,57 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Text Methods" do
4
+ it "Should be able to center some text" do
5
+ center{"text"}
6
+ printed.should == <<-eos
7
+ \\begin{center}
8
+ text
9
+ \\end{center}
10
+ eos
11
+ end
12
+
13
+ it "Should be able write bold text" do
14
+ bold {"First Item"}
15
+ printed.should == "\\textbf{First Item}\n"
16
+ end
17
+
18
+ it "Should be able to write emphasized text" do
19
+ em {"Text"}
20
+ printed.should == "\\em{Text}\n"
21
+ end
22
+
23
+ it "Should be able to write huge text" do
24
+ huge { "Text" }
25
+ printed.should == "\\huge{Text}\n"
26
+ end
27
+
28
+ it "Should be able to write footnotes" do
29
+ footnote { "Text" }
30
+ printed.should == "\\footnotesize{Text}\n"
31
+ end
32
+
33
+ it "Should be able to write teletype" do
34
+ teletype { "Text" }
35
+ printed.should == "\\tt{Text}\n"
36
+ end
37
+
38
+ it "Should be able to write a structure" do
39
+ structure { "Text" }
40
+ printed.should == "\\structure{Text}\n"
41
+ end
42
+
43
+ it "Should be able to draw a vspace" do
44
+ vspace { "2cm" }
45
+ printed.should == "\\vspace{2cm}\n"
46
+ end
47
+
48
+ it "Should be able to pass a show_on argument to em" do
49
+ em (:on => "5-") { "text" }
50
+ printed.should == "\\em<5->{text}\n"
51
+ end
52
+
53
+ it "Should be able to show an only block" do
54
+ only(:on => "4") { "text" }
55
+ printed.should == "\\only<4>{text}\n"
56
+ end
57
+ end
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-beamer
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Tejas Dinkar
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-05-31 00:00:00 +05:30
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rubyforge
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 2
32
+ - 0
33
+ - 4
34
+ version: 2.0.4
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: hoe
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 23
46
+ segments:
47
+ - 2
48
+ - 6
49
+ - 0
50
+ version: 2.6.0
51
+ type: :development
52
+ version_requirements: *id002
53
+ description: "* A gem that helps you describe latex documents in a ruby environment"
54
+ email:
55
+ - tejas@gja.in
56
+ executables:
57
+ - rubylatex
58
+ extensions: []
59
+
60
+ extra_rdoc_files:
61
+ - History.txt
62
+ - Manifest.txt
63
+ files:
64
+ - History.txt
65
+ - Manifest.txt
66
+ - README.rdoc
67
+ - Rakefile
68
+ - bin/rubylatex
69
+ - lib/ruby-beamer.rb
70
+ - lib/ruby-beamer/beamer.rb
71
+ - lib/ruby-beamer/common.rb
72
+ - lib/ruby-beamer/constants.rb
73
+ - lib/ruby-beamer/create-beamer-doc.rb
74
+ - lib/ruby-beamer/text.rb
75
+ - script/console
76
+ - script/destroy
77
+ - script/generate
78
+ - spec/beamer_spec.rb
79
+ - spec/common_spec.rb
80
+ - spec/create-beamer-doc_spec.rb
81
+ - spec/ruby-beamer_spec.rb
82
+ - spec/spec.opts
83
+ - spec/spec_helper.rb
84
+ - spec/text_spec.rb
85
+ - tasks/rspec.rake
86
+ has_rdoc: true
87
+ homepage: http://github.com/gja/ruby-beamer
88
+ licenses: []
89
+
90
+ post_install_message:
91
+ rdoc_options:
92
+ - --main
93
+ - README.rdoc
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ hash: 3
111
+ segments:
112
+ - 0
113
+ version: "0"
114
+ requirements: []
115
+
116
+ rubyforge_project: ruby-beamer
117
+ rubygems_version: 1.3.7
118
+ signing_key:
119
+ specification_version: 3
120
+ summary: "* A gem that helps you describe latex documents in a ruby environment"
121
+ test_files: []
122
+