condom 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,12 @@
1
+ == 1.0.1
2
+
3
+ * Added fixes for 1.9.* Ruby versions:
4
+ * Added a workaround for instance_variables method (see set_options in base.rb)
5
+ * Used RUBY_PLATFORM instead of PLATFORM (removed in 1.9.1)
6
+ * Renamed main.tex.erb to document.tex.erb
7
+ * Renamed lst-conf.tex.erb to listings.tex.erb
8
+ * Cleaned generated LaTeX code indentation
9
+
1
10
  == 1.0.0
2
11
 
3
12
  * Rewrote the executable, it is now simpler and allow user to change every fields (see the README).
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = Condom
2
2
 
3
- A Ruby lib to create a skeleton for a LaTeX document.
3
+ == A Ruby lib to prepare the skeleton of a LaTeX document
4
4
 
5
5
  This lib requires that you know the LaTeX language.
6
6
 
@@ -121,7 +121,7 @@ may result the creation of these folders/files:
121
121
  ├── inc
122
122
  │   ├── colors.tex
123
123
  │   ├── commands.tex
124
- │   ├── lst-conf.tex
124
+ │   ├── listings.tex
125
125
  │   └── packages.tex
126
126
  ├── main.tex
127
127
  ├── Makefile
@@ -134,7 +134,7 @@ This is the folder where you should put your images.
134
134
  This folder has all configuration tex files:
135
135
  * colors.tex - customized colors
136
136
  * commands.tex - customized commands
137
- * lst-conf.tex - configuration file for the listings package
137
+ * listings.tex - configuration file for the listings package
138
138
  * packages - all needed packages
139
139
 
140
140
  === main.tex
data/bin/condom CHANGED
@@ -26,7 +26,7 @@ ARGV.options do |o|
26
26
  o.on("-p", "--package=PACKAGE", String, "Add another package") { |v| ops[:other_packages].push v }
27
27
  o.on("-o", "--directory=DIRECTORY", String, "Define the output directory") { |v| ops[:directory] = v }
28
28
  o.on("-q", "--quiet", "Don't ask any question") { quiet = true }
29
- o.on("-v", "--version", "Print Condom version") { puts "Condom lib: version #{Condom::VERSION}" ; exit }
29
+ o.on("-v", "--version", "Print Condom version") { puts "Condom: version #{Condom::VERSION}" ; exit }
30
30
  end
31
31
 
32
32
  begin
@@ -57,7 +57,7 @@ begin
57
57
  puts "Enter the new value, or press ENTER for the default"
58
58
 
59
59
  doc_type = doc.class.to_s.split('::').last.downcase
60
- printf " type [%s]: ", doc_type
60
+ printf " %-17s [%s]: ", "type", doc_type
61
61
  type = STDIN.gets.strip
62
62
  doc = case type
63
63
  when 'document' then Condom::Document.new(ops)
data/lib/condom.rb CHANGED
@@ -12,7 +12,7 @@ require "etc"
12
12
 
13
13
  module Condom
14
14
  # Lib version
15
- VERSION = '1.0.0'
15
+ VERSION = '1.0.1'
16
16
 
17
17
  # Constant views directory
18
18
  VIEWS_DIR = File.join(File.expand_path(File.dirname(__FILE__)), 'views')
data/lib/condom/base.rb CHANGED
@@ -55,7 +55,10 @@ module Condom
55
55
  def set_options(hash)
56
56
  hash.keys.each do |key|
57
57
  var = '@' << key.to_s
58
- raise("Key #{key} not supported.") unless instance_variables.include? var
58
+ # = 1.9.* Fix
59
+ # The map method applied on instance_variables is used to force elements to be String
60
+ # because on 1.9.* Ruby versions, these elements are Symbol (i.e. :@directory).
61
+ raise("Key #{key} not supported.") unless instance_variables.map {|v| v.to_s}.include? var
59
62
  instance_variable_set(var, hash[key])
60
63
  end
61
64
  end
@@ -37,7 +37,8 @@ module Condom
37
37
  def create
38
38
  in_directory do
39
39
  # Create files
40
- build "main.tex"
40
+ build "document.tex"
41
+ File.rename("document.tex", "main.tex")
41
42
  build "Makefile"
42
43
  if @graphics
43
44
  build "fig.tex"
@@ -49,7 +50,7 @@ module Condom
49
50
  build "packages.tex"
50
51
  build "commands.tex"
51
52
  build "colors.tex"
52
- build "lst-conf.tex" if @listings
53
+ build "listings.tex" if @listings
53
54
  build "flyleaf.tex" if @document_class == "report"
54
55
  end
55
56
  end
@@ -50,7 +50,7 @@ module Condom
50
50
  build "packages.tex"
51
51
  build "commands.tex"
