home_run 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/CHANGELOG +3 -0
  2. data/LICENSE +19 -0
  3. data/README.rdoc +314 -0
  4. data/Rakefile +140 -0
  5. data/bench/cpu_bench.rb +279 -0
  6. data/bench/dt_garbage_bench.rb +11 -0
  7. data/bench/dt_mem_bench.rb +14 -0
  8. data/bench/garbage_bench.rb +11 -0
  9. data/bench/mem_bench.rb +14 -0
  10. data/bin/home_run +87 -0
  11. data/default.mspec +12 -0
  12. data/ext/date/format.rb +842 -0
  13. data/ext/date.rb +7 -0
  14. data/ext/date_ext.c +4548 -0
  15. data/ext/date_parser.c +367 -0
  16. data/ext/date_parser.rl +134 -0
  17. data/ext/datetime.c +2804 -0
  18. data/ext/extconf.rb +6 -0
  19. data/spec/date/accessor_spec.rb +176 -0
  20. data/spec/date/add_month_spec.rb +26 -0
  21. data/spec/date/add_spec.rb +23 -0
  22. data/spec/date/boat_spec.rb +38 -0
  23. data/spec/date/civil_spec.rb +147 -0
  24. data/spec/date/commercial_spec.rb +153 -0
  25. data/spec/date/constants_spec.rb +44 -0
  26. data/spec/date/conversions_spec.rb +246 -0
  27. data/spec/date/day_spec.rb +73 -0
  28. data/spec/date/downto_spec.rb +17 -0
  29. data/spec/date/eql_spec.rb +16 -0
  30. data/spec/date/format_spec.rb +52 -0
  31. data/spec/date/gregorian_spec.rb +52 -0
  32. data/spec/date/hash_spec.rb +11 -0
  33. data/spec/date/julian_spec.rb +129 -0
  34. data/spec/date/leap_spec.rb +19 -0
  35. data/spec/date/minus_month_spec.rb +25 -0
  36. data/spec/date/minus_spec.rb +51 -0
  37. data/spec/date/next_prev_spec.rb +108 -0
  38. data/spec/date/ordinal_spec.rb +83 -0
  39. data/spec/date/parse_spec.rb +442 -0
  40. data/spec/date/parsing_spec.rb +77 -0
  41. data/spec/date/relationship_spec.rb +28 -0
  42. data/spec/date/step_spec.rb +109 -0
  43. data/spec/date/strftime_spec.rb +223 -0
  44. data/spec/date/strptime_spec.rb +201 -0
  45. data/spec/date/succ_spec.rb +20 -0
  46. data/spec/date/today_spec.rb +15 -0
  47. data/spec/date/upto_spec.rb +17 -0
  48. data/spec/datetime/accessor_spec.rb +218 -0
  49. data/spec/datetime/add_month_spec.rb +26 -0
  50. data/spec/datetime/add_spec.rb +36 -0
  51. data/spec/datetime/boat_spec.rb +43 -0
  52. data/spec/datetime/constructor_spec.rb +142 -0
  53. data/spec/datetime/conversions_spec.rb +54 -0
  54. data/spec/datetime/day_spec.rb +73 -0
  55. data/spec/datetime/downto_spec.rb +39 -0
  56. data/spec/datetime/eql_spec.rb +17 -0
  57. data/spec/datetime/format_spec.rb +59 -0
  58. data/spec/datetime/hash_spec.rb +11 -0
  59. data/spec/datetime/leap_spec.rb +19 -0
  60. data/spec/datetime/minus_month_spec.rb +25 -0
  61. data/spec/datetime/minus_spec.rb +77 -0
  62. data/spec/datetime/next_prev_spec.rb +138 -0
  63. data/spec/datetime/now_spec.rb +18 -0
  64. data/spec/datetime/parse_spec.rb +390 -0
  65. data/spec/datetime/parsing_spec.rb +77 -0
  66. data/spec/datetime/relationship_spec.rb +28 -0
  67. data/spec/datetime/step_spec.rb +155 -0
  68. data/spec/datetime/strftime_spec.rb +118 -0
  69. data/spec/datetime/strptime_spec.rb +117 -0
  70. data/spec/datetime/succ_spec.rb +24 -0
  71. data/spec/datetime/upto_spec.rb +39 -0
  72. data/spec/spec_helper.rb +59 -0
  73. metadata +138 -0
