ccls-common_lib 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.rdoc +116 -0
- data/lib/ccls-common_lib.rb +1 -0
- data/lib/common_lib.rb +37 -0
- data/lib/common_lib/action_controller_extension.rb +8 -0
- data/lib/common_lib/action_controller_extension/accessible_via_protocol.rb +405 -0
- data/lib/common_lib/action_controller_extension/accessible_via_user.rb +605 -0
- data/lib/common_lib/action_controller_extension/routing.rb +20 -0
- data/lib/common_lib/action_controller_extension/test_case.rb +22 -0
- data/lib/common_lib/action_view_extension.rb +3 -0
- data/lib/common_lib/action_view_extension/base.rb +310 -0
- data/lib/common_lib/action_view_extension/form_builder.rb +197 -0
- data/lib/common_lib/active_model.rb +4 -0
- data/lib/common_lib/active_model/errors.rb +16 -0
- data/lib/common_lib/active_model/validations/absence.rb +78 -0
- data/lib/common_lib/active_model/validations/complete_date.rb +138 -0
- data/lib/common_lib/active_model/validations/past_date.rb +121 -0
- data/lib/common_lib/active_record.rb +1 -0
- data/lib/common_lib/active_record/base.rb +129 -0
- data/lib/common_lib/active_support_extension.rb +12 -0
- data/lib/common_lib/active_support_extension/assertions.rb +108 -0
- data/lib/common_lib/active_support_extension/associations.rb +154 -0
- data/lib/common_lib/active_support_extension/attributes.rb +296 -0
- data/lib/common_lib/active_support_extension/pending.rb +115 -0
- data/lib/common_lib/active_support_extension/test_case.rb +203 -0
- data/lib/common_lib/railtie.rb +48 -0
- data/lib/common_lib/ruby.rb +8 -0
- data/lib/common_lib/ruby/array.rb +128 -0
- data/lib/common_lib/ruby/fixnum.rb +5 -0
- data/lib/common_lib/ruby/hash.rb +51 -0
- data/lib/common_lib/ruby/integer.rb +11 -0
- data/lib/common_lib/ruby/nil_class.rb +13 -0
- data/lib/common_lib/ruby/numeric.rb +0 -0
- data/lib/common_lib/ruby/object.rb +53 -0
- data/lib/common_lib/ruby/string.rb +20 -0
- data/lib/common_lib/translation_table.rb +129 -0
- data/lib/tasks/common_lib.rake +10 -0
- data/lib/tasks/csv.rake +0 -0
- data/lib/tasks/database.rake +229 -0
- data/lib/tasks/rcov.rake +52 -0
- data/vendor/assets/javascripts/common_lib.js +77 -0
- data/vendor/assets/stylesheets/common_lib.css +71 -0
- metadata +84 -0
data/lib/tasks/rcov.rake
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
# This is from Advanced Rails Recipes, page 277
|
3
|
+
#
|
4
|
+
namespace :test do
|
5
|
+
|
6
|
+
desc 'Tracks test coverage with rcov'
|
7
|
+
task :coverage do
|
8
|
+
rm_f "coverage"
|
9
|
+
rm_f "coverage.data"
|
10
|
+
|
11
|
+
unless PLATFORM['i386-mswin32']
|
12
|
+
rcov = "rcov --sort coverage --rails --aggregate coverage.data " <<
|
13
|
+
"--text-summary -Ilib:test -T "
|
14
|
+
# exclusions are ...
|
15
|
+
# -x, --exclude PATTERNS Don't generate info for files matching a
|
16
|
+
# pattern (comma-separated regexp list)
|
17
|
+
exclusions = ['gems/','db/.*schema.rb','db/migrate']
|
18
|
+
exclusions += RCOV_EXCLUDES if defined?(RCOV_EXCLUDES)
|
19
|
+
puts "Excluding : #{exclusions.join(',')}"
|
20
|
+
rcov << "-x #{exclusions.join(',')}"
|
21
|
+
# "-x gems/*,db/migrate/*,jrails/*/*"
|
22
|
+
# ',\(eval\),\(recognize_optimized\),\(erb\)' << # needed in jruby
|
23
|
+
# ",yaml,yaml/*,lib/tmail/parser.y,jruby.jar!/*" << # needed in jruby
|
24
|
+
# ",db/*schema.rb"
|
25
|
+
# ",html_test/*/*" <<
|
26
|
+
# ",html_test_extension/*/*"
|
27
|
+
else
|
28
|
+
rcov = "rcov.cmd --sort coverage --rails --aggregate " <<
|
29
|
+
"coverage.data --text-summary -Ilib -T"
|
30
|
+
end
|
31
|
+
|
32
|
+
dirs = Dir.glob("test/**/*_test.rb").collect{|f|File.dirname(f)}.uniq
|
33
|
+
if defined?(@gem_test_dirs) && @gem_test_dirs.is_a?(Array)
|
34
|
+
dirs += @gem_test_dirs
|
35
|
+
end
|
36
|
+
lastdir = dirs.pop
|
37
|
+
dirs.each do |dir|
|
38
|
+
system("#{rcov} --no-html #{dir}/*_test.rb")
|
39
|
+
end
|
40
|
+
system("#{rcov} --html #{lastdir}/*_test.rb") unless lastdir.nil?
|
41
|
+
|
42
|
+
unless PLATFORM['i386-mswin32']
|
43
|
+
# jruby-1.5.0.RC1 > PLATFORM
|
44
|
+
# => "java"
|
45
|
+
# system("open coverage/index.html") if PLATFORM['darwin']
|
46
|
+
system("open coverage/index.html")
|
47
|
+
else
|
48
|
+
system("\"C:/Program Files/Mozilla Firefox/firefox.exe\" " +
|
49
|
+
"coverage/index.html")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
jQuery(function(){
|
2
|
+
|
3
|
+
/*
|
4
|
+
'clicking' a submit button apparently skips the 'submit' method
|
5
|
+
which then skips the destroy confirmation, so we need to explicitly
|
6
|
+
catch the click and manually submit to trigger the confirmation.
|
7
|
+
*/
|
8
|
+
jQuery('form.destroy_link_to input[type=submit]').click(function(){
|
9
|
+
jQuery(this).parents('form').submit();
|
10
|
+
return false;
|
11
|
+
});
|
12
|
+
|
13
|
+
jQuery('form.destroy_link_to').submit(function(){
|
14
|
+
var message = "Destroy? Seriously?"
|
15
|
+
if( this.confirm && this.confirm.value ) {
|
16
|
+
message = this.confirm.value
|
17
|
+
}
|
18
|
+
if( !confirm(message) ){
|
19
|
+
return false;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
|
23
|
+
jQuery('p.flash').click(function(){$(this).remove();});
|
24
|
+
|
25
|
+
if( typeof jQuery('.datepicker').datepicker == 'function' ){
|
26
|
+
jQuery('.datepicker').datepicker();
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
/*
|
31
|
+
jQuery('form a.submit.button').siblings('input[type=submit]').hide();
|
32
|
+
|
33
|
+
jQuery('form a.submit.button').click(function(){
|
34
|
+
if( jQuery(this).next('input[type=submit]').length > 0 ){
|
35
|
+
jQuery(this).next().click();
|
36
|
+
} else {
|
37
|
+
jQuery(this).parents('form').submit();
|
38
|
+
}
|
39
|
+
return false;
|
40
|
+
});
|
41
|
+
*/
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
});
|
46
|
+
|
47
|
+
|
48
|
+
jQuery(window).resize(function(){
|
49
|
+
resize_text_areas()
|
50
|
+
});
|
51
|
+
|
52
|
+
jQuery(window).load(function(){
|
53
|
+
/*
|
54
|
+
This MUST be in window/load, not the normal document/ready,
|
55
|
+
for Google Chrome to get correct values
|
56
|
+
*/
|
57
|
+
resize_text_areas()
|
58
|
+
});
|
59
|
+
|
60
|
+
function resize_text_areas() {
|
61
|
+
/*
|
62
|
+
jQuery('textarea.autosize').each(function(){
|
63
|
+
*/
|
64
|
+
jQuery('.autosize').each(function(){
|
65
|
+
new_width = $(this).parent().innerWidth() +
|
66
|
+
$(this).parent().position().left -
|
67
|
+
$(this).position().left -
|
68
|
+
parseInt($(this).css('margin-left')) -
|
69
|
+
parseInt($(this).css('margin-right')) -
|
70
|
+
parseInt($(this).css('padding-left')) -
|
71
|
+
parseInt($(this).css('padding-right')) -
|
72
|
+
parseInt($(this).css('border-left-width')) -
|
73
|
+
parseInt($(this).css('border-right-width') )
|
74
|
+
$(this).css('width',new_width-10) /* take 10 more for good measure */
|
75
|
+
})
|
76
|
+
}
|
77
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
.flash {
|
2
|
+
/* http://css-radius.heroku.com */
|
3
|
+
-webkit-border-radius: 8px;
|
4
|
+
-moz-border-radius: 8px;
|
5
|
+
border-radius: 8px;
|
6
|
+
padding: 0.7em;
|
7
|
+
text-align: center;
|
8
|
+
font-weight: bold;
|
9
|
+
font-size: 12pt;
|
10
|
+
}
|
11
|
+
.flash.error,
|
12
|
+
.flash#error {
|
13
|
+
border: 2px solid #F44;
|
14
|
+
background-color: #FCC;
|
15
|
+
}
|
16
|
+
.flash.warn,
|
17
|
+
.flash#warn {
|
18
|
+
border: 2px solid #FF6600;
|
19
|
+
background-color: #FFCC99;
|
20
|
+
}
|
21
|
+
.flash.notice,
|
22
|
+
.flash#notice {
|
23
|
+
border: 2px solid #4F4;
|
24
|
+
background-color: #CFC;
|
25
|
+
}
|
26
|
+
.flash.noscript,
|
27
|
+
.flash#noscript {
|
28
|
+
border: 2px solid #FF8C00;
|
29
|
+
background-color: #FFC5AF;
|
30
|
+
}
|
31
|
+
|
32
|
+
/*
|
33
|
+
Make submit buttons and a.button tags look the same.
|
34
|
+
This works in Firefox and Chrome. Don't know about IE.
|
35
|
+
*/
|
36
|
+
input[type=submit],
|
37
|
+
a.button {
|
38
|
+
cursor: pointer;
|
39
|
+
/* http://css-radius.heroku.com */
|
40
|
+
-webkit-border-radius: 10px;
|
41
|
+
-moz-border-radius: 10px;
|
42
|
+
border-radius: 10px;
|
43
|
+
|
44
|
+
font-family: Verdana,Arial,Helvetica,sans-serif;
|
45
|
+
font-size: 14px;
|
46
|
+
font-weight: normal;
|
47
|
+
border: 1px solid gray;
|
48
|
+
text-decoration: none;
|
49
|
+
padding: 1px 8px;
|
50
|
+
color: black;
|
51
|
+
|
52
|
+
background-color: #DDDDDD;
|
53
|
+
|
54
|
+
/*
|
55
|
+
background or background-image ???
|
56
|
+
*/
|
57
|
+
/* for webkit browsers */
|
58
|
+
background: -webkit-gradient(linear, left top, left bottom, from(#EEEEEE), to(#CCCCCC));
|
59
|
+
/* for firefox 3.6+ */
|
60
|
+
background: -moz-linear-gradient(top, #EEEEEE, #CCCCCC);
|
61
|
+
/* for ie , but doesn't seem to work as expected despite other examples working */
|
62
|
+
filter: progid:DXImageTransform.Microsoft.gradient(StartColorStr='#EEEEEE', EndColorStr='#CCCCCC');
|
63
|
+
}
|
64
|
+
/*
|
65
|
+
input and a tags use different box-sizing so need to set
|
66
|
+
different paddings so that they appear the same.
|
67
|
+
This particular difference is caused by the 1px border.
|
68
|
+
*/
|
69
|
+
input[type=submit] {
|
70
|
+
padding: 0px 8px;
|
71
|
+
}
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ccls-common_lib
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- George 'Jake' Wendt
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-03 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: CCLS Common Lib gem
|
14
|
+
email: github@jakewendt.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files:
|
18
|
+
- README.rdoc
|
19
|
+
files:
|
20
|
+
- lib/ccls-common_lib.rb
|
21
|
+
- lib/common_lib.rb
|
22
|
+
- lib/common_lib/action_controller_extension.rb
|
23
|
+
- lib/common_lib/action_controller_extension/accessible_via_protocol.rb
|
24
|
+
- lib/common_lib/action_controller_extension/accessible_via_user.rb
|
25
|
+
- lib/common_lib/action_controller_extension/routing.rb
|
26
|
+
- lib/common_lib/action_controller_extension/test_case.rb
|
27
|
+
- lib/common_lib/action_view_extension.rb
|
28
|
+
- lib/common_lib/action_view_extension/base.rb
|
29
|
+
- lib/common_lib/action_view_extension/form_builder.rb
|
30
|
+
- lib/common_lib/active_model.rb
|
31
|
+
- lib/common_lib/active_model/errors.rb
|
32
|
+
- lib/common_lib/active_model/validations/absence.rb
|
33
|
+
- lib/common_lib/active_model/validations/complete_date.rb
|
34
|
+
- lib/common_lib/active_model/validations/past_date.rb
|
35
|
+
- lib/common_lib/active_record.rb
|
36
|
+
- lib/common_lib/active_record/base.rb
|
37
|
+
- lib/common_lib/active_support_extension.rb
|
38
|
+
- lib/common_lib/active_support_extension/assertions.rb
|
39
|
+
- lib/common_lib/active_support_extension/associations.rb
|
40
|
+
- lib/common_lib/active_support_extension/attributes.rb
|
41
|
+
- lib/common_lib/active_support_extension/pending.rb
|
42
|
+
- lib/common_lib/active_support_extension/test_case.rb
|
43
|
+
- lib/common_lib/railtie.rb
|
44
|
+
- lib/common_lib/ruby.rb
|
45
|
+
- lib/common_lib/ruby/array.rb
|
46
|
+
- lib/common_lib/ruby/fixnum.rb
|
47
|
+
- lib/common_lib/ruby/hash.rb
|
48
|
+
- lib/common_lib/ruby/integer.rb
|
49
|
+
- lib/common_lib/ruby/nil_class.rb
|
50
|
+
- lib/common_lib/ruby/numeric.rb
|
51
|
+
- lib/common_lib/ruby/object.rb
|
52
|
+
- lib/common_lib/ruby/string.rb
|
53
|
+
- lib/common_lib/translation_table.rb
|
54
|
+
- lib/tasks/common_lib.rake
|
55
|
+
- lib/tasks/csv.rake
|
56
|
+
- lib/tasks/database.rake
|
57
|
+
- lib/tasks/rcov.rake
|
58
|
+
- vendor/assets/javascripts/common_lib.js
|
59
|
+
- vendor/assets/stylesheets/common_lib.css
|
60
|
+
- README.rdoc
|
61
|
+
homepage: http://github.com/ccls/common_lib
|
62
|
+
licenses: []
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.0.14
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: CCLS Common Lib gem
|
84
|
+
test_files: []
|