timely 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +13 -0
- data/HISTORY.md +3 -0
- data/LICENSE +21 -0
- data/README.md +55 -0
- data/Rakefile +150 -4
- data/lib/timely/date.rb +3 -3
- data/lib/timely/date_chooser.rb +98 -0
- data/lib/timely/date_range.rb +51 -0
- data/lib/timely/date_time.rb +11 -0
- data/lib/timely/rails/date_group.rb +115 -0
- data/lib/timely/rails/extensions.rb +43 -0
- data/lib/timely/rails/season.rb +99 -0
- data/lib/timely/rails.rb +4 -0
- data/lib/timely/range.rb +15 -0
- data/lib/timely/string.rb +25 -0
- data/lib/timely/temporal_patterns.rb +441 -0
- data/lib/timely/time.rb +5 -4
- data/lib/timely/trackable_date_set.rb +148 -0
- data/lib/timely/week_days.rb +128 -0
- data/lib/timely.rb +15 -6
- data/rails/init.rb +1 -0
- data/spec/date_chooser_spec.rb +101 -0
- data/spec/date_group_spec.rb +26 -0
- data/spec/date_range_spec.rb +40 -0
- data/spec/date_spec.rb +15 -15
- data/spec/schema.rb +11 -0
- data/spec/season_spec.rb +68 -0
- data/spec/spec_helper.rb +41 -18
- data/spec/string_spec.rb +13 -0
- data/spec/time_spec.rb +28 -9
- data/spec/trackable_date_set_spec.rb +80 -0
- data/spec/week_days_spec.rb +51 -0
- data/timely.gemspec +99 -0
- metadata +61 -61
- data/History.txt +0 -4
- data/License.txt +0 -20
- data/Manifest.txt +0 -23
- data/README.txt +0 -31
- data/config/hoe.rb +0 -73
- data/config/requirements.rb +0 -15
- data/lib/timely/version.rb +0 -9
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/setup.rb +0 -1585
- data/spec/spec.opts +0 -1
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/rspec.rake +0 -21
- data/tasks/website.rake +0 -9
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Timely::TrackableDateSet, ' tracking 7 days' do
|
4
|
+
before do
|
5
|
+
@range = Date.today..(Date.today + 6)
|
6
|
+
@trackable_date_set = Timely::TrackableDateSet.new(@range)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should start on the first date" do
|
10
|
+
@trackable_date_set.start_date.should == Date.today
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should end on the last date" do
|
14
|
+
@trackable_date_set.end_date.should == Date.today + 6
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should have the 7 days set" do
|
18
|
+
get_dates.should == @range.to_a
|
19
|
+
@trackable_date_set.duration.should == 7
|
20
|
+
@trackable_date_set.number_of_nights.should == 7
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have all the 7 days to do" do
|
24
|
+
get_dates_to_do.should == @range.to_a
|
25
|
+
should_not_have_done(@range.to_a)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should have only the last 6 days to do when we set_done! the first one" do
|
29
|
+
@trackable_date_set.set_date_done!(Date.today)
|
30
|
+
get_dates_to_do.should == ((Date.today + 1)..(Date.today + 6)).to_a
|
31
|
+
|
32
|
+
should_not_have_done(@range.to_a - [Date.today])
|
33
|
+
should_have_done([Date.today])
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should have the first, and last three left to do if we set 2nd, 3rd & 4th to be done" do
|
37
|
+
dates_to_be_done = [Date.today + 1, Date.today + 2, Date.today + 3]
|
38
|
+
@trackable_date_set.set_dates_done!(dates_to_be_done)
|
39
|
+
|
40
|
+
get_dates_to_do.should == [Date.today, Date.today + 4, Date.today + 5, Date.today + 6]
|
41
|
+
should_not_have_done(@range.to_a - dates_to_be_done)
|
42
|
+
should_have_done(dates_to_be_done)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should have none left to do when set_all_done!" do
|
46
|
+
@trackable_date_set.set_all_done!
|
47
|
+
get_dates_to_do.should == []
|
48
|
+
should_have_done(@range.to_a)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should have no actions applied' do
|
52
|
+
@trackable_date_set.action_applied?(:some_action).should == false
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should remember if we apply an action' do
|
56
|
+
@trackable_date_set.apply_action(:some_action)
|
57
|
+
@trackable_date_set.action_applied?(:some_action).should == true
|
58
|
+
@trackable_date_set.action_applied?(:some_other_action).should == false
|
59
|
+
end
|
60
|
+
|
61
|
+
def should_have_done(dates)
|
62
|
+
dates.each{|date| @trackable_date_set.has_done?(date).should == true }
|
63
|
+
end
|
64
|
+
|
65
|
+
def should_not_have_done(dates)
|
66
|
+
dates.each{|date| @trackable_date_set.has_done?(date).should == false }
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_dates
|
70
|
+
contained_dates = []
|
71
|
+
@trackable_date_set.each_date{|date| contained_dates << date}
|
72
|
+
contained_dates
|
73
|
+
end
|
74
|
+
|
75
|
+
def get_dates_to_do
|
76
|
+
contained_dates = []
|
77
|
+
@trackable_date_set.each_date_to_do{|date| contained_dates << date}
|
78
|
+
contained_dates
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Timely::WeekDays do
|
4
|
+
before do
|
5
|
+
@weekdays = Timely::WeekDays.new(:tue => true, :thu => true)
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should create via hash, integer and array' do
|
9
|
+
# 0 0 1 0 1 0 0
|
10
|
+
# Sat Fri Thu Wed Tue Mon Sun
|
11
|
+
Timely::WeekDays.new(0b0010100).weekdays.should == [:tue, :thu]
|
12
|
+
Timely::WeekDays.new(%w(0 0 1 0 1 0 0)).weekdays.should == [:tue, :thu]
|
13
|
+
Timely::WeekDays.new(:tue => true, :thu => true).weekdays.should == [:tue, :thu]
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should be able to set/unset days' do
|
17
|
+
@weekdays[:mon] = true
|
18
|
+
@weekdays.weekdays.should == [:mon, :tue, :thu]
|
19
|
+
@weekdays[:tue] = false
|
20
|
+
@weekdays.weekdays.should == [:mon, :thu]
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should output days nicely' do
|
24
|
+
Timely::WeekDays.new(%w(1 0 0 0 0 0 0)).to_s.should == "Sun"
|
25
|
+
Timely::WeekDays.new(%w(1 0 1 0 0 0 0)).to_s.should == "Sun, and Tue"
|
26
|
+
Timely::WeekDays.new(%w(1 0 1 1 0 0 0)).to_s.should == "Sun, Tue, and Wed"
|
27
|
+
Timely::WeekDays.new(%w(1 0 1 1 0 1 0)).to_s.should == "Sun, Tue, Wed, and Fri"
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should be able to determine if days of the week are selected' do
|
31
|
+
# Test mon and tue in both symbol/integer forms
|
32
|
+
@weekdays.has_day?(1).should be_false
|
33
|
+
@weekdays.has_day?(:mon).should be_false
|
34
|
+
@weekdays.has_day?(2).should be_true
|
35
|
+
@weekdays.has_day?(:tue).should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should be able to determine if it would be applicable on a date' do
|
39
|
+
@weekdays.applies_for_date?(Date.new(2012, 04, 22)).should be_false # Sunday
|
40
|
+
@weekdays.applies_for_date?(Date.new(2012, 04, 24)).should be_true # Tuesday
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should be able to convert to integer for use in databases, etc.' do
|
44
|
+
@weekdays.weekdays_int.should == 4 + 16 # 4 = Tue, 16 = Thu
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should be able to determine if all days are selected' do
|
48
|
+
Timely::WeekDays.new(%w(1 1 1 1 1 1 1)).all_days?.should be_true
|
49
|
+
Timely::WeekDays.new(%w(1 1 1 1 1 0 1)).all_days?.should be_false
|
50
|
+
end
|
51
|
+
end
|
data/timely.gemspec
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
## This is the rakegem gemspec template. Make sure you read and understand
|
2
|
+
## all of the comments. Some sections require modification, and others can
|
3
|
+
## be deleted if you don't need them. Once you understand the contents of
|
4
|
+
## this file, feel free to delete any comments that begin with two hash marks.
|
5
|
+
## You can find comprehensive Gem::Specification documentation, at
|
6
|
+
## http://docs.rubygems.org/read/chapter/20
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
9
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
|
+
s.rubygems_version = '1.3.5'
|
11
|
+
|
12
|
+
## Leave these as is they will be modified for you by the rake gemspec task.
|
13
|
+
## If your rubyforge_project name is different, then edit it and comment out
|
14
|
+
## the sub! line in the Rakefile
|
15
|
+
s.name = 'timely'
|
16
|
+
s.version = '0.0.2'
|
17
|
+
s.date = '2012-05-27'
|
18
|
+
s.rubyforge_project = 'timely'
|
19
|
+
|
20
|
+
## Make sure your summary is short. The description may be as long
|
21
|
+
## as you like.
|
22
|
+
s.summary = "Set of time, date, weekday related methods."
|
23
|
+
s.description = "See README for full details on how to install, use, etc."
|
24
|
+
|
25
|
+
## List the primary authors. If there are a bunch of authors, it's probably
|
26
|
+
## better to set the email to an email list or something. If you don't have
|
27
|
+
## a custom homepage, consider using your GitHub URL or the like.
|
28
|
+
s.authors = ["Michael Noack"]
|
29
|
+
s.email = 'development@travellink.com.au'
|
30
|
+
s.homepage = 'http://github.com/sealink/timely'
|
31
|
+
|
32
|
+
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
33
|
+
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
|
34
|
+
s.require_paths = %w[lib]
|
35
|
+
|
36
|
+
## This sections is only necessary if you have C extensions.
|
37
|
+
# s.require_paths << 'ext'
|
38
|
+
# s.extensions = %w[ext/extconf.rb]
|
39
|
+
|
40
|
+
## If your gem includes any executables, list them here.
|
41
|
+
# s.executables = ["name"]
|
42
|
+
|
43
|
+
## Specify any RDoc options here. You'll want to add your README and
|
44
|
+
## LICENSE files to the extra_rdoc_files list.
|
45
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
46
|
+
s.extra_rdoc_files = %w[README.md LICENSE]
|
47
|
+
|
48
|
+
## List your runtime dependencies here. Runtime dependencies are those
|
49
|
+
## that are needed for an end user to actually USE your code.
|
50
|
+
|
51
|
+
## List your development dependencies here. Development dependencies are
|
52
|
+
## those that are only needed during development
|
53
|
+
# s.add_development_dependency('DEVDEPNAME', [">= 1.1.0", "< 2.0.0"])
|
54
|
+
|
55
|
+
## Leave this section as-is. It will be automatically generated from the
|
56
|
+
## contents of your Git repository via the gemspec task. DO NOT REMOVE
|
57
|
+
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
58
|
+
# = MANIFEST =
|
59
|
+
s.files = %w[
|
60
|
+
Gemfile
|
61
|
+
HISTORY.md
|
62
|
+
LICENSE
|
63
|
+
README.md
|
64
|
+
Rakefile
|
65
|
+
lib/timely.rb
|
66
|
+
lib/timely/date.rb
|
67
|
+
lib/timely/date_chooser.rb
|
68
|
+
lib/timely/date_range.rb
|
69
|
+
lib/timely/date_time.rb
|
70
|
+
lib/timely/rails.rb
|
71
|
+
lib/timely/rails/date_group.rb
|
72
|
+
lib/timely/rails/extensions.rb
|
73
|
+
lib/timely/rails/season.rb
|
74
|
+
lib/timely/range.rb
|
75
|
+
lib/timely/string.rb
|
76
|
+
lib/timely/temporal_patterns.rb
|
77
|
+
lib/timely/time.rb
|
78
|
+
lib/timely/trackable_date_set.rb
|
79
|
+
lib/timely/week_days.rb
|
80
|
+
rails/init.rb
|
81
|
+
spec/date_chooser_spec.rb
|
82
|
+
spec/date_group_spec.rb
|
83
|
+
spec/date_range_spec.rb
|
84
|
+
spec/date_spec.rb
|
85
|
+
spec/schema.rb
|
86
|
+
spec/season_spec.rb
|
87
|
+
spec/spec_helper.rb
|
88
|
+
spec/string_spec.rb
|
89
|
+
spec/time_spec.rb
|
90
|
+
spec/trackable_date_set_spec.rb
|
91
|
+
spec/week_days_spec.rb
|
92
|
+
timely.gemspec
|
93
|
+
]
|
94
|
+
# = MANIFEST =
|
95
|
+
|
96
|
+
## Test files will be grabbed from the file list. Make sure the path glob
|
97
|
+
## matches what you actually use.
|
98
|
+
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
99
|
+
end
|
metadata
CHANGED
@@ -1,80 +1,80 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: timely
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
-
|
7
|
+
authors:
|
8
|
+
- Michael Noack
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
date: 2008-05-08 00:00:00 -05:00
|
13
|
-
default_executable:
|
12
|
+
date: 2012-05-27 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
|
-
|
16
|
-
|
17
|
-
email:
|
18
|
-
- ymendel@pobox.com
|
14
|
+
description: See README for full details on how to install, use, etc.
|
15
|
+
email: development@travellink.com.au
|
19
16
|
executables: []
|
20
|
-
|
21
17
|
extensions: []
|
22
|
-
|
23
|
-
|
24
|
-
-
|
25
|
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
|
29
|
-
-
|
30
|
-
- License.txt
|
31
|
-
- Manifest.txt
|
32
|
-
- README.txt
|
18
|
+
extra_rdoc_files:
|
19
|
+
- README.md
|
20
|
+
- LICENSE
|
21
|
+
files:
|
22
|
+
- Gemfile
|
23
|
+
- HISTORY.md
|
24
|
+
- LICENSE
|
25
|
+
- README.md
|
33
26
|
- Rakefile
|
34
|
-
- config/hoe.rb
|
35
|
-
- config/requirements.rb
|
36
27
|
- lib/timely.rb
|
37
|
-
- lib/timely/version.rb
|
38
28
|
- lib/timely/date.rb
|
29
|
+
- lib/timely/date_chooser.rb
|
30
|
+
- lib/timely/date_range.rb
|
31
|
+
- lib/timely/date_time.rb
|
32
|
+
- lib/timely/rails.rb
|
33
|
+
- lib/timely/rails/date_group.rb
|
34
|
+
- lib/timely/rails/extensions.rb
|
35
|
+
- lib/timely/rails/season.rb
|
36
|
+
- lib/timely/range.rb
|
37
|
+
- lib/timely/string.rb
|
38
|
+
- lib/timely/temporal_patterns.rb
|
39
39
|
- lib/timely/time.rb
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
- spec/
|
45
|
-
- spec/
|
40
|
+
- lib/timely/trackable_date_set.rb
|
41
|
+
- lib/timely/week_days.rb
|
42
|
+
- rails/init.rb
|
43
|
+
- spec/date_chooser_spec.rb
|
44
|
+
- spec/date_group_spec.rb
|
45
|
+
- spec/date_range_spec.rb
|
46
46
|
- spec/date_spec.rb
|
47
|
+
- spec/schema.rb
|
48
|
+
- spec/season_spec.rb
|
49
|
+
- spec/spec_helper.rb
|
50
|
+
- spec/string_spec.rb
|
47
51
|
- spec/time_spec.rb
|
48
|
-
-
|
49
|
-
-
|
50
|
-
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
- README.txt
|
58
|
-
require_paths:
|
52
|
+
- spec/trackable_date_set_spec.rb
|
53
|
+
- spec/week_days_spec.rb
|
54
|
+
- timely.gemspec
|
55
|
+
homepage: http://github.com/sealink/timely
|
56
|
+
licenses: []
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options:
|
59
|
+
- --charset=UTF-8
|
60
|
+
require_paths:
|
59
61
|
- lib
|
60
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
72
74
|
requirements: []
|
73
|
-
|
74
|
-
|
75
|
-
rubygems_version: 1.1.1
|
75
|
+
rubyforge_project: timely
|
76
|
+
rubygems_version: 1.8.23
|
76
77
|
signing_key:
|
77
78
|
specification_version: 2
|
78
|
-
summary:
|
79
|
+
summary: Set of time, date, weekday related methods.
|
79
80
|
test_files: []
|
80
|
-
|
data/History.txt
DELETED
data/License.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2008 Flawed Logic, OG Consulting, Yossef Mendelssohn
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
License.txt
|
3
|
-
Manifest.txt
|
4
|
-
README.txt
|
5
|
-
Rakefile
|
6
|
-
config/hoe.rb
|
7
|
-
config/requirements.rb
|
8
|
-
lib/timely.rb
|
9
|
-
lib/timely/version.rb
|
10
|
-
lib/timely/date.rb
|
11
|
-
lib/timely/time.rb
|
12
|
-
script/console
|
13
|
-
script/destroy
|
14
|
-
script/generate
|
15
|
-
setup.rb
|
16
|
-
spec/spec.opts
|
17
|
-
spec/spec_helper.rb
|
18
|
-
spec/date_spec.rb
|
19
|
-
spec/time_spec.rb
|
20
|
-
tasks/deployment.rake
|
21
|
-
tasks/environment.rake
|
22
|
-
tasks/rspec.rake
|
23
|
-
tasks/website.rake
|
data/README.txt
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
= timely
|
2
|
-
|
3
|
-
== DESCRIPTION:
|
4
|
-
|
5
|
-
Timely adds some convenience methods to Date and Time to easily create times on specific dates.
|
6
|
-
|
7
|
-
== SYNOPSIS:
|
8
|
-
|
9
|
-
require 'timely'
|
10
|
-
|
11
|
-
some_date = Date.today - 5 # => 2008-05-03
|
12
|
-
some_date.at_time(3, 5, 13) # => Sat May 03 03:05:13 -0500 2008
|
13
|
-
|
14
|
-
# arguments are optional
|
15
|
-
some_date.at_time(13) # => Sat May 03 13:00:00 -0500 2008
|
16
|
-
|
17
|
-
some_time = Time.now - 345678 # => Sun May 04 13:40:22 -0500 2008
|
18
|
-
some_time.on_date(2001, 6, 18) # => Mon Jun 18 13:40:22 -0500 2001
|
19
|
-
|
20
|
-
# if you have objects corresponding to the times/dates you want
|
21
|
-
some_time.on_date(some_date) # => Sat May 03 13:40:22 -0500 2008
|
22
|
-
some_date.at_time(some_time) # => Sat May 03 13:40:22 -0500 2008
|
23
|
-
|
24
|
-
# if you like typing less
|
25
|
-
some_time.on(some_date) # => Sat May 03 13:40:22 -0500 2008
|
26
|
-
some_date.at(some_time) # => Sat May 03 13:40:22 -0500 2008
|
27
|
-
|
28
|
-
== INSTALL:
|
29
|
-
|
30
|
-
* sudo gem install timely
|
31
|
-
|
data/config/hoe.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'timely/version'
|
2
|
-
|
3
|
-
AUTHOR = 'Yossef Mendelssohn' # can also be an array of Authors
|
4
|
-
EMAIL = "ymendel@pobox.com"
|
5
|
-
DESCRIPTION = "adds some convenience methods to Date and Time to easily create times on specific dates"
|
6
|
-
GEM_NAME = 'timely' # what ppl will type to install your gem
|
7
|
-
RUBYFORGE_PROJECT = 'yomendel' # The unix name for your project
|
8
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
-
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
-
EXTRA_DEPENDENCIES = [
|
11
|
-
# ['activesupport', '>= 1.3.1']
|
12
|
-
] # An array of rubygem dependencies [name, version]
|
13
|
-
|
14
|
-
@config_file = "~/.rubyforge/user-config.yml"
|
15
|
-
@config = nil
|
16
|
-
RUBYFORGE_USERNAME = "unknown"
|
17
|
-
def rubyforge_username
|
18
|
-
unless @config
|
19
|
-
begin
|
20
|
-
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
21
|
-
rescue
|
22
|
-
puts <<-EOS
|
23
|
-
ERROR: No rubyforge config file found: #{@config_file}
|
24
|
-
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
25
|
-
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
26
|
-
EOS
|
27
|
-
exit
|
28
|
-
end
|
29
|
-
end
|
30
|
-
RUBYFORGE_USERNAME.replace @config["username"]
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
REV = nil
|
35
|
-
# UNCOMMENT IF REQUIRED:
|
36
|
-
# REV = YAML.load(`svn info`)['Revision']
|
37
|
-
VERS = Timely::VERSION::STRING + (REV ? ".#{REV}" : "")
|
38
|
-
RDOC_OPTS = ['--quiet', '--title', 'timely documentation',
|
39
|
-
"--opname", "index.html",
|
40
|
-
"--line-numbers",
|
41
|
-
"--main", "README",
|
42
|
-
"--inline-source"]
|
43
|
-
|
44
|
-
class Hoe
|
45
|
-
def extra_deps
|
46
|
-
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
47
|
-
@extra_deps
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Generate all the Rake tasks
|
52
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
53
|
-
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
54
|
-
p.developer(AUTHOR, EMAIL)
|
55
|
-
p.description = DESCRIPTION
|
56
|
-
p.summary = DESCRIPTION
|
57
|
-
p.url = HOMEPATH
|
58
|
-
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
59
|
-
p.test_globs = ["test/**/test_*.rb"]
|
60
|
-
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
61
|
-
|
62
|
-
# == Optional
|
63
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
64
|
-
#p.extra_deps = EXTRA_DEPENDENCIES
|
65
|
-
|
66
|
-
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
67
|
-
end
|
68
|
-
|
69
|
-
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
70
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
71
|
-
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
72
|
-
$hoe.rsync_args = '-av --delete --ignore-errors'
|
73
|
-
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
data/config/requirements.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
include FileUtils
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
-
begin
|
7
|
-
require req_gem
|
8
|
-
rescue LoadError
|
9
|
-
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
-
puts "Installation: gem install #{req_gem} -y"
|
11
|
-
exit
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
data/lib/timely/version.rb
DELETED
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/timely.rb'}"
|
9
|
-
puts "Loading timely gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|