52
52
  build "colors.tex"
53
- build "lst-conf.tex" if @listings
53
+ build "listings.tex" if @listings
54
54
  build "flyleaf.tex" if @document_class == "report"
55
55
  end
56
56
  end
@@ -14,27 +14,27 @@
14
14
  \input{inc/colors}
15
15
  \input{inc/commands}
16
16
  <% if @listings %>
17
- \input{inc/lst-conf} % fichier de config du paquet listings
17
+ \input{inc/listings} % fichier de config du paquet listings
18
18
  <% end %>
19
19
 
20
20
  \geometry{top=2.5cm, bottom=2.5cm, left=2cm, right=2cm}
21
21
  <% if @graphics %>
22
- \graphicspath{{fig/}} % chemins vers les images
22
+ \graphicspath{{fig/}} % chemins vers les images
23
23
  <% end %>
24
24
 
25
25
  % informations du document
26
26
  \author{<%= @author %>}
27
- \date{Le <%= @date %>}
27
+ \date{<%= @date %>}
28
28
  \title{<%= @title %>}
29
29
 
30
30
  <% if @document_class == "report" %>
31
- %\input{inc/flyleaf.tex} % page de garde personnalisee
32
- %\location{}
33
- %\blurb{}
31
+ %\input{inc/flyleaf.tex} % page de garde personnalisee
32
+ %\location{}
33
+ %\blurb{}
34
34
  <% end %>
35
35
 
36
36
  <% if @pdf %>
37
- \hypersetup{%
37
+ \hypersetup{%
38
38
  pdftitle = {<%= @title %>},
39
39
  pdfauthor = {<%= @author %>}
40
40
  pdfcreator = {Texlive},
@@ -43,28 +43,28 @@
43
43
  linkcolor = black,
44
44
  citecolor = black,
45
45
  urlcolor = black
46
- } % informations du pdf
46
+ } % informations du pdf
47
47
  <% end %>
48
48
 
49
49
  <% if @fancyhdr %>
50
- \pagestyle{fancy}
51
- \lhead{<%= @title %>}
52
- \chead{}
53
- \rhead{\thepage/\pageref{LastPage}}
54
- \lfoot{}
55
- \cfoot{}
56
- \rfoot{\footnotesize <%= @author %>}
57
- %\renewcommand{\headrulewidth}{0pt}
58
- %\renewcommand{\footrulewidth}{0.4pt}
59
- \fancypagestyle{plain}{% % style des pages de titres
50
+ \pagestyle{fancy}
51
+ \lhead{<%= @title %>}
52
+ \chead{}
53
+ \rhead{\thepage/\pageref{LastPage}}
54
+ \lfoot{}
55
+ \cfoot{}
56
+ \rfoot{\footnotesize <%= @author %>}
57
+ %\renewcommand{\headrulewidth}{0pt}
58
+ %\renewcommand{\footrulewidth}{0.4pt}
59
+ \fancypagestyle{plain}{% % style des pages de titres
60
60
  \fancyhf{}
61
61
  \renewcommand{\headrulewidth}{0pt}
62
62
  \renewcommand{\footrulewidth}{0pt}
63
- }
63
+ }
64
64
  <% end %>
65
65
 
66
66
  <% if @document_class == "report" %>
67
- \renewcommand{\thesection}{\Roman{part}.\arabic{section}} % redefinir la numerotation des sections (ex: I.2)
67
+ \renewcommand{\thesection}{\Roman{part}.\arabic{section}} % redefinir la numerotation des sections (ex: I.2)
68
68
  <% end %>
69
69
 
70
70
  \makeatletter
@@ -83,20 +83,22 @@
83
83
 
84
84
  \maketitle % afficher le titre
85
85
 
86
+ <% unless @document_class == "book" %>
86
87
  % resume
87
88
  \begin{abstract}
88
89
  \end{abstract}
90
+ <% end %>
89
91
 
90
92
  \tableofcontents % table des matieres
91
93
 
92
94
  <% if @listings %>
93
- \lstlistoflistings % tables des listings
95
+ \lstlistoflistings % tables des listings
94
96
  <% end %>
95
97
 
96
98
  <% if @document_class == "article" %>
97
- \newpage
99
+ \newpage
98
100
  <% elsif @document_class == "report" %>
99
- \unnumpart{Introduction}
101
+ \unnumpart{Introduction}
100
102
  <% end %>
101
103
 
102
104
  \end{document} % fin du document
@@ -6,7 +6,7 @@
6
6
 
7
7
  \documentclass[11pt]{letter}
8
8
  \usepackage[<%= @language %>]{babel} % langue
