jasper-command-line 0.1.2 → 0.1.4

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/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/CHANGELOG ADDED
File without changes
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ gem 'activesupport', '>= 3.2.0'
6
+ gem 'rjb', '>= 1.4.0'
7
+ gem 'builder', '>= 3.0.3'
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (C) 2012 Pedro Rodrigues
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ jasper-command-line
2
+ ===================
3
+
4
+ Print a jasper document via the command line
5
+
6
+ **Disclaimer**: This is almost completely based on the great work by [Fortes Informática](https://github.com/fortesinformatica), with the gem [jasper-rails](https://github.com/fortesinformatica/jasper-rails). I built this out of necessity for a project that wouldn't run [jasper-rails](https://github.com/fortesinformatica/jasper-rails) on top of Ubuntu + nginx + Passenger.
7
+
8
+ This gem embeds the .jar files provided by [jasper-rails](https://github.com/fortesinformatica/jasper-rails), so you don't need to include the gem ([jasper-rails](https://github.com/fortesinformatica/jasper-rails) requires the whole Ruby on Rails framework, which isn't necessary in this case).
9
+
10
+ ## Dependencies
11
+
12
+ * You need a Java Virtual Machine installed and set up in order to use this gem.
13
+ * [rjb](http://rjb.rubyforge.org/) >= 1.4.0
14
+ * [builder](https://rubygems.org/gems/builder) >= 3.0.3
15
+ * [activesupport](https://rubygems.org/gems/activesupport) >= 3.2.0
16
+
17
+ ## Install
18
+
19
+ ```
20
+ gem install jasper-command-line
21
+ ```
22
+
23
+ ## Configure
24
+
25
+ If invoking jasper-command-line via a Rails project, you might need to add `jasper-command-line` to your Gemfile:
26
+
27
+ ```ruby
28
+ gem "jasper-command-line"
29
+ ```
30
+
31
+ ## Using jasper-command-line
32
+
33
+ ```
34
+ jasper-command-line [options]
35
+
36
+ Options:
37
+ --jasper /path/to/file The .jasper file to load (if one doesn't exist, it is
38
+ compiled from the .jrxml file with the same name and
39
+ on the same location)
40
+ --data-file /path/to/file The .xml file to load the data from
41
+ --param key=value Adds the parameter with name key with the value value
42
+ (can be defined multiple times)
43
+ ```
44
+ ## LICENSE
45
+
46
+ Copyright (C) 2012 Pedro Rodrigues
47
+
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of this software and associated documentation files (the
50
+ "Software"), to deal in the Software without restriction, including
51
+ without limitation the rights to use, copy, modify, merge, publish,
52
+ distribute, sublicense, and/or sell copies of the Software, and to
53
+ permit persons to whom the Software is furnished to do so, subject to
54
+ the following conditions:
55
+
56
+ The above copyright notice and this permission notice shall be
57
+ included in all copies or substantial portions of the Software.
58
+
59
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
60
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
61
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
62
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
63
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
64
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
65
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require "jasper-command-line/version"
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "jasper-command-line"
9
+ s.version = JasperCommandLine::VERSION
10
+ s.authors = ["Pedro Rodrigues"]
11
+ s.email = ["pedro@bbde.org"]
12
+ s.homepage = "http://github.com/gokuu/jasper-command-line"
13
+ s.summary = "Use jasper-rails from the command line."
14
+ s.description = "Use jasper-rails from the command line."
15
+
16
+ s.add_dependency('rjb', '>= 1.4.0')
17
+ s.add_dependency('builder', '>= 3.0.3')
18
+ s.add_dependency('activesupport', '>= 3.2.0')
19
+ s.add_development_dependency("rspec", "~> 2.7")
20
+ s.add_development_dependency("rake", "~> 0.9.2")
21
+
22
+ s.files = `git ls-files`.split("\n")
23
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
+ s.require_paths = ["lib"]
26
+ end
@@ -4,8 +4,23 @@ module JasperCommandLine
4
4
  begin
5
5
  options = parse_arguments(args)
6
6
 
7
- if options[:jasper_file]
8
- puts JasperCommandLine::Jasper::render_pdf(options[:jasper_file], options[:data], options[:params], {})
7
+ if !options
8
+ puts "Usage:"
9
+ puts ""
10
+ puts "jasper-command-line [options]"
11
+ puts ""
12
+ puts "Options:"
13
+ puts ""
14
+ puts "--jasper /path/to/file The .jasper file to load (if one doesn't exist, it is"
15
+ puts " compiled from the .jrxml file with the same name and"
16
+ puts " on the same location)"
17
+ puts "--data-file /path/to/file The .xml file to load the data from"
18
+ puts "--param key=value Adds the parameter with name key with the value value"
19
+ puts " (can be defined multiple times)"
20
+ else
21
+ if options[:jasper_file]
22
+ puts JasperCommandLine::Jasper::render_pdf(options[:jasper_file], options[:data], options[:params], {})
23
+ end
9
24
  end
10
25
  rescue ArgumentError => e
11
26
  puts "Error: #{e.message}"
@@ -22,7 +37,7 @@ module JasperCommandLine
22
37
  :params => {}
23
38
  }
24
39
 
25
- raise ArgumentError.new("No arguments supplied") unless arguments.any?
40
+ return false unless arguments.any?
26
41
 
27
42
  i = 0
28
43
 
@@ -51,7 +66,7 @@ module JasperCommandLine
51
66
  when 'jasper'
52
67
  # Or a file
53
68
  i = get_option_data(arguments, i) do |argument_data|
54
- raise ArgumentError.new("File not found: #{argument_data}") unless File.exists?(argument_data)
69
+ raise ArgumentError.new("File not found: #{argument_data}") unless File.exists?(argument_data) || File.exists?(argument_data.gsub(/\.jasper$/, '.jrxml'))
55
70
  data[:jasper_file] = argument_data
56
71
  end
57
72
 
@@ -1,3 +1,3 @@
1
1
  module JasperCommandLine
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -1,11 +1,6 @@
1
1
  $LOAD_PATH.unshift File.dirname(__FILE__)
2
2
 
3
3
  require 'logger'
4
- require 'stringio'
5
- require 'shellwords'
6
- require 'open3'
7
- require 'awesome_print'
8
- require 'fileutils'
9
4
  require "rjb"
10
5
  require 'active_support/core_ext'
11
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasper-command-line
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000 Z
12
+ date: 2012-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rjb
@@ -27,6 +27,38 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 1.4.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: builder
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 3.0.3
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 3.0.3
46
+ - !ruby/object:Gem::Dependency
47
+ name: activesupport
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 3.2.0
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 3.2.0
30
62
  - !ruby/object:Gem::Dependency
31
63
  name: rspec
32
64
  requirement: !ruby/object:Gem::Requirement
@@ -67,6 +99,14 @@ executables:
67
99
  extensions: []
68
100
  extra_rdoc_files: []
69
101
  files:
102
+ - .gitignore
103
+ - CHANGELOG
104
+ - Gemfile
105
+ - LICENSE
106
+ - README.md
107
+ - bin/jasper-command-line
108
+ - jasper-command-line.gemspec
109
+ - lib/jasper-command-line.rb
70
110
  - lib/jasper-command-line/command_line.rb
71
111
  - lib/jasper-command-line/jasper.rb
72
112
  - lib/jasper-command-line/java/commons-beanutils-1.8.2.jar
@@ -80,8 +120,6 @@ files:
80
120
  - lib/jasper-command-line/java/jfreechart-1.0.12.jar
81
121
  - lib/jasper-command-line/java/xalan.jar
82
122
  - lib/jasper-command-line/version.rb
83
- - lib/jasper-command-line.rb
84
- - bin/jasper-command-line
85
123
  homepage: http://github.com/gokuu/jasper-command-line
86
124
  licenses: []
87
125
  post_install_message: