dossier 2.12.1 → 2.12.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38e25b35de73b25b62fd2532e6a75a40ca1ada9c
4
- data.tar.gz: c14577c20f96aca152a179ca827bcae2753b5062
3
+ metadata.gz: 2e46d866c27e0bcc065d6fd0e0912ed6b1ecbb72
4
+ data.tar.gz: a76bd7e9487ae6de1114b5b9aa2ac32d616d11cd
5
5
  SHA512:
6
- metadata.gz: 6b3b33eaff2f0a2f82839a672ddd68cf6852be5524052e88ae7511071b003fff3451c6399601d8f7a75f53760b9e9f25108698adaab9c11ab158e8a7c4bc4c2a
7
- data.tar.gz: cffa2da9c307d3e78e479785839b210568ed066f9641c03fd1109b93129db9df8f00a5e946744c8c1f3b6385870b69fb3948544076660e09b990c89c3e342002
6
+ metadata.gz: 1a333bec0fa762f56180e6d2e6916dbd2043ee8d0dbc634d114a74a178702558e8d30afb22e22292fa46cdd3ec97fa98e25f3d7915487d6fb9e5216b0695fef4
7
+ data.tar.gz: 7ac2295c362089079c2010b20dea42c600f0c23dc8208a1d7040fd0d9d2308bc6646b17dc8e0340228054314a2639d6d98498fd7d129000e5cc90c947ae7fba0
@@ -1,5 +1,5 @@
1
- require 'cgi'
2
1
  require 'uri'
2
+ require 'rack/utils'
3
3
 
4
4
  module Dossier
5
5
  class ConnectionUrl
@@ -9,20 +9,27 @@ module Dossier
9
9
  def initialize(url = nil)
10
10
  @uri = URI.parse(url || ENV.fetch('DATABASE_URL'))
11
11
  end
12
-
12
+
13
13
  def to_hash
14
- query = CGI.parse(uri.query) if uri.query
15
- adapter = uri.scheme == "postgres" ? "postgresql" : uri.scheme
16
14
  {
17
15
  adapter: adapter,
16
+ username: uri.user,
17
+ password: uri.password,
18
18
  host: uri.host,
19
- database: File.basename(uri.path),
20
19
  port: uri.port,
21
- user: uri.user,
22
- password: uri.password,
23
- encoding: query && query['encoding'] ? query['encoding'][0] : nil,
24
- pool: (query && query['pool'] && query['pool'][0]) ? query['pool'][0].to_i : nil
25
- }.delete_if{|k,v| v.nil? }
20
+ database: File.basename(uri.path)
21
+ }.merge(params).reject { |k,v| v.nil? }
22
+ end
23
+
24
+ private
25
+
26
+ def adapter
27
+ uri.scheme == "postgres" ? "postgresql" : uri.scheme
28
+ end
29
+
30
+ def params
31
+ return {} unless uri.query
32
+ Rack::Utils.parse_nested_query(uri.query).symbolize_keys
26
33
  end
27
34
 
28
35
  end
@@ -21,7 +21,7 @@ module Dossier
21
21
  end
22
22
 
23
23
  def self.filename
24
- "#{report_name.parameterize}-report_#{Time.now.strftime('%m-%d-%Y_%H-%M-%S')}"
24
+ "#{report_name.parameterize}-report_#{Time.now.strftime('%Y-%m-%d_%H-%M-%S-%Z')}"
25
25
  end
26
26
 
27
27
  def initialize(options = {})
@@ -1,3 +1,3 @@
1
1
  module Dossier
2
- VERSION = "2.12.1"
2
+ VERSION = "2.12.2"
3
3
  end
@@ -2,11 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  describe Dossier::ConnectionUrl do
4
4
 
5
- let(:database_url) { "mysql2://root:password@127.0.0.1/myapp_development?encoding=utf8" }
6
-
7
5
  it "parses the url provided into a hash" do
6
+ database_url = "mysql2://root:password@127.0.0.1/myapp_development?encoding=utf8"
7
+
8
8
  connection_options = described_class.new(database_url).to_hash
