code_rippa 0.0.1 → 0.0.3

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/README.md CHANGED
@@ -1,35 +1,88 @@
1
1
  # CodeRippa
2
2
 
3
- CodeRippa takes your source code and turns it into a beautiful PDF file.
3
+ CodeRippa takes your source code and turns it into a beautiful PDF file. Currently, it supports 150 languages and 15 themes, all of which are available in TextMate. More syntaxes and themes will be available soon.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'code_rippa'
9
+ $ gem 'code_rippa'
10
10
 
11
11
  And then execute:
12
12
 
13
- $ bundle
13
+ $ bundle
14
14
 
15
15
  Or install it yourself as:
16
16
 
17
- $ gem install code_rippa
17
+ $ gem install code_rippa
18
18
 
19
19
  ## Usage
20
20
 
21
- $ Usage: code_rippa [options] file_or_directory
22
- $ -l, --list-themes List all available themes
23
- $ -t, --theme THEME Selected theme
24
- $ -n, --list-syntax List all available syntax
25
- $ -s, --syntax SYNTAX Selected syntax
26
- $ -x, --excluded-exts E1,E2,EN Exclude these extensions when processing
27
- $ -h, --help Display this screen
21
+ ### Command line options
22
+
23
+ Usage: code_rippa [options] file_or_directory
24
+ -l, --list-themes List all available themes
25
+ -t, --theme THEME Selected theme
26
+ -n, --list-syntax List all available syntax
27
+ -s, --syntax SYNTAX Selected syntax
28
+ -x, --excluded-exts E1,E2,EN Exclude these extensions when processing
29
+ -h, --help Display this screen
30
+
31
+ ### List all available themes
32
+
33
+ $ code_rippa -l
34
+
35
+ active4d
36
+ all_hallows_eve
37
+ amy
38
+ moc
39
+ twilight
40
+ zenburnesque
41
+ ... more themes omitted
42
+
43
+ ### List all supported syntax
44
+
45
+ $ code_rippa -n
46
+
47
+ actionscript
48
+ erlang
49
+ java
50
+ javascript
51
+ prolog
52
+ ruby
53
+ yaml
54
+ ... more syntaxes omitted
55
+
56
+ ### Producing PDF from a single file
57
+
58
+ Example:
59
+
60
+ $ code_rippa -s ruby -t zenburnesque path_to_single_file.rb
61
+
62
+ Note that the output file is saved as _out.tex_ in the current directory where _code_rippa_ was called from.
63
+
64
+ $ pdflatex out.tex # Saved as out.pdf
65
+
66
+
67
+ ### Producing PDF from a directory
68
+
69
+ Example:
70
+
71
+ $ code_rippa -s java -t moc path_to_directory
72
+
73
+ Note that the output file is saved as _out.tex_ in the current directory where _code_rippa_ was called from.
74
+
75
+ Then, you'll need to run _pdflatex_ __twice__. This is because LaTeX needs to generate the bookmarks.
76
+
77
+ $ pdflatex out.tex # Saved as out.pdf
78
+ $ pdflatex out.tex # Remember to run this twice!
79
+
80
+ Note: In case your system doesn't have `pdflatex`, you can get a [LaTeX](http://www.tug.org/texlive/) distribution.
81
+
82
+ ## Credits
83
+
84
+ None of this would be possible without the awesome [ultraviolet](https://github.com/giom/ultraviolet) and [spox-ultraviolet](https://github.com/spox/ultraviolet) and [linguist](https://github.com/github/linguist) gems. Props to [__lwheng__](https://github.com/lwheng) for providing most of the LaTeX help.
28
85
 
29
86
  ## Contributing
30
87
 
31
- 1. Fork it
32
- 2. Create your feature branch (`git checkout -b my-new-feature`)
33
- 3. Commit your changes (`git commit -am 'Added some feature'`)
34
- 4. Push to the branch (`git push origin my-new-feature`)
35
- 5. Create new Pull Request
88
+ Currently this gem is in its infancy. Any bug reports and feature requests are very welcomed.
data/bin/code_rippa CHANGED
@@ -9,12 +9,34 @@ end
9
9
 
10
10
  options = {}
11
11
  option_parser = OptionParser.new do |opts|
12
+
13
+ opts.banner =<<END
14
+
15
+ Usage: code_rippa [options] input_file_or_directory
16
+
17
+ Parses input_file or directory and outputs a file named out.tex.
18
+ It expects both the syntax and theme to be specified.
19
+
20
+ Example:
21
+
22
+ code_rippa -s ruby -t amy path_to_file.rb
12
23
 
13
- opts.banner = CodeRippa.usage
24
+ Renders the contents of path_to_file.rb into out.tex.
14
25
 
26
+ Then run
27
+
28
+ pdflatex out.tex
29
+
30
+ to generate the PDF output.
31
+
32
+ "-s" and "-t" are mandatory. The rest are optional.
33
+
34
+ Options:
35
+ END
36
+
15
37
  opts.on('-l', '--list-themes', 'List all available themes') do
16
38
  puts Uv.themes.join("\n")
17
- exit
39
+ exit 0
18
40
  end
19
41
 
20
42
  opts.on('-t', '--theme THEME', 'Selected theme') do |theme|
@@ -27,7 +49,7 @@ option_parser = OptionParser.new do |opts|
27
49
 
28
50
  opts.on('-n', '--list-syntax', 'List all available syntax') do
29
51
  puts CodeRippa.supported_syntax.join("\n")
30
- exit
52
+ exit 0
31
53
  end
32
54
 
33
55
  opts.on('-s', '--syntax SYNTAX', 'Selected syntax') do |syntax|
@@ -55,24 +77,23 @@ option_parser = OptionParser.new do |opts|
55
77
 
56
78
  opts.on('-h', '--help', 'Display this screen') do
57
79
  puts opts
58
- exit
80
+ exit 0
59
81
  end
60
82
  end
61
83
 
62
84
  begin
63
85
  option_parser.parse!
64
-
65
86
  if options[:theme] and options[:syntax] and ARGV.size == 1
66
87
  if FileTest.file?(ARGV[0])
67
88
  CodeRippa.rip_file(ARGV[0], options[:theme], options[:syntax], options[:excluded_exts])
68
89
  elsif FileTest.directory?(ARGV[0])
69
90
  CodeRippa.rip_dir(ARGV[0], options[:theme], options[:syntax], options[:excluded_exts])
70
91
  end
92
+ exit 0
71
93
  else
72
- raise ArgumentError, "Missing arguments. Aborting.\n" + CodeRippa.usage
94
+ raise ArgumentError, "Missing arguments. Aborting.\n"
73
95
  end
74
-
75
96
  rescue ArgumentError => e
76
97
  puts e
77
- exit
98
+ exit 1
78
99
  end
data/code_rippa.gemspec CHANGED
@@ -5,9 +5,9 @@ require File.expand_path('../lib/code_rippa/uv_overrides', __FILE__)
5
5
  Gem::Specification.new do |gem|
6
6
  gem.authors = ["Benjamin Tan Wei Hao"]
7
7
  gem.email = ["ben@witsvale.com"]
8
- gem.platform = Gem::Platform::RUBY
8
+ gem.platform = Gem::Platform::RUBY
9
9
  gem.description = %q{Converts source code into a (bookmarked, themed, and syntax highlighted!) PDF.}
10
- gem.summary = %q{Converts source code into a (bookmarked, themed, and syntax highlighted!) PDF. Supports 150 languages and Textmate themes. }
10
+ gem.summary = %q{CodeRippa takes your source code and turns it into a beautiful PDF file. Currently, it supports 150 languages and 15 themes, all of which are available in TextMate. More syntaxes and themes will be available soon.}
11
11
  gem.homepage = "http://code-rippa.heroku.com"
12
12
  gem.has_rdoc = false
13
13
  gem.files = `git ls-files`.split($\)
@@ -1,3 +1,3 @@
1
1
  module CodeRippa
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/code_rippa.rb CHANGED
@@ -45,7 +45,7 @@ module CodeRippa
45
45
  Find.prune
46
46
  else
47
47
  begin
48
- puts ">> #{path}"
48
+
49
49
  is_rippable = rippable?(path, syntax, excluded_exts)
50
50
 
51
51
  if is_rippable
@@ -72,11 +72,6 @@ module CodeRippa
72
72
  end
73
73
 
74
74
  private
75
-
76
-
77
- def self.usage
78
- "Usage: code_rippa [options] file_or_directory"
79
- end
80
75
 
81
76
  def self.syntax_path
82
77
  Uv.syntax_path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_rippa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -239,7 +239,8 @@ rubyforge_project:
239
239
  rubygems_version: 1.8.21
240
240
  signing_key:
241
241
  specification_version: 3
242
- summary: Converts source code into a (bookmarked, themed, and syntax highlighted!)
243
- PDF. Supports 150 languages and Textmate themes.
242
+ summary: CodeRippa takes your source code and turns it into a beautiful PDF file.
243
+ Currently, it supports 150 languages and 15 themes, all of which are available in
244
+ TextMate. More syntaxes and themes will be available soon.
244
245
  test_files: []
245
246
  has_rdoc: false