9
- \usepackage[<%= (PLATFORM.include? 'linux') ? 'utf8' : 'latin1' %>]{inputenc}
9
+ \usepackage[<%= (RUBY_PLATFORM.include? 'linux') ? 'utf8' : 'latin1' %>]{inputenc}
10
10
  \usepackage{graphicx}
11
11
  \usepackage{geometry}
12
12
 
File without changes
@@ -6,44 +6,44 @@
6
6
 
7
7
  \usepackage[T1]{fontenc} % codage des caracteres
8
8
 
9
- \usepackage[<%= (PLATFORM.include? 'linux') ? 'utf8' : 'latin1' %>]{inputenc} % encodage du fichier (utf8 ou latin1)
9
+ \usepackage[<%= (RUBY_PLATFORM.include? 'linux') ? 'utf8' : 'latin1' %>]{inputenc} % encodage du fichier (utf8 ou latin1)
10
10
  \usepackage[<%= @language %>]{babel} % langue
11
11
  \usepackage{mathpazo} % selection de la police
12
12
  \usepackage{geometry} % mise en page
13
13
  \usepackage{xcolor} % pour colorer des elements
14
14
 
15
15
  <% if @graphics %>
16
- \usepackage{graphicx} % pour inserer des images
16
+ \usepackage{graphicx} % pour inserer des images
17
17
  <% end %>
18
18
 
19
19
  <% if @math %>
20
- % math
21
- \usepackage{amssymb} % symboles mathematiques
22
- %\usepackage{amsmath} % commandes mathematiques
20
+ % math
21
+ \usepackage{amssymb} % symboles mathematiques
22
+ %\usepackage{amsmath} % commandes mathematiques
23
23
  <% end %>
24
24
 
25
25
  <% if @pdf %>
26
- % pdf
27
- \usepackage{url} % permet l'insertion d'url
28
- \usepackage[pdftex]{hyperref} % permet l'hypertexte (rend les liens cliquables)
26
+ % pdf
27
+ \usepackage{url} % permet l'insertion d'url
28
+ \usepackage[pdftex]{hyperref} % permet l'hypertexte (rend les liens cliquables)
29
29
  <% end %>
30
30
 
31
31
  <% if @listings %>
32
- % listings
33
- \usepackage{listings} % permet d'inserer du code (multi-langage)
34
- \usepackage{courier}
35
- \usepackage{caption}
32
+ % listings
33
+ \usepackage{listings} % permet d'inserer du code (multi-langage)
34
+ \usepackage{courier}
35
+ \usepackage{caption}
36
36
  <% end %>
37
37
 
38
38
  <% if @fancyhdr %>
39
- % fancyhdr
40
- \usepackage{lastpage} % derniere page
41
- \usepackage{fancyhdr} % en-tete et pied de page
39
+ % fancyhdr
40
+ \usepackage{lastpage} % derniere page
41
+ \usepackage{fancyhdr} % en-tete et pied de page
42
42
  <% end %>
43
43
 
44
44
  \usepackage{multicol}
45
45
 
46
46
  <% for package in @other_packages do %>
47
- \usepackage{<%= package %>}
47
+ \usepackage{<%= package %>}
48
48
  <% end %>
49
49
 
@@ -18,7 +18,7 @@
18
18
  \input{inc/colors}
19
19
  \input{inc/commands}
20
20
  <% if @listings %>
21
- \input{inc/lst-conf} % fichier de config du paquet listings
21
+ \input{inc/listings} % fichier de config du paquet listings
22
22
  <% end %>
23
23
 
24
24
  <% if @graphics %>
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: condom
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 0
9
- - 0
10
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Vivien Didelot
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-08-19 00:00:00 +10:00
17
+ date: 2010-08-20 00:00:00 +10:00
19
18
  default_executable:
20
19
  dependencies: []
21
20
 
@@ -29,10 +28,10 @@ extra_rdoc_files: []
29
28
 
30
29
  files:
31
30
  - lib/views/flyleaf.tex.erb
32
- - lib/views/main.tex.erb
33
- - lib/views/lst-conf.tex.erb
31
+ - lib/views/document.tex.erb
34
32
  - lib/views/presentation.tex.erb
35
33
  - lib/views/packages.tex.erb
34
+ - lib/views/listings.tex.erb
36
35
  - lib/views/fig.tex.erb
37
36
  - lib/views/letter.tex.erb
38
37
  - lib/views/colors.tex.erb
@@ -60,7 +59,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
59
  requirements:
61
60
  - - ">="
62
61
  - !ruby/object:Gem::Version
63
- hash: 3
64
62
  segments:
65
63
  - 0
66
64
  version: "0"
@@ -69,7 +67,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
67
  requirements:
70
68
  - - ">="
71
69
  - !ruby/object:Gem::Version
72
- hash: 3
73
70
  segments:
74
71
  - 0
75
72
  version: "0"