9
- expected_options = { adapter: "mysql2", database: "myapp_development",user:"root",
9
+ expected_options = { adapter: "mysql2", database: "myapp_development", username:"root",
10
10
  password:"password", encoding:"utf8", host: "127.0.0.1"}
11
11
  expect(connection_options).to eq(expected_options)
12
12
  end
@@ -20,4 +20,26 @@ describe Dossier::ConnectionUrl do
20
20
  ENV["DATABASE_URL"] = old_db_url
21
21
  end
22
22
 
23
+ it "translates postgres" do
24
+ database_url = "postgres://user:secret@localhost/mydatabase"
25
+ connection_options = described_class.new(database_url).to_hash
26
+
27
+ expect(connection_options[:adapter]).to eq("postgresql")
28
+ end
29
+
30
+ it "supports additional options" do
31
+ database_url = "postgresql://user:secret@remotehost.example.org:3133/mydatabase?encoding=utf8&random_key=blah"
32
+ connection_options = described_class.new(database_url).to_hash
33
+
34
+ expect(connection_options[:encoding]).to eq("utf8")
35
+ expect(connection_options[:random_key]).to eq("blah")
36
+ expect(connection_options[:port]).to eq(3133)
37
+ end
38
+
39
+ it "drops empty values" do
40
+ database_url = "postgresql://localhost/mydatabase"
41
+ connection_options = described_class.new(database_url).to_hash
42
+ expect(connection_options.slice(:username, :password, :port)).to be_empty
43
+ end
44
+
23
45
  end
Binary file
@@ -705,3 +705,193 @@ Processing by SiteController#report as HTML
705
705
  SELECT * FROM employees WHERE 1=1
706
706
  ORDER BY name ASC
707
707
  Completed 200 OK in 5ms (Views: 2.8ms | ActiveRecord: 0.2ms)
708
+ ActiveRecord::SchemaMigration Load (41.4ms) SELECT `schema_migrations`.* FROM `schema_migrations`
709
+ FACTORY (6.4ms) CREATE DATABASE IF NOT EXISTS `dossier_test`
710
+ FACTORY (22.1ms) DROP TABLE IF EXISTS `employees`
711
+ FACTORY (42.2ms) CREATE TABLE `employees` (
712
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
713
+ `name` varchar(255) NOT NULL,
714
+ `division` varchar(255) NOT NULL,
715
+ `salary` int(11) NOT NULL,
716
+ `suspended` tinyint(1) NOT NULL DEFAULT 0,
717
+ `hired_on` date NOT NULL,
718
+ PRIMARY KEY (`id`)
719
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
720
+
721
+ FACTORY (165.1ms) TRUNCATE `employees`
722
+ FACTORY (2.8ms) INSERT INTO
723
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
724
+ VALUES ('Moustafa McMann', '2010-10-02', false, 'Zany Inventions', 30000);
725
+
726
+ FACTORY (1.5ms)  INSERT INTO
727
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
728
+ VALUES ('Jimmy Jackalope, Jr.', '2013-01-11', true, 'Tedious Toiling', 20000);
729
+ 
730
+ FACTORY (1.5ms) INSERT INTO
731
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
732
+ VALUES ('Elise Elderberry', '2013-01-11', false, 'Corporate Malfeasance', 99000);
733
+
734
+ FACTORY (2.2ms) DROP TABLE IF EXISTS `employees`
735
+ FACTORY (0.8ms) CREATE TABLE `employees` (
736
+ `id` INTEGER PRIMARY KEY AUTOINCREMENT,
737
+ `name` TEXT NOT NULL,
738
+ `division` TEXT NOT NULL,
739
+ `salary` INTEGER NOT NULL,
740
+ `suspended` TINYINT NOT NULL DEFAULT 0,
741
+ `hired_on` DATE NOT NULL
742
+ );
743
+
744
+ FACTORY (0.6ms) DELETE FROM `employees`
745
+ FACTORY (0.8ms) INSERT INTO
746
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
747
+ VALUES ('MOUSTAFA MCMANN', '2010-10-02', 0, 'Zany Inventions', 30000);
748
+
749
+ FACTORY (0.7ms)  INSERT INTO
750
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
751
+ VALUES ('JIMMY JACKALOPE, JR.', '2013-01-11', 1, 'Tedious Toiling', 20000);
752
+ 
753
+ FACTORY (0.9ms) INSERT INTO
754
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
755
+ VALUES ('ELISE ELDERBERRY', '2013-01-11', 0, 'Corporate Malfeasance', 99000);
756
+
757
+ EmployeeReport (4.1ms) 
758
+ SELECT * FROM employees WHERE 1=1
759
+ ORDER BY name ASC
760
+ Started GET "/employee_report_custom_controller" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
761
+ Processing by SiteController#report as HTML
762
+ EmployeeReport (0.2ms)
763
+ SELECT * FROM employees WHERE 1=1
764
+ ORDER BY name ASC
765
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml (18.2ms)
766
+ Completed 200 OK in 29ms (Views: 26.6ms | ActiveRecord: 0.2ms)
767
+ Started GET "/reports/employee_with_custom_client" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
768
+ Processing by Dossier::ReportsController#show as HTML
769
+ Parameters: {"report"=>"employee_with_custom_client"}
770
+ EmployeeWithCustomClientReport (0.2ms) 
771
+ SELECT * FROM `employees`
772
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml (2.0ms)
773
+ Completed 200 OK in 5ms (Views: 2.4ms | ActiveRecord: 0.2ms)
774
+ Started GET "/reports/cats/are/super_fun" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
775
+ Processing by Dossier::ReportsController#show as HTML
776
+ Parameters: {"report"=>"cats/are/super_fun"}
777
+ Cats::Are::SuperFunReport (0.1ms)
778
+ select 'cats', 'are', 'super', 'fun'
779
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml (3.3ms)
780
+ Completed 200 OK in 7ms (Views: 3.4ms | ActiveRecord: 0.1ms)
781
+ Started GET "/reports/employee.xls" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
782
+ Processing by Dossier::ReportsController#show as XLS
783
+ Parameters: {"report"=>"employee"}
784
+ EmployeeReport (0.3ms) 
785
+ SELECT * FROM employees WHERE 1=1
786
+ ORDER BY name ASC
787
+ Completed 200 OK in 4ms (ActiveRecord: 0.3ms)
788
+ Started GET "/reports/employee.csv" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
789
+ Processing by Dossier::ReportsController#show as CSV
790
+ Parameters: {"report"=>"employee"}
791
+ EmployeeReport (0.3ms)
792
+ SELECT * FROM employees WHERE 1=1
793
+ ORDER BY name ASC
794
+ Completed 200 OK in 4ms (ActiveRecord: 0.2ms)
795
+ Started GET "/reports/employee" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
796
+ Processing by Dossier::ReportsController#show as HTML
797
+ Parameters: {"report"=>"employee"}
798
+ EmployeeReport (6.0ms) 
799
+ SELECT * FROM employees WHERE 1=1
800
+ ORDER BY name ASC
801
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml (10.4ms)
802
+ Completed 200 OK in 12ms (Views: 4.8ms | ActiveRecord: 6.0ms)
803
+ Started GET "/reports/employee?options[divisions][]=Tedious+Toiling&options[names][]=Jimmy+Jackalope&options[names][]=Moustafa+McMann&options[order]=desc&options[salary]=true" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
804
+ Processing by Dossier::ReportsController#show as HTML
805
+ Parameters: {"options"=>{"divisions"=>["Tedious Toiling"], "names"=>["Jimmy Jackalope", "Moustafa McMann"], "order"=>"desc", "salary"=>"true"}, "report"=>"employee"}
806
+ EmployeeReport (3.5ms)
807
+ SELECT * FROM employees WHERE 1=1
808
+ AND division in (('Tedious Toiling'))
809
+ AND salary > 10000
810
+ AND (name like '%Moustafa McMann%' or name like '%Jimmy Jackalope%')
811
+ ORDER BY name DESC
812
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml (7.8ms)
813
+ Completed 200 OK in 9ms (Views: 4.6ms | ActiveRecord: 3.5ms)
814
+ Started GET "/reports/employee?options[footer]=1" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
815
+ Processing by Dossier::ReportsController#show as HTML
816
+ Parameters: {"options"=>{"footer"=>"1"}, "report"=>"employee"}
817
+ EmployeeReport (0.3ms) 
818
+ SELECT * FROM employees WHERE 1=1
819
+ ORDER BY name ASC
820
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml (6.2ms)
821
+ Completed 200 OK in 7ms (Views: 6.2ms | ActiveRecord: 0.3ms)
822
+ Started GET "/reports/employee_with_custom_view" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
823
+ Processing by Dossier::ReportsController#show as HTML
824
+ Parameters: {"report"=>"employee_with_custom_view"}
825
+ Rendered dossier/reports/employee_with_custom_view/_options.html.haml (5.1ms)
826
+ EmployeeWithCustomViewReport (0.2ms)
827
+ SELECT * FROM employees WHERE suspended = true
828
+ Rendered dossier/reports/employee_with_custom_view.html.haml (10.3ms)
829
+ Completed 200 OK in 12ms (Views: 11.2ms | ActiveRecord: 0.2ms)
830
+ Started GET "/reports/employee_with_custom_view" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
831
+ Processing by Dossier::ReportsController#show as HTML
832
+ Parameters: {"report"=>"employee_with_custom_view"}
833
+ Rendered dossier/reports/employee_with_custom_view/_options.html.haml (1.7ms)
834
+ EmployeeWithCustomViewReport (0.3ms) 
835
+ SELECT * FROM employees WHERE suspended = true
836
+ Rendered dossier/reports/employee_with_custom_view.html.haml (6.3ms)
837
+ Completed 200 OK in 8ms (Views: 6.4ms | ActiveRecord: 0.3ms)
838
+ Started GET "/reports/employee" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
839
+ Processing by Dossier::ReportsController#show as HTML
840
+ Parameters: {"report"=>"employee"}
841
+ EmployeeReport (0.2ms)
842
+ SELECT * FROM employees WHERE 1=1
843
+ ORDER BY name ASC
844
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml (5.0ms)
845
+ Completed 200 OK in 6ms (Views: 5.1ms | ActiveRecord: 0.2ms)
846
+ Started GET "/multi/reports/combination" for 127.0.0.1 at 2014-12-15 09:54:47 -0500
847
+ Processing by Dossier::ReportsController#multi as HTML
848
+ Parameters: {"report"=>"combination"}
849
+ Rendered dossier/reports/combination/_options.html.haml (3.6ms)
850
+ EmployeeReport (0.4ms) 
851
+ SELECT * FROM employees WHERE 1=1
852
+ ORDER BY name ASC
853
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml (17.0ms)
854
+ EmployeeWithCustomViewReport (0.2ms)
855
+ SELECT * FROM employees WHERE suspended = true
856
+ Rendered dossier/reports/employee_with_custom_view.html.haml (2.3ms)
857
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/multi.html.haml (39.9ms)
858
+ Completed 200 OK in 42ms (Views: 40.6ms | ActiveRecord: 0.6ms)
859
+ Started GET "/multi/reports/combination" for 127.0.0.1 at 2014-12-15 09:54:48 -0500
860
+ Processing by Dossier::ReportsController#multi as HTML
861
+ Parameters: {"report"=>"combination"}
862
+ Rendered dossier/reports/combination/_options.html.haml (0.9ms)
863
+ EmployeeReport (0.2ms) 
864
+ SELECT * FROM employees WHERE 1=1
865
+ ORDER BY name ASC
866
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml (3.9ms)
867
+ EmployeeWithCustomViewReport (0.2ms)
868
+ SELECT * FROM employees WHERE suspended = true
869
+ Rendered dossier/reports/employee_with_custom_view.html.haml (1.3ms)
870
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/multi.html.haml (7.1ms)
871
+ Completed 200 OK in 8ms (Views: 7.0ms | ActiveRecord: 0.4ms)
872
+ Started GET "/multi/reports/combination" for 127.0.0.1 at 2014-12-15 09:54:48 -0500
873
+ Processing by Dossier::ReportsController#multi as HTML
874
+ Parameters: {"report"=>"combination"}
875
+ Rendered dossier/reports/combination/_options.html.haml (1.0ms)
876
+ EmployeeReport (0.2ms) 
877
+ SELECT * FROM employees WHERE 1=1
878
+ ORDER BY name ASC
879
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml (5.0ms)
880
+ EmployeeWithCustomViewReport (0.3ms)
881
+ SELECT * FROM employees WHERE suspended = true
882
+ Rendered dossier/reports/employee_with_custom_view.html.haml (1.2ms)
883
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/multi.html.haml (8.5ms)
884
+ Completed 200 OK in 10ms (Views: 8.3ms | ActiveRecord: 0.5ms)
885
+ Started GET "/multi/reports/combination.csv" for 127.0.0.1 at 2014-12-15 09:54:48 -0500
886
+ Processing by Dossier::ReportsController#multi as CSV
887
+ Parameters: {"report"=>"combination"}
888
+ Completed 500 Internal Server Error in 1ms
889
+ EmployeeReport (0.2ms) 
890
+ SELECT * FROM employees WHERE 1=1
891
+ ORDER BY name ASC
892
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml within dossier/layouts/application (8.4ms)
893
+ EmployeeReport (0.2ms)
894
+ SELECT * FROM employees WHERE 1=1
895
+ ORDER BY name ASC
896
+ Rendered /Users/adamhunter/Studio/github/dossier/app/views/dossier/reports/show.html.haml within dossier/layouts/application (3.6ms)
897
+ Rendered dossier/reports/employee_with_custom_view/_options.html.haml (3.2ms)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dossier
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.1
4
+ version: 2.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Hunter
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-06-05 00:00:00.000000000 Z
13
+ date: 2014-12-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: arel
@@ -221,7 +221,6 @@ files:
221
221
  - MIT-LICENSE
222
222
  - README.md
223
223
  - Rakefile
224
- - app/assets/javascripts/dossier/application.js
225
224
  - app/assets/stylesheets/dossier/application.css
226
225
  - app/controllers/dossier/application_controller.rb
227
226
  - app/controllers/dossier/reports_controller.rb
@@ -1,15 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // the compiled file.
9
- //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require_tree .