gem_velocity 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/README.md +18 -49
- data/TODO +7 -5
- data/examples/README.md +1 -0
- data/examples/generate_images.rb +48 -0
- data/examples/public/images/AggregatedVelocitator-haml-i18n-extractor-0.4.x.png +0 -0
- data/examples/public/images/Multiplexer-haml-i18n-extractor-0.0.17-0.0.16-0.4.x.png +0 -0
- data/examples/public/images/Multiplexer-haml-i18n-extractor-0.4.x-0.3.x.png +0 -0
- data/examples/public/images/SingleVelocitator-haml-i18n-extractor-0.0.16.png +0 -0
- data/examples/public/images/SingleVelocitator-haml-i18n-extractor-0.0.17.png +0 -0
- data/lib/gem_velocity/gem_data.rb +1 -1
- data/lib/gem_velocity/gruff_builder.rb +16 -13
- data/lib/gem_velocity/helpers.rb +26 -0
- data/lib/gem_velocity/velocitators/aggregated_velocitator.rb +24 -16
- data/lib/gem_velocity/velocitators/base_velocitator.rb +45 -39
- data/lib/gem_velocity/velocitators/factory.rb +52 -0
- data/lib/gem_velocity/velocitators/multiplexer.rb +65 -0
- data/lib/gem_velocity/velocitators/single_velocitator.rb +22 -14
- data/lib/gem_velocity/version.rb +1 -1
- data/lib/gem_velocity.rb +8 -1
- data/spec/aggregated_velocitor_spec.rb +53 -0
- data/spec/factory_spec.rb +54 -0
- data/spec/gruff_builder_spec.rb +0 -3
- data/spec/multiplexer_spec.rb +73 -0
- data/spec/no_time_cop_spec.rb +12 -28
- data/spec/single_velocitator_spec.rb +92 -0
- data/spec/spec_helper.rb +4 -0
- metadata +21 -11
- data/examples/rails-4.0.0-3.2.14-0.9.1.png +0 -0
- data/examples/rails-4.0.0-3.2.14-2.3.5.png +0 -0
- data/examples/rails-4.0.1.rc1-4.0.0-4.0.0.rc2-4.0.0.rc1-4.0.0.beta1.png +0 -0
- data/lib/gem_velocity/velocitators/all.rb +0 -4
- data/lib/gem_velocity/velocitators/multiple_velocitator.rb +0 -34
- data/spec/velocitator_spec.rb +0 -189
data/spec/velocitator_spec.rb
DELETED
@@ -1,189 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# https://github.com/shaiguitar/rubygems.org/compare/api_not_returning_all_results_over_90_days?expand=1
|
4
|
-
|
5
|
-
describe "a Velocitator rendering graphs" do
|
6
|
-
|
7
|
-
# testing single_velocitator is enough to test base
|
8
|
-
it "can render a graph" do
|
9
|
-
velocitator = SingleVelocitator.new("haml-i18n-extractor", "0.0.17")
|
10
|
-
velocitator.date_range = [ 7.days.ago, 3.days.ago ]
|
11
|
-
velocitator.root = SpecHelper.tmpdir
|
12
|
-
|
13
|
-
# Plausible to change this?
|
14
|
-
# the values for the two days mentioned in the date range.
|
15
|
-
# should this be the specific date range values?? aggregated since when? not aggregated?
|
16
|
-
velocitator.graph_options[:line_datas].should == [[303, 303, 303, 304, 304]]
|
17
|
-
|
18
|
-
velocitator.graph_options[:title].should == "haml-i18n-extractor-0.0.17\n(downloads: 377)"
|
19
|
-
velocitator.graph_options[:labels].should == ({1=>"2013-09-13", (velocitator.line_datas.first.size-2) =>"2013-09-17"})
|
20
|
-
velocitator.graph_options[:max_value].should == 306 # the max in the range (time.now)
|
21
|
-
velocitator.graph_options[:min_value].should == 0
|
22
|
-
|
23
|
-
file = velocitator.graph
|
24
|
-
File.exist?(file).should be_true
|
25
|
-
#`open #{file} -a preview.app`
|
26
|
-
#Kernel.sleep(10)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "has a shortcut graph method #1" do
|
30
|
-
velocitator = SingleVelocitator.new("haml-i18n-extractor", "0.0.17")
|
31
|
-
file = velocitator.graph(SpecHelper.tmpdir,[1.day.ago, Time.now])
|
32
|
-
File.exist?(file).should be_true
|
33
|
-
end
|
34
|
-
|
35
|
-
it "has a shortcut graph method #2" do
|
36
|
-
velocitator = SingleVelocitator.new("haml-i18n-extractor", "0.0.17")
|
37
|
-
file = velocitator.graph
|
38
|
-
File.exist?(file).should be_true
|
39
|
-
end
|
40
|
-
|
41
|
-
it "has a shortcut graph metho #3" do
|
42
|
-
velocitator = SingleVelocitator.new("haml-i18n-extractor", "0.0.17")
|
43
|
-
file = velocitator.graph(nil,nil,0,1000)
|
44
|
-
File.exist?(file).should be_true
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe SingleVelocitator do
|
49
|
-
it 'raises if you dont pass name and version(s)' do
|
50
|
-
lambda { SingleVelocitator.new(nil,nil) }.should raise_error ArgumentError
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'raises if the gem is not found' do
|
54
|
-
lambda { SingleVelocitator.new("NOSICHGEMPlZ123","0.1") }.should raise_error NoSuchGem
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'raises if the version is not found' do
|
58
|
-
lambda { SingleVelocitator.new("haml-i18n-extractor","100.999.42.666.pre") }.should raise_error NoSuchVersion
|
59
|
-
end
|
60
|
-
|
61
|
-
it "holds the totals of the gem" do
|
62
|
-
velocitator = SingleVelocitator.new("haml-i18n-extractor", "0.0.17")
|
63
|
-
velocitator.totals.first[:version_downloads].should eq 377
|
64
|
-
#binding.pry
|
65
|
-
end
|
66
|
-
|
67
|
-
it "sets a specific date range according to the gem's info" do
|
68
|
-
velocitator = SingleVelocitator.new("haml-i18n-extractor", "0.0.17")
|
69
|
-
velocitator.effective_date_range.should eq ["2013-06-16T00:00:00Z", "2013-09-20T00:00:00Z"]
|
70
|
-
end
|
71
|
-
|
72
|
-
it "can override the default time ranges if its in the range" do
|
73
|
-
velocitator = SingleVelocitator.new("haml-i18n-extractor", "0.0.17")
|
74
|
-
velocitator.date_range = [1.day.ago, Time.now]
|
75
|
-
velocitator.effective_date_range.should eq ["2013-09-19T00:00:00Z", "2013-09-20T00:00:00Z"]
|
76
|
-
end
|
77
|
-
|
78
|
-
it "can override a max and min" do
|
79
|
-
velocitator = SingleVelocitator.new("haml-i18n-extractor", "0.0.17")
|
80
|
-
lambda {
|
81
|
-
velocitator.max_value = 500
|
82
|
-
velocitator.min_value = 10
|
83
|
-
}.should_not raise_error
|
84
|
-
end
|
85
|
-
|
86
|
-
it "has line datas" do
|
87
|
-
velocitator = SingleVelocitator.new("haml-i18n-extractor", "0.0.17")
|
88
|
-
velocitator.line_datas.size.should eq (velocitator.versions.size)
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
describe MultipleVelocitator do
|
95
|
-
before do
|
96
|
-
@some_versions = ["0.0.17", "0.0.5","0.0.10"]
|
97
|
-
end
|
98
|
-
|
99
|
-
it "can initialize multiple versions" do
|
100
|
-
velocitator = MultipleVelocitator.new("haml-i18n-extractor", @some_versions)
|
101
|
-
velocitator.versions.should == @some_versions
|
102
|
-
end
|
103
|
-
|
104
|
-
it "holds the totals of the gem" do
|
105
|
-
velocitator = MultipleVelocitator.new("haml-i18n-extractor", ["0.0.17"])
|
106
|
-
velocitator.totals.first[:version_downloads].should eq 377
|
107
|
-
end
|
108
|
-
|
109
|
-
it "sets the earliest start range from to all of the versions info" do
|
110
|
-
# some_versions.map{|v| GemData.new("haml-i18n-extractor").versions_built_at[v]}
|
111
|
-
# => ["2013-06-16T00:00:00Z", "2013-03-22T00:00:00Z", "2013-05-06T00:00:00Z"]
|
112
|
-
velocitator = MultipleVelocitator.new("haml-i18n-extractor", @some_versions)
|
113
|
-
velocitator.effective_date_range.should eq ["2013-03-22T00:00:00Z", "2013-09-20T00:00:00Z"]
|
114
|
-
end
|
115
|
-
|
116
|
-
it "sets the max value to the max of all of versions" do
|
117
|
-
velocitator = MultipleVelocitator.new("haml-i18n-extractor", @some_versions)
|
118
|
-
velocitator.default_max_value.should eq 344
|
119
|
-
end
|
120
|
-
|
121
|
-
it "sets the max value to the max of all of versions" do
|
122
|
-
velocitator = MultipleVelocitator.new("haml-i18n-extractor", @some_versions)
|
123
|
-
velocitator.default_max_value.should eq 344
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should set the line data to an array of versions.size with equal length which should be the max value of any one of them" do
|
127
|
-
velocitator = MultipleVelocitator.new("haml-i18n-extractor", @some_versions)
|
128
|
-
velocitator.line_datas.size.should == @some_versions.size
|
129
|
-
# all of them should be the same size, padded with 0's if there is no download info
|
130
|
-
velocitator.line_datas.map{|d| d.size }.uniq.size.should == 1
|
131
|
-
end
|
132
|
-
|
133
|
-
it "has a shortcut graph method" do
|
134
|
-
velocitator = MultipleVelocitator.new("haml-i18n-extractor", @some_versions)
|
135
|
-
file = velocitator.graph
|
136
|
-
File.exist?(file).should be_true
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
describe AggregatedVelocitator do
|
141
|
-
before do
|
142
|
-
@gem_name = "haml-i18n-extractor"
|
143
|
-
@major_version = "0"
|
144
|
-
@minor_version = "0.4"
|
145
|
-
end
|
146
|
-
|
147
|
-
it "can initialize and find out about all versions in a major" do
|
148
|
-
velocitator = AggregatedVelocitator.new(@gem_name, @major_version)
|
149
|
-
velocitator.aggregated_versions.should == ["0.5.9", "0.5.8", "0.5.6", "0.5.5", "0.5.4", "0.5.3", "0.5.2", "0.5.1", "0.5.0", "0.4.3", "0.4.2", "0.4.1", "0.4.0", "0.3.5", "0.3.4", "0.3.2", "0.3.0", "0.2.1", "0.2.0", "0.1.0", "0.0.21", "0.0.20", "0.0.19", "0.0.18", "0.0.17", "0.0.16", "0.0.15", "0.0.12", "0.0.10", "0.0.9", "0.0.5"]
|
150
|
-
end
|
151
|
-
|
152
|
-
it "can initialize and find out about all versions in specific a minor" do
|
153
|
-
velocitator = AggregatedVelocitator.new(@gem_name, @minor_version)
|
154
|
-
velocitator.aggregated_versions.should == ["0.4.3", "0.4.2", "0.4.1", "0.4.0"]
|
155
|
-
end
|
156
|
-
|
157
|
-
it "sends the first and last version passed as versions though" do
|
158
|
-
velocitator = AggregatedVelocitator.new(@gem_name, @minor_version)
|
159
|
-
velocitator.versions = ["0.4.3","0.4.0"]
|
160
|
-
end
|
161
|
-
|
162
|
-
it "sends only one graph that is the total of those versions" do
|
163
|
-
velocitator = AggregatedVelocitator.new(@gem_name, @minor_version)
|
164
|
-
velocitator.line_datas.first.size == 1 # [[1,2,3]] but not [[1,2,3][1,4,8]]
|
165
|
-
end
|
166
|
-
|
167
|
-
it "sets the max to the multiple of one of its members max * the amount of versions" do
|
168
|
-
velocitator = AggregatedVelocitator.new(@gem_name, @minor_version)
|
169
|
-
velocitator.default_max_value.should eq 356
|
170
|
-
end
|
171
|
-
|
172
|
-
it "sends only one graph and can draw a graph of it" do
|
173
|
-
velocitator = AggregatedVelocitator.new(@gem_name, @minor_version)
|
174
|
-
file = velocitator.graph
|
175
|
-
end
|
176
|
-
|
177
|
-
it "hides the legend caption" do
|
178
|
-
velocitator = AggregatedVelocitator.new(@gem_name, "0.0.17")
|
179
|
-
velocitator.graph_options[:hide_legend].should == true
|
180
|
-
end
|
181
|
-
|
182
|
-
it "should accumlate the same data as a single_velocitator" do
|
183
|
-
a_velocitator = AggregatedVelocitator.new(@gem_name, "0.0.17")
|
184
|
-
s_velocitator = SingleVelocitator.new(@gem_name, "0.0.17")
|
185
|
-
a_velocitator.versions.should == s_velocitator.versions
|
186
|
-
a_velocitator.graph_options[:line_datas].should == s_velocitator.graph_options[:line_datas]
|
187
|
-
end
|
188
|
-
|
189
|
-
end
|