vidibus-helpers 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +86 -0
- data/Rakefile +19 -1
- data/VERSION +1 -1
- data/lib/vidibus/helpers/extensions/view.rb +24 -0
- data/lib/vidibus-helpers.rb +2 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/vidibus/helpers/extensions/view_spec.rb +29 -0
- data/vidibus-helpers.gemspec +11 -2
- metadata +12 -6
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://gemcutter.org/
|
3
|
+
specs:
|
4
|
+
abstract (1.0.0)
|
5
|
+
actionmailer (3.0.0)
|
6
|
+
actionpack (= 3.0.0)
|
7
|
+
mail (~> 2.2.5)
|
8
|
+
actionpack (3.0.0)
|
9
|
+
activemodel (= 3.0.0)
|
10
|
+
activesupport (= 3.0.0)
|
11
|
+
builder (~> 2.1.2)
|
12
|
+
erubis (~> 2.6.6)
|
13
|
+
i18n (~> 0.4.1)
|
14
|
+
rack (~> 1.2.1)
|
15
|
+
rack-mount (~> 0.6.12)
|
16
|
+
rack-test (~> 0.5.4)
|
17
|
+
tzinfo (~> 0.3.23)
|
18
|
+
activemodel (3.0.0)
|
19
|
+
activesupport (= 3.0.0)
|
20
|
+
builder (~> 2.1.2)
|
21
|
+
i18n (~> 0.4.1)
|
22
|
+
activerecord (3.0.0)
|
23
|
+
activemodel (= 3.0.0)
|
24
|
+
activesupport (= 3.0.0)
|
25
|
+
arel (~> 1.0.0)
|
26
|
+
tzinfo (~> 0.3.23)
|
27
|
+
activeresource (3.0.0)
|
28
|
+
activemodel (= 3.0.0)
|
29
|
+
activesupport (= 3.0.0)
|
30
|
+
activesupport (3.0.0)
|
31
|
+
arel (1.0.1)
|
32
|
+
activesupport (~> 3.0.0)
|
33
|
+
builder (2.1.2)
|
34
|
+
diff-lcs (1.1.2)
|
35
|
+
erubis (2.6.6)
|
36
|
+
abstract (>= 1.0.0)
|
37
|
+
i18n (0.4.1)
|
38
|
+
mail (2.2.6.1)
|
39
|
+
activesupport (>= 2.3.6)
|
40
|
+
mime-types
|
41
|
+
treetop (>= 1.4.5)
|
42
|
+
mime-types (1.16)
|
43
|
+
polyglot (0.3.1)
|
44
|
+
rack (1.2.1)
|
45
|
+
rack-mount (0.6.13)
|
46
|
+
rack (>= 1.0.0)
|
47
|
+
rack-test (0.5.6)
|
48
|
+
rack (>= 1.0)
|
49
|
+
rails (3.0.0)
|
50
|
+
actionmailer (= 3.0.0)
|
51
|
+
actionpack (= 3.0.0)
|
52
|
+
activerecord (= 3.0.0)
|
53
|
+
activeresource (= 3.0.0)
|
54
|
+
activesupport (= 3.0.0)
|
55
|
+
bundler (~> 1.0.0)
|
56
|
+
railties (= 3.0.0)
|
57
|
+
railties (3.0.0)
|
58
|
+
actionpack (= 3.0.0)
|
59
|
+
activesupport (= 3.0.0)
|
60
|
+
rake (>= 0.8.4)
|
61
|
+
thor (~> 0.14.0)
|
62
|
+
rake (0.8.7)
|
63
|
+
relevance-rcov (0.9.2.1)
|
64
|
+
rspec (2.0.0.beta.22)
|
65
|
+
rspec-core (= 2.0.0.beta.22)
|
66
|
+
rspec-expectations (= 2.0.0.beta.22)
|
67
|
+
rspec-mocks (= 2.0.0.beta.22)
|
68
|
+
rspec-core (2.0.0.beta.22)
|
69
|
+
rspec-expectations (2.0.0.beta.22)
|
70
|
+
diff-lcs (>= 1.1.2)
|
71
|
+
rspec-mocks (2.0.0.beta.22)
|
72
|
+
rspec-core (= 2.0.0.beta.22)
|
73
|
+
rspec-expectations (= 2.0.0.beta.22)
|
74
|
+
thor (0.14.2)
|
75
|
+
treetop (1.4.8)
|
76
|
+
polyglot (>= 0.3.1)
|
77
|
+
tzinfo (0.3.23)
|
78
|
+
|
79
|
+
PLATFORMS
|
80
|
+
ruby
|
81
|
+
|
82
|
+
DEPENDENCIES
|
83
|
+
bundler (~> 1.0.0)
|
84
|
+
rails (~> 3.0.0)
|
85
|
+
relevance-rcov
|
86
|
+
rspec (~> 2.0.0.beta.20)
|
data/Rakefile
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "rake"
|
3
|
+
require "rake/rdoctask"
|
4
|
+
require "rspec"
|
5
|
+
require "rspec/core/rake_task"
|
3
6
|
|
4
7
|
begin
|
5
8
|
require "jeweler"
|
@@ -15,4 +18,19 @@ begin
|
|
15
18
|
Jeweler::GemcutterTasks.new
|
16
19
|
rescue LoadError
|
17
20
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
18
|
-
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Rspec::Core::RakeTask.new(:rcov) do |t|
|
24
|
+
t.pattern = "spec/**/*_spec.rb"
|
25
|
+
t.rcov = true
|
26
|
+
t.rcov_opts = ["--exclude", "^spec,/gems/"]
|
27
|
+
end
|
28
|
+
|
29
|
+
Rake::RDocTask.new do |rdoc|
|
30
|
+
version = File.exist?("VERSION") ? File.read("VERSION") : ""
|
31
|
+
rdoc.rdoc_dir = "rdoc"
|
32
|
+
rdoc.title = "vidibus-helpers #{version}"
|
33
|
+
rdoc.rdoc_files.include("README*")
|
34
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
35
|
+
rdoc.options << "--charset=utf-8"
|
36
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
@@ -16,6 +16,30 @@ module Vidibus
|
|
16
16
|
@autotab ||= 0
|
17
17
|
@autotab += 1
|
18
18
|
end
|
19
|
+
|
20
|
+
# Formats a number or float as human duration.
|
21
|
+
#
|
22
|
+
# Examples:
|
23
|
+
#
|
24
|
+
# number_to_duration(24.5) # => "00:25"
|
25
|
+
# number_to_duration(24.5, :hours => true) # => "00:00:25"
|
26
|
+
# number_to_duration(3654) # => "01:00:54"
|
27
|
+
# number_to_duration(3654, :hours => false) # => "60:54"
|
28
|
+
#
|
29
|
+
def number_to_duration(seconds, options = {})
|
30
|
+
hours = options[:hours]
|
31
|
+
seconds = seconds.round
|
32
|
+
hour = (seconds / 3600).floor unless hours == false
|
33
|
+
min = (seconds / 60).floor
|
34
|
+
sec = (seconds % 60).round
|
35
|
+
if hours != false and (hours == true or hour > 0)
|
36
|
+
min -= hour * 60
|
37
|
+
output = "%02d:" % hour
|
38
|
+
else
|
39
|
+
output = ''
|
40
|
+
end
|
41
|
+
output + "%02d:%02d" % [ min, sec ]
|
42
|
+
end
|
19
43
|
end
|
20
44
|
end
|
21
45
|
end
|
data/lib/vidibus-helpers.rb
CHANGED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
class ViewHelper
|
4
|
+
include Vidibus::Helpers::Extensions::View
|
5
|
+
end
|
6
|
+
|
7
|
+
describe ViewHelper do
|
8
|
+
describe "#number_to_duration" do
|
9
|
+
it "should return 00:24 for 24 seconds" do
|
10
|
+
subject.number_to_duration(24).should eql("00:24")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should return 00:00:24 for 24 seconds if :hours option is true" do
|
14
|
+
subject.number_to_duration(24, :hours => true).should eql("00:00:24")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should return 01:00:54 for 3654 seconds" do
|
18
|
+
subject.number_to_duration(3654, :hours => true).should eql("01:00:54")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return 01:00:55 for 3654.5 seconds" do
|
22
|
+
subject.number_to_duration(3654.5, :hours => true).should eql("01:00:55")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should return 60:54 for 3654 seconds if :hours option is false" do
|
26
|
+
subject.number_to_duration(3654, :hours => false).should eql("60:54")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/vidibus-helpers.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{vidibus-helpers}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andre Pankratz"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-30}
|
13
13
|
s.description = %q{A collections of application helpers.}
|
14
14
|
s.email = %q{andre@vidibus.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -19,6 +19,9 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
|
+
".rspec",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
22
25
|
"LICENSE",
|
23
26
|
"README.rdoc",
|
24
27
|
"Rakefile",
|
@@ -28,6 +31,8 @@ Gem::Specification.new do |s|
|
|
28
31
|
"lib/vidibus/helpers/extensions.rb",
|
29
32
|
"lib/vidibus/helpers/extensions/controller.rb",
|
30
33
|
"lib/vidibus/helpers/extensions/view.rb",
|
34
|
+
"spec/spec_helper.rb",
|
35
|
+
"spec/vidibus/helpers/extensions/view_spec.rb",
|
31
36
|
"vidibus-helpers.gemspec"
|
32
37
|
]
|
33
38
|
s.homepage = %q{http://github.com/vidibus/vidibus-helpers}
|
@@ -35,6 +40,10 @@ Gem::Specification.new do |s|
|
|
35
40
|
s.require_paths = ["lib"]
|
36
41
|
s.rubygems_version = %q{1.3.7}
|
37
42
|
s.summary = %q{Helpers for Vidibus applications.}
|
43
|
+
s.test_files = [
|
44
|
+
"spec/spec_helper.rb",
|
45
|
+
"spec/vidibus/helpers/extensions/view_spec.rb"
|
46
|
+
]
|
38
47
|
|
39
48
|
if s.respond_to? :specification_version then
|
40
49
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidibus-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andre Pankratz
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-30 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -31,6 +31,9 @@ extra_rdoc_files:
|
|
31
31
|
files:
|
32
32
|
- .document
|
33
33
|
- .gitignore
|
34
|
+
- .rspec
|
35
|
+
- Gemfile
|
36
|
+
- Gemfile.lock
|
34
37
|
- LICENSE
|
35
38
|
- README.rdoc
|
36
39
|
- Rakefile
|
@@ -40,6 +43,8 @@ files:
|
|
40
43
|
- lib/vidibus/helpers/extensions.rb
|
41
44
|
- lib/vidibus/helpers/extensions/controller.rb
|
42
45
|
- lib/vidibus/helpers/extensions/view.rb
|
46
|
+
- spec/spec_helper.rb
|
47
|
+
- spec/vidibus/helpers/extensions/view_spec.rb
|
43
48
|
- vidibus-helpers.gemspec
|
44
49
|
has_rdoc: true
|
45
50
|
homepage: http://github.com/vidibus/vidibus-helpers
|
@@ -75,5 +80,6 @@ rubygems_version: 1.3.7
|
|
75
80
|
signing_key:
|
76
81
|
specification_version: 3
|
77
82
|
summary: Helpers for Vidibus applications.
|
78
|
-
test_files:
|
79
|
-
|
83
|
+
test_files:
|
84
|
+
- spec/spec_helper.rb
|
85
|
+
- spec/vidibus/helpers/extensions/view_spec.rb
|