duffy 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/README.md +1 -2
- data/lib/duffy/beast_mode_helper.rb +3 -2
- data/lib/duffy/duffy_helper.rb +2 -0
- data/lib/duffy/version.rb +3 -2
- data/spec/date_spec.rb +4 -4
- data/spec/git_spec.rb +3 -3
- data/spec/nilclass_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -4
- data/spec/string_spec.rb +15 -15
- data/spec/system_spec.rb +4 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f500ee475e148d1e0f37aeaead04c15e0f280d03
|
4
|
+
data.tar.gz: a572c350b1398456699d20ce7eac3d39a4cdd667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b1595e172f2769dfb763a91129997db94be1cd0687d151ceb83d1d66b52543884ec3c9a540e7480bee7b9a18f47f28fdd4b5a8e64ab9d1dd93ee981539446bd
|
7
|
+
data.tar.gz: be4334f85f1c7fcd3d1395de5acf818633d9b659c7262d1d7e32e0f4d532c71080c97c338d26d886026a3270ebeed93a2be93789252cbdae86217ab7641a8605
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Duffy
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/duffyjp/duffy.svg?branch=master)](https://travis-ci.org/duffyjp/duffy)
|
3
4
|
[![Code Climate](https://codeclimate.com/github/duffyjp/duffy/badges/gpa.svg)](https://codeclimate.com/github/duffyjp/duffy)
|
4
5
|
[![Test Coverage](https://codeclimate.com/github/duffyjp/duffy/badges/coverage.svg)](https://codeclimate.com/github/duffyjp/duffy/coverage)
|
5
6
|
|
@@ -89,8 +90,6 @@ Duffy::System.cpu_percent| 16%
|
|
89
90
|
Method | Example | Result
|
90
91
|
------------|-------------------------------------|-------
|
91
92
|
beast_mode | beast_mode tags | renders tag partial in parallel. Only available if you have the Parallel gem in your Gemfile. You must also wrap your partial in a cache block.
|
92
|
-
excel_icon | excel_icon | generates hyperlinked excel.png in an li block to .xlsx version of current page or passed link. Maintains current GET params.
|
93
|
-
icon | icon("tags", tags_path) | generates link of class "icon" with the title and link provided. also sets id based on controller and action |
|
94
93
|
menu_tag | menu_tag("Login", login_path) | generated hyperlinked li block used in common ul based navigation toolbars.
|
95
94
|
|
96
95
|
|
@@ -29,13 +29,14 @@ module BeastModeHelper
|
|
29
29
|
|
30
30
|
|
31
31
|
# silently render each partial as quickly as possible. It's up to you to include a cache block!
|
32
|
-
|
32
|
+
# "in_processes: nil" tells Parallel to use Processes instead of Threads, and self-determine the count.
|
33
|
+
Parallel.each(collection, in_processes: nil) do |object|
|
33
34
|
render(partial: partial, object: object)
|
34
35
|
end
|
35
36
|
else
|
36
37
|
# eg: beast_mode(@jobs)
|
37
38
|
# Generate the Cache fragments for each object in parallel as fast as possible, but don't show them yet
|
38
|
-
Parallel.each(options, in_processes:
|
39
|
+
Parallel.each(options, in_processes: nil) do |object|
|
39
40
|
render(object)
|
40
41
|
end
|
41
42
|
end
|
data/lib/duffy/duffy_helper.rb
CHANGED
@@ -12,6 +12,7 @@ module DuffyHelper
|
|
12
12
|
# Add a yield(:excel) somewhere in your application layout:
|
13
13
|
# content_tag( :li, yield(:excel), class: :excel) if content_for?(:excel)
|
14
14
|
def excel_icon(link = params.merge(format: "xlsx"))
|
15
|
+
ActiveSupport::Deprecation.warn('This method will be removed without replacement in future versions')
|
15
16
|
content_for :excel do
|
16
17
|
link_to(image_tag('excel.png'), link)
|
17
18
|
end
|
@@ -24,6 +25,7 @@ module DuffyHelper
|
|
24
25
|
# - This is application specific and will just not do anything if it runs into a problem
|
25
26
|
# If any uncaught exceptions are thrown in production you'll just get nothing, otherwise you'll get the error on screen.
|
26
27
|
def icon(title, link, options = {})
|
28
|
+
ActiveSupport::Deprecation.warn('This method will be removed without replacement in future versions')
|
27
29
|
begin
|
28
30
|
options[:id] = "icon_#{link.parameterize("_")}" unless link.blank?
|
29
31
|
options[:class] = [:icon] << options[:class]
|
data/lib/duffy/version.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Duffy
|
2
|
-
VERSION = "0.2.
|
2
|
+
VERSION = "0.2.7"
|
3
3
|
end
|
4
4
|
|
5
5
|
# History
|
6
|
+
# 0.2.7 - Deprecated "icon" and "excel_icon"
|
6
7
|
# 0.2.6 - Added cpu_percent to give the current total CPU usage percentage.
|
7
8
|
# 0.2.5 - Added beast_mode helper to render partials in parallel
|
8
|
-
# 0.2.4 - Added NilClass.to_date => nil
|
9
|
+
# 0.2.4 - Added NilClass.to_date => nil
|
data/spec/date_spec.rb
CHANGED
@@ -4,19 +4,19 @@ describe Date do
|
|
4
4
|
describe "fiscal_year (Assuming July 1st Start)" do
|
5
5
|
|
6
6
|
it "2000-07-01 => 2001" do
|
7
|
-
Date.new(2000,7,1).fiscal_year.
|
7
|
+
expect(Date.new(2000,7,1).fiscal_year).to eq(2001)
|
8
8
|
end
|
9
9
|
|
10
10
|
it "2000-06-30 => 2000" do
|
11
|
-
Date.new(2000,6,30).fiscal_year.
|
11
|
+
expect(Date.new(2000,6,30).fiscal_year).to eq(2000)
|
12
12
|
end
|
13
13
|
|
14
14
|
it "2000-01-01 => 2000" do
|
15
|
-
Date.new(2000,1,1).fiscal_year.
|
15
|
+
expect(Date.new(2000,1,1).fiscal_year).to eq(2000)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "1999-12-31 => 2000" do
|
19
|
-
Date.new(1999,12,31).fiscal_year.
|
19
|
+
expect(Date.new(1999,12,31).fiscal_year).to eq(2000)
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
data/spec/git_spec.rb
CHANGED
@@ -5,19 +5,19 @@ describe Duffy::Git do
|
|
5
5
|
# This generates the documentation more than anything.
|
6
6
|
describe "log" do
|
7
7
|
it "returns the git log" do
|
8
|
-
defined?(Duffy::Git.log).
|
8
|
+
expect(defined?(Duffy::Git.log)).to eq("method")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "count" do
|
13
13
|
it "returns the git count" do
|
14
|
-
defined?(Duffy::Git.count).
|
14
|
+
expect(defined?(Duffy::Git.count)).to eq("method")
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe "email" do
|
19
19
|
it "returns the git user.email" do
|
20
|
-
defined?(Duffy::Git.email).
|
20
|
+
expect(defined?(Duffy::Git.email)).to eq("method")
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/spec/nilclass_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/string_spec.rb
CHANGED
@@ -4,70 +4,70 @@ describe String do
|
|
4
4
|
|
5
5
|
describe "to_ssn" do
|
6
6
|
it "maintains an already formatted SSN" do
|
7
|
-
"123-45-6789".to_ssn.
|
7
|
+
expect("123-45-6789".to_ssn).to eq("123-45-6789")
|
8
8
|
end
|
9
9
|
|
10
10
|
it "formats a ssn with leading zero properly" do
|
11
|
-
"078051120".to_ssn.
|
11
|
+
expect("078051120".to_ssn).to eq("078-05-1120")
|
12
12
|
end
|
13
13
|
|
14
14
|
it "formats an unformatted SSN" do
|
15
|
-
"123456789".to_ssn.
|
15
|
+
expect("123456789".to_ssn).to eq("123-45-6789")
|
16
16
|
end
|
17
17
|
|
18
18
|
it "adds leading zeros to 8 digit SSNs (yes, they exist)" do
|
19
|
-
"12345678".to_ssn.
|
19
|
+
expect("12345678".to_ssn).to eq("012-34-5678")
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should correctly add leading zeroes to short SSNs that start with 0" do
|
23
|
-
"01".to_ssn.
|
24
|
-
"1".to_ssn.
|
23
|
+
expect("01".to_ssn).to eq("000-00-0001")
|
24
|
+
expect("1".to_ssn).to eq("000-00-0001")
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "sanitize_ssn" do
|
29
29
|
|
30
30
|
it "123456789 => 123456789" do
|
31
|
-
"123456789".sanitize_ssn.
|
31
|
+
expect("123456789".sanitize_ssn).to eq("123456789")
|
32
32
|
# Good
|
33
33
|
end
|
34
34
|
|
35
35
|
it "123-45-6789 => 123456789" do
|
36
|
-
"123-45-6789".sanitize_ssn.
|
36
|
+
expect("123-45-6789".sanitize_ssn).to eq("123456789")
|
37
37
|
# Good
|
38
38
|
end
|
39
39
|
|
40
40
|
it "000-12-3456 => nil" do
|
41
|
-
"000-12-3456".sanitize_ssn.
|
41
|
+
expect("000-12-3456".sanitize_ssn).to eq(nil)
|
42
42
|
# Invalid Area
|
43
43
|
end
|
44
44
|
|
45
45
|
it "078051120 => 078051120 " do
|
46
|
-
"078051120".sanitize_ssn.
|
46
|
+
expect("078051120".sanitize_ssn).to eq("078051120")
|
47
47
|
end
|
48
48
|
|
49
49
|
it "666123456 => nil" do
|
50
|
-
"666123456".sanitize_ssn.
|
50
|
+
expect("666123456".sanitize_ssn).to eq(nil)
|
51
51
|
# Invalid Area
|
52
52
|
end
|
53
53
|
|
54
54
|
it "derp => nil" do
|
55
|
-
"derp".sanitize_ssn.
|
55
|
+
expect("derp".sanitize_ssn).to eq(nil)
|
56
56
|
# Bogus
|
57
57
|
end
|
58
58
|
|
59
59
|
it "123456 => nil" do
|
60
|
-
"123456".sanitize_ssn.
|
60
|
+
expect("123456".sanitize_ssn).to eq(nil)
|
61
61
|
# Too short ( becomes 000123456: Invalid Area )
|
62
62
|
end
|
63
63
|
|
64
64
|
it "999999999 => nil" do
|
65
|
-
"999999999".sanitize_ssn.
|
65
|
+
expect("999999999".sanitize_ssn).to eq(nil)
|
66
66
|
# Important. Many HRS entries
|
67
67
|
end
|
68
68
|
|
69
69
|
it "- => nil" do
|
70
|
-
"-".sanitize_ssn.
|
70
|
+
expect("-".sanitize_ssn).to eq(nil)
|
71
71
|
# Important. Many HRS entries
|
72
72
|
end
|
73
73
|
end
|
data/spec/system_spec.rb
CHANGED
@@ -5,25 +5,25 @@ describe Duffy::System do
|
|
5
5
|
# This generates the documentation more than anything.
|
6
6
|
describe "cpus" do
|
7
7
|
it "returns the number of physical cpus" do
|
8
|
-
Duffy::System.cpus.
|
8
|
+
expect(Duffy::System.cpus).to be_an(Integer)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "cores" do
|
13
13
|
it "returns the total number of CPU cores" do
|
14
|
-
Duffy::System.cores.
|
14
|
+
expect(Duffy::System.cores).to be_an(Integer)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe "threads" do
|
19
19
|
it "returns the total number of threads" do
|
20
|
-
Duffy::System.threads.
|
20
|
+
expect(Duffy::System.threads).to be_an(Integer)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "cpu_percent" do
|
25
25
|
it "returns the current cpu load percentage" do
|
26
|
-
Duffy::System.cpu_percent.
|
26
|
+
expect(Duffy::System.cpu_percent).to be_a(Float)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duffy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Duffy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -89,6 +89,7 @@ extra_rdoc_files: []
|
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
91
|
- ".rspec"
|
92
|
+
- ".travis.yml"
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE.txt
|
94
95
|
- README.md
|
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
134
|
version: '0'
|
134
135
|
requirements: []
|
135
136
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.5.1
|
137
138
|
signing_key:
|
138
139
|
specification_version: 4
|
139
140
|
summary: Library of things
|