bc-to_xls 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile ADDED
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ begin
3
+ require 'jeweler'
4
+ rescue LoadError
5
+ puts "Jeweler not available. Install it with: sudo gem install jeweler"
6
+ exit 1
7
+ end
8
+ require 'rake/testtask'
9
+ require 'rake/rdoctask'
10
+ require 'rcov/rcovtask'
11
+
12
+ Jeweler::Tasks.new do |s|
13
+ s.name = "bc-to_xls"
14
+ s.summary = "to_xls from http://github.com/arydjmal/to_xls with i18n support"
15
+ s.description = s.summary
16
+ s.email = "info@byclosure.com"
17
+ s.homepage = "http://github.com/Byclosure/to_xls"
18
+ s.authors = ["João Jesus", "Vasco Andrade e Silva"]
19
+ s.add_dependency "activerecord", ['>= 1.1']
20
+ s.has_rdoc = true
21
+ s.extra_rdoc_files = [ "README.rdoc"]
22
+ s.rdoc_options = ["--main", "README.rdoc", "--inline-source", "--line-numbers"]
23
+ s.test_files = Dir['test/**/*.{yml,rb}']
24
+ end
25
+ Jeweler::GemcutterTasks.new
26
+
27
+ desc 'Default: run unit tests.'
28
+ task :default => :test
29
+
30
+ desc 'Test the awesome_nested_set plugin.'
31
+ Rake::TestTask.new(:test) do |t|
32
+ t.libs += ['lib', 'test']
33
+ t.pattern = 'test/**/*_test.rb'
34
+ t.verbose = true
35
+ end
36
+
37
+ desc 'Generate documentation for the awesome_nested_set plugin.'
38
+ Rake::RDocTask.new(:rdoc) do |rdoc|
39
+ rdoc.rdoc_dir = 'rdoc'
40
+ rdoc.title = 'ToXls'
41
+ rdoc.options << '--line-numbers' << '--inline-source'
42
+ rdoc.rdoc_files.include('README.rdoc')
43
+ rdoc.rdoc_files.include('lib/**/*.rb')
44
+ end
45
+
46
+ namespace :test do
47
+ desc "just rcov minus html output"
48
+ Rcov::RcovTask.new(:coverage) do |t|
49
+ t.libs << 'test'
50
+ t.test_files = FileList['test/**/*_test.rb']
51
+ t.output_dir = 'coverage'
52
+ t.verbose = true
53
+ t.rcov_opts = %w(--exclude test,/usr/lib/ruby,/Library/Ruby --sort coverage)
54
+ end
55
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
data/bc-to_xls.gemspec ADDED
@@ -0,0 +1,58 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{bc-to_xls}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jo\303\243o Jesus", "Vasco Andrade e Silva"]
12
+ s.date = %q{2010-02-12}
13
+ s.description = %q{to_xls from http://github.com/arydjmal/to_xls with i18n support}
14
+ s.email = %q{info@byclosure.com}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ "MIT-LICENSE",
20
+ "README.rdoc",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "bc-to_xls.gemspec",
24
+ "lib/to_xls.rb",
25
+ "rails/init.rb",
26
+ "test/db/database.yml",
27
+ "test/db/schema.rb",
28
+ "test/test_helper.rb",
29
+ "test/to_xls_test.rb",
30
+ "test/user_model.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/Byclosure/to_xls}
33
+ s.rdoc_options = ["--main", "README.rdoc", "--inline-source", "--line-numbers"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.3.5}
36
+ s.summary = %q{to_xls from http://github.com/arydjmal/to_xls with i18n support}
37
+ s.test_files = [
38
+ "test/db/database.yml",
39
+ "test/db/schema.rb",
40
+ "test/test_helper.rb",
41
+ "test/to_xls_test.rb",
42
+ "test/user_model.rb"
43
+ ]
44
+
45
+ if s.respond_to? :specification_version then
46
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
+ s.specification_version = 3
48
+
49
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
+ s.add_runtime_dependency(%q<activerecord>, [">= 1.1"])
51
+ else
52
+ s.add_dependency(%q<activerecord>, [">= 1.1"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<activerecord>, [">= 1.1"])
56
+ end
57
+ end
58
+
data/lib/to_xls.rb CHANGED
@@ -4,8 +4,8 @@ class Array
4
4
  output = '<?xml version="1.0" encoding="UTF-8"?><Workbook xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office"><Worksheet ss:Name="Sheet1"><Table>'
5
5
 
6
6
  if self.any?
7
-
8
- attributes = self.first.attributes.keys.map { |c| c.to_sym }
7
+ instance = self.first
8
+ attributes = instance.attributes.keys.map { |c| c.to_sym }
9
9
 
10
10
  if options[:only]
11
11
  # the "& attributes" get rid of invalid columns
@@ -19,7 +19,7 @@ class Array
19
19
  if columns.any?
20
20
  unless options[:headers] == false
21
21
  output << "<Row>"
22
- columns.each { |column| output << "<Cell><Data ss:Type=\"String\">#{self.class.human_attribute_name(column)}</Data></Cell>" }
22
+ columns.each { |column| output << "<Cell><Data ss:Type=\"String\">#{instance.class.human_attribute_name(column)}</Data></Cell>" }
23
23
  output << "</Row>"
24
24
  end
25
25
 
@@ -0,0 +1,18 @@
1
+ sqlite3:
2
+ adapter: sqlite3
3
+ database: to_xls.sqlite3.db
4
+ sqlite3mem:
5
+ adapter: sqlite3
6
+ database: ":memory:"
7
+ postgresql:
8
+ adapter: postgresql
9
+ username: postgres
10
+ password: postgres
11
+ database: to_xls_test
12
+ min_messages: ERROR
13
+ mysql:
14
+ adapter: mysql
15
+ host: localhost
16
+ username: root
17
+ password:
18
+ database: to_xls_test
data/test/db/schema.rb ADDED
@@ -0,0 +1,7 @@
1
+ ActiveRecord::Schema.define(:version => 0) do
2
+
3
+ create_table :users, :force => true do |t|
4
+ t.column :name, :string
5
+ t.column :age, :integer
6
+ end
7
+ end
data/test/test_helper.rb CHANGED
@@ -4,10 +4,8 @@ RAILS_ROOT = plugin_test_dir
4
4
 
5
5
  require 'rubygems'
6
6
  require 'test/unit'
7
- require 'multi_rails_init'
8
- require 'test_help'
9
7
 
10
- require plugin_test_dir + '/../init.rb'
8
+ require plugin_test_dir + '/../rails/init.rb'
11
9
 
12
10
  TestCaseClass = ActiveSupport::TestCase rescue Test::Unit::TestCase
13
11
 
@@ -24,6 +22,4 @@ class TestCaseClass #:nodoc:
24
22
  self.fixture_path = File.dirname(__FILE__) + "/fixtures/"
25
23
  self.use_transactional_fixtures = true
26
24
  self.use_instantiated_fixtures = false
27
-
28
- fixtures :categories, :notes, :departments
29
25
  end
data/test/to_xls_test.rb CHANGED
@@ -1,9 +1,6 @@
1
- require 'test/unit'
2
- require 'rubygems'
3
- require File.dirname(__FILE__) + '/../lib/to_xls'
4
- require File.dirname(__FILE__) + '/user_model'
1
+ require 'test_helper'
5
2
 
6
- class ToXlsTest < Test::Unit::TestCase
3
+ class ToXlsTest < TestCaseClass
7
4
 
8
5
  def setup
9
6
  @users = []
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bc-to_xls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jo\xC3\xA3o Jesus"
@@ -34,9 +34,14 @@ extra_rdoc_files:
34
34
  files:
35
35
  - MIT-LICENSE
36
36
  - README.rdoc
37
+ - Rakefile
37
38
  - VERSION
39
+ - bc-to_xls.gemspec
38
40
  - lib/to_xls.rb
39
41
  - rails/init.rb
42
+ - test/db/database.yml
43
+ - test/db/schema.rb
44
+ - test/test_helper.rb
40
45
  - test/to_xls_test.rb
41
46
  - test/user_model.rb
42
47
  has_rdoc: true
@@ -71,6 +76,8 @@ signing_key:
71
76
  specification_version: 3
72
77
  summary: to_xls from http://github.com/arydjmal/to_xls with i18n support
73
78
  test_files:
79
+ - test/db/database.yml
80
+ - test/db/schema.rb
74
81
  - test/test_helper.rb
75
82
  - test/to_xls_test.rb
76
83
  - test/user_model.rb