@@ -0,0 +1,118 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ describe "DateTime#strftime" do
4
+
5
+ it "should be able to print the date time" do
6
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime.should == "2000-04-06T10:11:12+00:00"
7
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime.should == DateTime.civil(2000, 4, 6, 10, 11, 12).to_s
8
+ end
9
+
10
+ it "should be able to print the hour in a 24 hour clock with leading zero" do
11
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%H').should == "10"
12
+ DateTime.civil(2000, 4, 6, 13, 11, 12).strftime('%H').should == "13"
13
+ end
14
+
15
+ it "should be able to print the hour in a 12 hour clock with leading zero" do
16
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%I').should == "10"
17
+ DateTime.civil(2000, 4, 6, 13, 11, 12).strftime('%I').should == "01"
18
+ end
19
+
20
+ it "should be able to print the hour in a 24 hour clock with leading space" do
21
+ DateTime.civil(2000, 4, 6, 9, 11, 12).strftime('%k').should == " 9"
22
+ DateTime.civil(2000, 4, 6, 13, 11, 12).strftime('%k').should == "13"
23
+ end
24
+
25
+ it "should be able to print the hour in a 12 hour clock with leading space" do
26
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%l').should == "10"
27
+ DateTime.civil(2000, 4, 6, 13, 11, 12).strftime('%l').should == " 1"
28
+ end
29
+
30
+ it "should be able to print the number of milliseconds of the second" do
31
+ DateTime.civil(2008, 11, 12, 14, 3, 30, -8/24.0).strftime('%L').should == "000"
32
+ (DateTime.civil(2008, 11, 12, 14, 3, 31, 8/24.0) + (0.5/86400)).strftime('%L').should == "500"
33
+ end
34
+
35
+ it "should be able to print the minute with leading zero" do
36
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%M').should == "11"
37
+ DateTime.civil(2000, 4, 6, 10, 14, 12).strftime('%M').should == "14"
38
+ end
39
+
40
+ it "should be able to print the number of nanoseconds of the second" do
41
+ DateTime.civil(2008, 11, 12, 14, 3, 30, -8/24.0).strftime('%N').should == "000000000"
42
+ (DateTime.civil(2008, 11, 12, 14, 3, 31, 8/24.0) + (0.5/86400)).strftime('%N').should == "500000000"
43
+ end
44
+
45
+ it "should be able to print the meridian indicator in lower case" do
46
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%P').should == "am"
47
+ DateTime.civil(2000, 4, 6, 13, 11, 12).strftime('%P').should == "pm"
48
+ end
49
+
50
+ it "should be able to print the meridian indicator in upper case" do
51
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%p').should == "AM"
52
+ DateTime.civil(2000, 4, 6, 13, 11, 12).strftime('%p').should == "PM"
53
+ end
54
+
55
+ it "should be able to print the number of milliseconds since the unix epoch" do
56
+ DateTime.civil(2008, 11, 12, 14, 3, 30, -8/24.0).strftime('%Q').should == "1226527410000"
57
+ (DateTime.civil(2008, 11, 12, 14, 3, 31, 8/24.0) + (0.5/86400)).strftime('%Q').should == "1226469811500"
58
+ end
59
+
60
+ it "should be able to print the second with leading zero" do
61
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%S').should == "12"
62
+ DateTime.civil(2000, 4, 6, 10, 11, 13).strftime('%S').should == "13"
63
+ end
64
+
65
+ it "should be able to print the number of seconds since the unix epoch" do
66
+ DateTime.civil(2008, 11, 12, 14, 3, 30, -8/24.0).strftime('%s').should == "1226527410"
67
+ DateTime.civil(2008, 11, 12, 14, 3, 31, 8/24.0).strftime('%s').should == "1226469811"
68
+ end
69
+
70
+ it "should be able to print the time zone offset as a string of hours and minutes" do
71
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%z').should == "+0000"
72
+ DateTime.civil(2000, 4, 6, 10, 11, 12, -0.5).strftime('%z').should == "-1200"
73
+ DateTime.civil(2000, 4, 6, 10, 11, 12, 0.5).strftime('%z').should == "+1200"
74
+ DateTime.civil(2000, 4, 6, 10, 11, 12, -1/24.0).strftime('%z').should == "-0100"
75
+ DateTime.civil(2000, 4, 6, 10, 11, 12, 1/24.0).strftime('%z').should == "+0100"
76
+
77
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%Z').should == "+00:00"
78
+ DateTime.civil(2000, 4, 6, 10, 11, 12, -0.5).strftime('%Z').should == "-12:00"
79
+ DateTime.civil(2000, 4, 6, 10, 11, 12, 0.5).strftime('%Z').should == "+12:00"
80
+ DateTime.civil(2000, 4, 6, 10, 11, 12, -1/24.0).strftime('%Z').should == "-01:00"
81
+ DateTime.civil(2000, 4, 6, 10, 11, 12, 1/24.0).strftime('%Z').should == "+01:00"
82
+ end
83
+
84
+ ############################
85
+ # Specs that combine stuff #
86
+ ############################
87
+
88
+ it "should be able to print the common date" do
89
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime("%c").should == "Thu Apr 6 10:11:12 2000"
90
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime("%c").should == DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%a %b %e %H:%M:%S %Y')
91
+ end
92
+
93
+ it "should be able to print the hour and minute" do
94
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime("%R").should == "10:11"
95
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime("%R").should == DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%H:%M')
96
+ end
97
+
98
+ it "should be able to show the hour, minute, second, and am/pm flag" do
99
+ DateTime.civil(2000, 4, 9, 10, 11, 12).strftime("%r").should == "10:11:12 AM"
100
+ DateTime.civil(2000, 4, 9, 13, 11, 12).strftime("%r").should == " 1:11:12 PM"
101
+ DateTime.civil(2000, 4, 9, 10, 11, 12).strftime("%r").should == DateTime.civil(2000, 4, 9, 10, 11, 12).strftime('%I:%M:%S %p')
102
+ end
103
+
104
+ it "should be able to show the hour, minute, and second" do
105
+ DateTime.civil(2000, 4, 9, 10, 11, 12).strftime("%T").should == "10:11:12"
106
+ DateTime.civil(2000, 4, 9, 13, 11, 12).strftime("%T").should == "13:11:12"
107
+ DateTime.civil(2000, 4, 9, 10, 11, 12).strftime("%T").should == DateTime.civil(2000, 4, 9, 10, 11, 12).strftime('%H:%M:%S')
108
+ DateTime.civil(2000, 4, 9, 10, 11, 12).strftime("%X").should == "10:11:12"
109
+ DateTime.civil(2000, 4, 9, 13, 11, 12).strftime("%X").should == "13:11:12"
110
+ DateTime.civil(2000, 4, 9, 10, 11, 12).strftime("%X").should == DateTime.civil(2000, 4, 9, 10, 11, 12).strftime('%H:%M:%S')
111
+ end
112
+
113
+ it "should be able to print the common date and timezone" do
114
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime("%+").should == "Thu Apr 6 10:11:12 +00:00 2000"
115
+ DateTime.civil(2000, 4, 6, 10, 11, 12, 0.5).strftime("%+").should == "Thu Apr 6 10:11:12 +12:00 2000"
116
+ DateTime.civil(2000, 4, 6, 10, 11, 12).strftime("%+").should == DateTime.civil(2000, 4, 6, 10, 11, 12).strftime('%a %b %e %H:%M:%S %Z %Y')
117
+ end
118
+ end
@@ -0,0 +1,117 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ describe "DateTime.strptime" do
4
+ before do
5
+ @t = Time.now
6
+ end
7
+
8
+ it "._strptime should be a hash of values" do
9
+ DateTime._strptime('2008-10-11T01:00:02+0000').should == {:offset=>0, :zone=>"+0000", :sec=>2, :year=>2008, :hour=>1, :mday=>11, :min=>0, :mon=>10}
10
+ DateTime._strptime('2008-10-11', '%Y-%m-%d').should == {:year=>2008, :mon=>10, :mday=>11}
11
+ end
12
+
13
+ it "should have defaults and an optional sg value" do
14
+ DateTime.strptime('2008-10-11T00:00:00+00:00').should == DateTime.civil(2008, 10, 11)
15
+ DateTime.strptime('2008-10-11', '%Y-%m-%d').should == DateTime.civil(2008, 10, 11)
16
+ DateTime.strptime('2008-10-11', '%Y-%m-%d', 1).should == DateTime.civil(2008, 10, 11)
17
+ DateTime.strptime.should == DateTime.jd
18
+ end
19
+
20
+ it "should be able to parse the date time" do
21
+ DateTime.strptime("2000-04-06T10:11:12+00:00").should == DateTime.civil(2000, 4, 6, 10, 11, 12)
22
+ end
23
+
24
+ it "should be able to parse the hour in a 24 hour clock with leading zero" do
25
+ DateTime.strptime("10", '%H').should == DateTime.civil(@t.year, @t.mon, @t.day, 10, 0, 0)
26
+ DateTime.strptime("09", '%H').should == DateTime.civil(@t.year, @t.mon, @t.day, 9, 0, 0)
27
+ DateTime.strptime("2000 16", '%Y %H').should == DateTime.civil(2000, 1, 1, 16, 0, 0)
28
+ end
29
+
30
+ it "should be able to parse the hour in a 12 hour clock with leading zero with meridian indicator" do
31
+ DateTime.strptime("10 AM", '%I %p').should == DateTime.civil(@t.year, @t.mon, @t.day, 10, 0, 0)
32
+ DateTime.strptime("03 04 04 PM", '%m %d %I %p').should == DateTime.civil(@t.year, 3, 4, 16, 0, 0)
33
+ end
34
+
35
+ it "should be able to parse the hour in a 24 hour clock with leading space" do
36
+ DateTime.strptime("10", '%k').should == DateTime.civil(@t.year, @t.mon, @t.day, 10, 0, 0)
37
+ DateTime.strptime(" 9", '%k').should == DateTime.civil(@t.year, @t.mon, @t.day, 9, 0, 0)
38
+ DateTime.strptime("10 16", '%d %k').should == DateTime.civil(@t.year, @t.mon, 10, 16, 0, 0)
39
+ end
40
+
41
+ it "should be able to parse the hour in a 12 hour clock with leading space with meridian indicator" do
42
+ DateTime.strptime("10 am", '%l %P').should == DateTime.civil(@t.year, @t.mon, @t.day, 10, 0, 0)
43
+ DateTime.strptime(" 4 pm", '%l %P').should == DateTime.civil(@t.year, @t.mon, @t.day, 16, 0, 0)
44
+ end
45
+
46
+ it "should be able to parse the number of milliseconds of the second" do
47
+ DateTime.strptime("10 000", '%M %L').should == DateTime.civil(@t.year, @t.mon, @t.day, 0, 10, 0)
48
+ DateTime.strptime("10 500", '%M %L').should == DateTime.civil(@t.year, @t.mon, @t.day, 0, 10, 0) + (0.5/86400)
49
+ end
50
+
51
+ it "should be able to parse the minute with leading zero" do
52
+ DateTime.strptime("10", '%M').should == DateTime.civil(@t.year, @t.mon, @t.day, 0, 10, 0)
53
+ DateTime.strptime("09", '%M').should == DateTime.civil(@t.year, @t.mon, @t.day, 0, 9, 0)
54
+ end
55
+
56
+ it "should be able to parse the number of nanoseconds of the second" do
57
+ DateTime.strptime("10 000000000", '%M %N').should == DateTime.civil(@t.year, @t.mon, @t.day, 0, 10, 0)
58
+ DateTime.strptime("10 500000000", '%M %N').should == DateTime.civil(@t.year, @t.mon, @t.day, 0, 10, 0) + (0.5/86400)
59
+ end
60
+
61
+ it "should be able to parse the number of seconds since the unix epoch" do
62
+ Date.strptime("954979200", "%s").should == Date.civil(2000, 4, 6)
63
+ end
64
+
65
+ it "should be able to parse the number of milliseconds since the unix epoch" do
66
+ DateTime.strptime("1226527410000", '%Q').should == DateTime.civil(2008, 11, 12, 22, 3, 30, 0)
67
+ DateTime.strptime("1226527411000", '%Q').should == DateTime.civil(2008, 11, 12, 22, 3, 31, 0)
68
+ DateTime.strptime("32511888001500", "%Q").should == DateTime.civil(3000, 4, 6, 0, 0, 1) + (0.5/86400)
69
+ end
70
+
71
+ it "should be able to parse the second with leading zero" do
72
+ DateTime.strptime("10", '%S').should == DateTime.civil(@t.year, @t.mon, @t.day, 0, 0, 10)
73
+ DateTime.strptime("10 09", '%H %S').should == DateTime.civil(@t.year, @t.mon, @t.day, 10, 0, 9)
74
+ end
75
+
76
+ it "should be able to parse the number of seconds since the unix epoch" do
77
+ DateTime.strptime("1226527410", '%s').should == DateTime.civil(2008, 11, 12, 22, 3, 30, 0)
78
+ DateTime.strptime("1226527411", '%s').should == DateTime.civil(2008, 11, 12, 22, 3, 31, 0)
79
+ DateTime.strptime("32511888001", "%s").should == DateTime.civil(3000, 4, 6, 0, 0, 1)
80
+ end
81
+
82
+ it "should be able to parse the time zone offset as a string of hours and minutes" do
83
+ DateTime.strptime("2000 +0000", '%Y %z').offset.should == 0
84
+ DateTime.strptime("2000 Z", '%Y %z').offset.should == 0
85
+ DateTime.strptime("2000 -1200", '%Y %z').offset.should == -0.5
86
+ DateTime.strptime("2000 +1200", '%Y %z').offset.should == 0.5
87
+ DateTime.strptime("2000 -01:00", '%Y %z').offset.should == -1/24.0
88
+ DateTime.strptime("2000 +01:00", '%Y %z').offset.should == 1/24.0
89
+ end
90
+
91
+ ############################
92
+ # Specs that combine stuff #
93
+ ############################
94
+
95
+ it "should be able to parse the common date" do
96
+ DateTime.strptime("Thu Apr 6 10:11:12 2000", "%c").should == DateTime.civil(2000, 4, 6, 10, 11, 12)
97
+ end
98
+
99
+ it "should be able to parse the hour and minute" do
100
+ DateTime.strptime("10:11", "%R").should == DateTime.civil(@t.year, @t.mon, @t.day, 10, 11, 0)
101
+ end
102
+
103
+ it "should be able to parse the hour, minute, second, and am/pm flag" do
104
+ DateTime.strptime("10:11:12 AM", "%r").should == DateTime.civil(@t.year, @t.mon, @t.day, 10, 11, 12)
105
+ DateTime.strptime("01:11:12 PM", "%r").should == DateTime.civil(@t.year, @t.mon, @t.day, 13, 11, 12)
106
+ end
107
+
108
+ it "should be able to parse the hour, minute, and second" do
109
+ DateTime.strptime("10:11:12", "%T").should == DateTime.civil(@t.year, @t.mon, @t.day, 10, 11, 12)
110
+ DateTime.strptime("01:11:12", "%X").should == DateTime.civil(@t.year, @t.mon, @t.day, 1, 11, 12)
111
+ end
112
+
113
+ it "should be able to parse the common date and timezone" do
114
+ DateTime.strptime("Thu Apr 6 10:11:12 +0000 2000", "%+").should == DateTime.civil(2000, 4, 6, 10, 11, 12)
115
+ DateTime.strptime("Thu Apr 6 10:11:12 +1200 2000", "%+").should == DateTime.civil(2000, 4, 6, 10, 11, 12, 0.5)
116
+ end
117
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ describe "DateTime#succ" do
4
+ it "should be the next day" do
5
+ ds = DateTime.civil(2008, 10, 11)
6
+ ds.succ.should == DateTime.civil(2008, 10, 12)
7
+ ds = DateTime.civil(2008, 10, 31)
8
+ ds.succ.should == DateTime.civil(2008, 11, 1)
9
+ ds = DateTime.commercial(2008, 2, 7)
10
+ ds.succ.should == DateTime.commercial(2008, 3, 1)
11
+ ds = DateTime.jd(2008)
12
+ ds.succ.should == DateTime.jd(2009)
13
+ ds = DateTime.ordinal(2008, 366)
14
+ ds.succ.should == DateTime.ordinal(2009, 1)
15
+ end
16
+
17
+ it "should be aliased as next" do
18
+ DateTime.civil(2008, 10, 11).next.should == DateTime.civil(2008, 10, 12)
19
+ end
20
+
21
+ it "should keep the same fractional component" do
22
+ DateTime.civil(2008, 10, 11, 12, 13, 14).succ.should == DateTime.civil(2008, 10, 12, 12, 13, 14)
23
+ end
24
+ end
@@ -0,0 +1,39 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ describe "DateTime#upto" do
4
+
5
+ it "should be able to step forward in time" do
6
+ ds = DateTime.civil(2008, 10, 11)
7
+ de = DateTime.civil(2008, 9, 29)
8
+ count = 0
9
+ de.upto(ds) do |d|
10
+ d.should <= ds
11
+ d.should >= de
12
+ count += 1
13
+ end
14
+ count.should == 13
15
+ end
16
+
17
+ it "should respect fractional days" do
18
+ ds = DateTime.civil(2008, 10, 11, 0)
19
+ de = DateTime.civil(2008, 9, 29, 12)
20
+ count = 0
21
+ de.upto(ds) do |d|
22
+ d.should <= ds
23
+ d.should >= de
24
+ count += 1
25
+ end
26
+ count.should == 12
27
+
28
+ ds = DateTime.civil(2008, 10, 11, 12)
29
+ de = DateTime.civil(2008, 9, 29, 0)
30
+ count = 0
31
+ de.upto(ds) do |d|
32
+ d.should <= ds
33
+ d.should >= de
34
+ count += 1
35
+ end
36
+ count.should == 13
37
+ end
38
+
39
+ end
@@ -0,0 +1,59 @@
1
+ unless ENV['MSPEC_RUNNER']
2
+ begin
3
+ require "pp"
4
+ require 'mspec/version'
5
+ require 'mspec/helpers'
6
+ require 'mspec/guards'
7
+ require 'mspec/runner/shared'
8
+ require 'mspec/matchers/be_ancestor_of'
9
+ require 'mspec/matchers/output'
10
+ require 'mspec/matchers/output_to_fd'
11
+ require 'mspec/matchers/complain'
12
+ require 'mspec/matchers/equal_element'
13
+ require 'mspec/matchers/equal_utf16'
14
+ require 'mspec/matchers/match_yaml'
15
+ require 'mspec/matchers/have_class_variable'
16
+ require 'mspec/matchers/have_constant'
17
+ require 'mspec/matchers/have_instance_method'
18
+ require 'mspec/matchers/have_instance_variable'
19
+ require 'mspec/matchers/have_method'
20
+ require 'mspec/matchers/have_private_instance_method'
21
+ require 'mspec/matchers/have_protected_instance_method'
22
+ require 'mspec/matchers/have_public_instance_method'
23
+
24
+ # Code to setup HOME directory correctly on Windows
25
+ # This duplicates Ruby 1.9 semantics for defining HOME
26
+ platform_is :windows do
27
+ if ENV['HOME']
28
+ ENV['HOME'] = ENV['HOME'].tr '\\', '/'
29
+ elsif ENV['HOMEDIR'] && ENV['HOMEDRIVE']
30
+ ENV['HOME'] = File.join(ENV['HOMEDRIVE'], ENV['HOMEDIR'])
31
+ elsif ENV['HOMEDIR']
32
+ ENV['HOME'] = ENV['HOMEDIR']
33
+ elsif ENV['HOMEDRIVE']
34
+ ENV['HOME'] = ENV['HOMEDRIVE']
35
+ elsif ENV['USERPROFILE']
36
+ ENV['HOME'] = ENV['USERPROFILE']
37
+ else
38
+ puts "No suitable HOME environment found. This means that all of"
39
+ puts "HOME, HOMEDIR, HOMEDRIVE, and USERPROFILE are not set"
40
+ exit 1
41
+ end
42
+ end
43
+
44
+ TOLERANCE = 0.00003 unless Object.const_defined?(:TOLERANCE)
45
+ rescue LoadError
46
+ puts "Please install the MSpec gem to run the specs."
47
+ exit 1
48
+ end
49
+ end
50
+
51
+ CODE_LOADING_DIR = File.expand_path "../fixtures/code", __FILE__
52
+
53
+ minimum_version = "1.5.17"
54
+ unless MSpec::VERSION >= minimum_version
55
+ puts "Please install MSpec version >= #{minimum_version} to run the specs"
56
+ exit 1
57
+ end
58
+
59
+ $VERBOSE = nil unless ENV['OUTPUT_WARNINGS']
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: home_run
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeremy Evans
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-08-20 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: |
17
+ home_run is an implementation of ruby's Date/DateTime classes in C,
18
+ with much better performance (20-200x) than the version in the
19
+ standard library, while being almost completely compatible.
20
+
21
+ email: code@jeremyevans.net
22
+ executables:
23
+ - home_run
24
+ extensions:
25
+ - ext/extconf.rb
26
+ extra_rdoc_files:
27
+ - README.rdoc
28
+ - CHANGELOG
29
+ - LICENSE
30
+ files:
31
+ - LICENSE
32
+ - CHANGELOG
33
+ - README.rdoc
34
+ - Rakefile
35
+ - default.mspec
36
+ - bin/home_run
37
+ - ext/extconf.rb
38
+ - ext/date.rb
39
+ - ext/date_parser.c
40
+ - ext/datetime.c
41
+ - ext/date_ext.c
42
+ - ext/date/format.rb
43
+ - ext/date_parser.rl
44
+ - spec/datetime/accessor_spec.rb
45
+ - spec/datetime/add_spec.rb
46
+ - spec/datetime/boat_spec.rb
47
+ - spec/datetime/constructor_spec.rb
48
+ - spec/datetime/eql_spec.rb
49
+ - spec/datetime/minus_spec.rb
50
+ - spec/datetime/now_spec.rb
51
+ - spec/datetime/parse_spec.rb
52
+ - spec/datetime/strftime_spec.rb
53
+ - spec/datetime/strptime_spec.rb
54
+ - spec/datetime/downto_spec.rb
55
+ - spec/datetime/format_spec.rb
56
+ - spec/datetime/conversions_spec.rb
57
+ - spec/datetime/upto_spec.rb
58
+ - spec/datetime/step_spec.rb
59
+ - spec/datetime/hash_spec.rb
60
+ - spec/datetime/leap_spec.rb
61
+ - spec/datetime/succ_spec.rb
62
+ - spec/datetime/add_month_spec.rb
63
+ - spec/datetime/day_spec.rb
64
+ - spec/datetime/minus_month_spec.rb
65
+ - spec/datetime/relationship_spec.rb
66
+ - spec/datetime/parsing_spec.rb
67
+ - spec/datetime/next_prev_spec.rb
68
+ - spec/spec_helper.rb
69
+ - spec/date/accessor_spec.rb
70
+ - spec/date/add_month_spec.rb
71
+ - spec/date/add_spec.rb
72
+ - spec/date/boat_spec.rb
73
+ - spec/date/civil_spec.rb
74
+ - spec/date/commercial_spec.rb
75
+ - spec/date/constants_spec.rb
76
+ - spec/date/conversions_spec.rb
77
+ - spec/date/downto_spec.rb
78
+ - spec/date/eql_spec.rb
79
+ - spec/date/gregorian_spec.rb
80
+ - spec/date/hash_spec.rb
81
+ - spec/date/julian_spec.rb
82
+ - spec/date/minus_month_spec.rb
83
+ - spec/date/minus_spec.rb
84
+ - spec/date/ordinal_spec.rb
85
+ - spec/date/parse_spec.rb
86
+ - spec/date/day_spec.rb
87
+ - spec/date/relationship_spec.rb
88
+ - spec/date/step_spec.rb
89
+ - spec/date/strftime_spec.rb
90
+ - spec/date/strptime_spec.rb
91
+ - spec/date/upto_spec.rb
92
+ - spec/date/leap_spec.rb
93
+ - spec/date/succ_spec.rb
94
+ - spec/date/today_spec.rb
95
+ - spec/date/format_spec.rb
96
+ - spec/date/next_prev_spec.rb
97
+ - spec/date/parsing_spec.rb
98
+ - bench/cpu_bench.rb
99
+ - bench/dt_garbage_bench.rb
100
+ - bench/dt_mem_bench.rb
101
+ - bench/mem_bench.rb
102
+ - bench/garbage_bench.rb
103
+ has_rdoc: true
104
+ homepage: http://github.com/jeremyevans/home_run
105
+ licenses: []
106
+
107
+ post_install_message:
108
+ rdoc_options:
109
+ - --quiet
110
+ - --line-numbers
111
+ - --inline-source
112
+ - --title
113
+ - "home_run: Fast Date/DateTime classes for ruby"
114
+ - --main
115
+ - README.rdoc
116
+ require_paths:
117
+ - ext
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 1.8.6
123
+ version:
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: "0"
129
+ version:
130
+ requirements: []
131
+
132
+ rubyforge_project:
133
+ rubygems_version: 1.3.5
134
+ signing_key:
135
+ specification_version: 3
136
+ summary: Fast Date/DateTime classes for ruby
137
+ test_files: []
138
+