gem_velocity 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -18
- data/TODO +14 -1
- data/gem_velocity.gemspec +2 -0
- data/lib/gem_velocity/errors.rb +5 -0
- data/lib/gem_velocity/gem_data.rb +16 -8
- data/lib/gem_velocity/gruff_builder.rb +2 -4
- data/lib/gem_velocity/velocitator.rb +30 -13
- data/lib/gem_velocity/version.rb +1 -1
- data/lib/gem_velocity.rb +1 -0
- data/spec/gem_data_spec.rb +4 -14
- data/spec/no_time_cop_spec.rb +5 -6
- data/spec/spec_helper.rb +23 -0
- data/spec/velocitator_spec.rb +64 -98
- metadata +33 -4
data/README.md
CHANGED
@@ -10,32 +10,24 @@ It draws graphs. So...you'll need imagemagick/rmagick. I'm sure you'll survive.
|
|
10
10
|
|
11
11
|
# Example
|
12
12
|
|
13
|
-
|
13
|
+
Here's one: [celluloid](https://gist.github.com/shaiguitar/7e6d95971c5254fa3665)
|
14
|
+
|
15
|
+
Here's some more:
|
14
16
|
|
15
17
|
<pre>
|
16
|
-
|
17
|
-
|
18
|
-
velocitator = Velocitator.new("rails", ["4.0.0","3.2.14","2.3.5"])
|
19
|
-
file = velocitator.graph("/tmp")
|
20
|
-
File.exist?(file).should be_true
|
21
|
-
end
|
22
|
-
end
|
18
|
+
velocitator = Velocitator.new("rails", ["4.0.0","3.2.14","2.3.5"])
|
19
|
+
file = velocitator.graph("/tmp")
|
23
20
|
</pre>
|
24
21
|
|
25
22
|
Produces:
|
26
23
|
|
27
24
|
![here](examples/rails-4.0.0-3.2.14-2.3.5.png)
|
28
25
|
|
29
|
-
|
26
|
+
Notice the date range:
|
30
27
|
|
31
28
|
<pre>
|
32
|
-
|
33
|
-
|
34
|
-
velocitator = Velocitator.new("rails", ["4.0.0","3.2.14","0.9.1"])
|
35
|
-
file = velocitator.graph("/tmp", [3.months.ago, Time.now])
|
36
|
-
File.exist?(file).should be_true
|
37
|
-
end
|
38
|
-
end
|
29
|
+
velocitator = Velocitator.new("rails", ["4.0.0","3.2.14","0.9.1"])
|
30
|
+
file = velocitator.graph("/tmp", [3.months.ago, Time.now])
|
39
31
|
</pre>
|
40
32
|
|
41
33
|
Produces:
|
@@ -53,5 +45,3 @@ Lemme know.
|
|
53
45
|
## Feedback
|
54
46
|
|
55
47
|
Is appreciated! Any (other) ideas?
|
56
|
-
|
57
|
-
|
data/TODO
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
move VCR to an :around spec
|
2
2
|
change readme.md to have one example with different options to populate
|
3
|
-
|
4
3
|
Add an aggregate method to add #graph for a point version? (e.g, 0.n.x graph for all n versions. maybe just major, maybe minor, whatever).
|
5
4
|
|
5
|
+
web ui/embeddable links with those images.
|
6
|
+
can't remove images
|
7
|
+
have uniq name: hash the date_range,max,min,name,versions. (and time?)
|
8
|
+
shard the directories of where the image goes so it doesn't bomb out?
|
9
|
+
|
10
|
+
SingleVersionsVelocitator takes versions
|
11
|
+
SingleVersionsVelocitator has a shortcut for displaying all versions in a major?
|
12
|
+
MajorVersionsVelocitator takes one major version
|
13
|
+
AllVersionsVelocitator takes no version, dispalys all stats
|
14
|
+
|
15
|
+
I want to be able to have a line be one version, or a few versions in one, mix those/not, then decide to display them in the end
|
16
|
+
line_datas needs to be abstracted away. actually the versions concepts should be eliminated??
|
17
|
+
so I need to have something abstract a version but it could be a few of them...
|
18
|
+
move all the logic of changing version -> line_data into something and have that able to handle 1 or n.
|
data/gem_velocity.gemspec
CHANGED
@@ -29,5 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "vcr"
|
30
30
|
spec.add_development_dependency "webmock", "= 1.13" # vcr requirement?
|
31
31
|
spec.add_development_dependency "timecop"
|
32
|
+
spec.add_development_dependency "sourcify"
|
33
|
+
spec.add_development_dependency "ParseTree"
|
32
34
|
|
33
35
|
end
|
@@ -15,36 +15,44 @@ class GemData
|
|
15
15
|
h
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
# todo rename method? aggregated downloads per day
|
19
|
+
def downloads_day(version, start_time = nil, end_time = Time.now)
|
20
|
+
start_time = start_time || versions_built_at[version]
|
20
21
|
total_so_far = 0
|
21
|
-
# start day 0 as first download day.
|
22
22
|
found_first_download = false
|
23
|
-
ret = downloads_metadata(version).map do |day,downloads_that_day|
|
23
|
+
ret = downloads_metadata(version, start_time, end_time).map do |day,downloads_that_day|
|
24
24
|
if found_first_download
|
25
25
|
total_so_far += downloads_that_day
|
26
26
|
[day, total_so_far]
|
27
27
|
else
|
28
28
|
if !downloads_that_day.zero?
|
29
29
|
found_first_download = true
|
30
|
+
total_so_far += downloads_that_day
|
30
31
|
nil
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end.compact
|
34
35
|
end
|
35
36
|
|
36
|
-
private
|
37
|
-
|
38
37
|
def versions_metadata
|
39
38
|
# cache api call.
|
40
39
|
@versions_metadata ||= Gems.versions(@name)
|
40
|
+
# it should be a hash
|
41
|
+
if @versions_metadata.is_a?(String)
|
42
|
+
if @versions_metadata.match(/This rubygem could not be found/)
|
43
|
+
raise(NoSuchGem, "This rubygem could not be found")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
@versions_metadata
|
41
47
|
end
|
42
48
|
|
43
|
-
|
49
|
+
private
|
50
|
+
|
51
|
+
def downloads_metadata(version, start_time, end_time)
|
44
52
|
# cache api call.
|
45
53
|
@downloads_metadata ||= {}
|
46
54
|
return @downloads_metadata[version] if @downloads_metadata[version]
|
47
|
-
@downloads_metadata[version] ||= Gems.downloads(@name, version).to_a
|
55
|
+
@downloads_metadata[version] ||= Gems.downloads(@name, version, start_time, end_time).to_a
|
48
56
|
end
|
49
57
|
|
50
58
|
|
@@ -7,8 +7,6 @@ end
|
|
7
7
|
|
8
8
|
class GruffBuilder
|
9
9
|
|
10
|
-
class NoData < StandardError; end
|
11
|
-
|
12
10
|
MIN_VALUE = 0
|
13
11
|
MAX_VALUE = 300
|
14
12
|
|
@@ -16,9 +14,9 @@ class GruffBuilder
|
|
16
14
|
attr_accessor :title, :labels, :line_datas, :min_value, :max_value
|
17
15
|
|
18
16
|
def initialize(root, relative_path, versions, gem_name, gruff_options = {})
|
19
|
-
@root = root || raise("you must set a root. default is root/public/images")
|
17
|
+
@root = root || raise(ArgumentError,"you must set a root. default is root/public/images")
|
20
18
|
@relative_path = relative_path || "public/images/"
|
21
|
-
@versions = versions.is_a?(Array) ? versions : raise("versions must be an array")
|
19
|
+
@versions = versions.is_a?(Array) ? versions : raise(ArgumentError,"versions must be an array")
|
22
20
|
@gem_name = gem_name
|
23
21
|
@title = gruff_options[:title] || ""
|
24
22
|
@labels = gruff_options[:labels] || {}
|
@@ -15,11 +15,13 @@ class Velocitator
|
|
15
15
|
|
16
16
|
def initialize(gem_name, versions)
|
17
17
|
@gem_name = gem_name || raise(ArgumentError, 'need a name')
|
18
|
-
@versions = if versions.is_a?(String)
|
18
|
+
@versions = if versions.is_a?(String)
|
19
19
|
[versions]
|
20
20
|
else
|
21
21
|
versions
|
22
22
|
end || raise(ArgumentError, 'required versions')
|
23
|
+
validate_correct_gem
|
24
|
+
validate_correct_versions
|
23
25
|
end
|
24
26
|
|
25
27
|
def date_range=(args)
|
@@ -30,6 +32,19 @@ class Velocitator
|
|
30
32
|
@date_range = args.map{|t| time_format_str(t) }
|
31
33
|
end
|
32
34
|
|
35
|
+
def effective_date_range
|
36
|
+
# we allow overwriting by passing a date range.
|
37
|
+
if @date_range.is_a?(Array) && @date_range.compact.size==2
|
38
|
+
@date_range
|
39
|
+
else
|
40
|
+
default_date_range
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def title
|
45
|
+
"#{gem_name}-#{versions.join("-")}"
|
46
|
+
end
|
47
|
+
|
33
48
|
def line_datas
|
34
49
|
versions.map do |v|
|
35
50
|
specific_days_in_range.map do |day_in_range|
|
@@ -43,23 +58,13 @@ class Velocitator
|
|
43
58
|
end
|
44
59
|
end
|
45
60
|
|
46
|
-
|
47
|
-
# we allow overwriting by passing a date range.
|
48
|
-
if @date_range.is_a?(Array) && @date_range.compact.size==2
|
49
|
-
@date_range
|
50
|
-
else
|
51
|
-
default_date_range
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
# call, after you set all the attributes you want.
|
61
|
+
# after you set all the attributes you want.
|
56
62
|
# you can set (or there will be fallback defaults)
|
57
|
-
#
|
58
63
|
# max, min
|
59
64
|
# date_range (leave nil for default values in either start or end)
|
60
65
|
def gruff_builder
|
61
66
|
opts = {
|
62
|
-
:title =>
|
67
|
+
:title => title,
|
63
68
|
# just the first and last dates. give a small offset so it fits into the pciture.
|
64
69
|
# line_datas.first.size -2 should be the max of any one of the line-datas, all should be same size.
|
65
70
|
:labels => ({1 => time_format_str_small(effective_start_time), (line_datas.first.size-2) => time_format_str_small(effective_end_time) }),
|
@@ -134,4 +139,16 @@ class Velocitator
|
|
134
139
|
def gem_data
|
135
140
|
@gem_data ||= GemData.new(@gem_name)
|
136
141
|
end
|
142
|
+
|
143
|
+
def validate_correct_versions
|
144
|
+
versions.each do |v|
|
145
|
+
gem_data.versions.include?(v) || raise(NoSuchVersion,"version not found for #{versions}.")
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def validate_correct_gem
|
150
|
+
# this will bomb out if bad version is passed.
|
151
|
+
gem_data.versions_metadata
|
152
|
+
end
|
153
|
+
|
137
154
|
end
|
data/lib/gem_velocity/version.rb
CHANGED
data/lib/gem_velocity.rb
CHANGED
data/spec/gem_data_spec.rb
CHANGED
@@ -1,27 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GemData do
|
4
|
-
before do
|
5
|
-
Timecop.travel(Time.local(2013, 10, 7, 0, 0, 0))
|
6
|
-
Timecop.freeze
|
7
|
-
end
|
8
|
-
|
9
4
|
it "collects version info for a given gem" do
|
10
|
-
|
11
|
-
GemData.new("haml-i18n-extractor").versions.should include "0.0.17"
|
12
|
-
end
|
5
|
+
GemData.new("haml-i18n-extractor").versions.should include "0.0.17"
|
13
6
|
end
|
14
7
|
|
15
8
|
it "maps built_at and versions for access" do
|
16
|
-
|
17
|
-
GemData.new("haml-i18n-extractor").versions_built_at["0.0.17"].should == "2013-06-16T00:00:00Z"
|
18
|
-
end
|
9
|
+
GemData.new("haml-i18n-extractor").versions_built_at["0.0.17"].should == "2013-06-16T00:00:00Z"
|
19
10
|
end
|
20
11
|
|
21
12
|
it "can show download information" do
|
22
|
-
|
23
|
-
|
24
|
-
end
|
13
|
+
result = GemData.new("haml-i18n-extractor").downloads_day("0.0.17")
|
14
|
+
result.should == [["2013-06-17", 54], ["2013-06-18", 57], ["2013-06-19", 58], ["2013-06-20", 62], ["2013-06-21", 63], ["2013-06-22", 68], ["2013-06-23", 70], ["2013-06-24", 73], ["2013-06-25", 82], ["2013-06-26", 243], ["2013-06-27", 246], ["2013-06-28", 248], ["2013-06-29", 248], ["2013-06-30", 248], ["2013-07-01", 248], ["2013-07-02", 255], ["2013-07-03", 258], ["2013-07-04", 260], ["2013-07-05", 260], ["2013-07-06", 263], ["2013-07-07", 263], ["2013-07-08", 265], ["2013-07-09", 266], ["2013-07-10", 268], ["2013-07-11", 271], ["2013-07-12", 273], ["2013-07-13", 274], ["2013-07-14", 274], ["2013-07-15", 276], ["2013-07-16", 278], ["2013-07-17", 284], ["2013-07-18", 284], ["2013-07-19", 287], ["2013-07-20", 288], ["2013-07-21", 288], ["2013-07-22", 290], ["2013-07-23", 291], ["2013-07-24", 297], ["2013-07-25", 297], ["2013-07-26", 297], ["2013-07-27", 297], ["2013-07-28", 297], ["2013-07-29", 298], ["2013-07-30", 300], ["2013-07-31", 302], ["2013-08-01", 302], ["2013-08-02", 302], ["2013-08-03", 302], ["2013-08-04", 302], ["2013-08-05", 304], ["2013-08-06", 304], ["2013-08-07", 304], ["2013-08-08", 307], ["2013-08-09", 307], ["2013-08-10", 307], ["2013-08-11", 307], ["2013-08-12", 308], ["2013-08-13", 310], ["2013-08-14", 311], ["2013-08-15", 313], ["2013-08-16", 313], ["2013-08-17", 314], ["2013-08-18", 314], ["2013-08-19", 314], ["2013-08-20", 314], ["2013-08-21", 315], ["2013-08-22", 317], ["2013-08-23", 321], ["2013-08-24", 321], ["2013-08-25", 322], ["2013-08-26", 322], ["2013-08-27", 324], ["2013-08-28", 324], ["2013-08-29", 326], ["2013-08-30", 326], ["2013-08-31", 326], ["2013-09-01", 328], ["2013-09-02", 330], ["2013-09-03", 331], ["2013-09-04", 331], ["2013-09-05", 333], ["2013-09-06", 335], ["2013-09-07", 335], ["2013-09-08", 335], ["2013-09-09", 336], ["2013-09-10", 336], ["2013-09-11", 336], ["2013-09-12", 341], ["2013-09-13", 341], ["2013-09-14", 341], ["2013-09-15", 341], ["2013-09-16", 342], ["2013-09-17", 342], ["2013-09-18", 342], ["2013-09-19", 343], ["2013-09-20", 344]]
|
25
15
|
end
|
26
16
|
|
27
17
|
|
data/spec/no_time_cop_spec.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'with no time stubbing' do
|
3
|
+
describe 'with no time stubbing', :do_not_use_time_cop do
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
# hax slow internet connections make this slow.
|
6
|
+
if ENV['VELOCITATOR_REAL_LONG']
|
7
|
+
it "has a shortcut graph method #1" do
|
7
8
|
velocitator = Velocitator.new("rails", ["4.0.0","3.2.14","2.3.5"])
|
8
9
|
file = velocitator.graph("/tmp")
|
9
10
|
File.exist?(file).should be_true
|
10
11
|
end
|
11
|
-
end
|
12
12
|
|
13
|
-
|
14
|
-
VCR.use_cassette('velocitator-rails-multiple-graph-shortcut-4') do
|
13
|
+
it "has a shortcut graph method #2" do
|
15
14
|
velocitator = Velocitator.new("rails", ["4.0.0","3.2.14","0.9.1"])
|
16
15
|
file = velocitator.graph("/tmp", [3.months.ago, Time.now])
|
17
16
|
File.exist?(file).should be_true
|
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'gem_velocity'
|
2
2
|
require 'pry'
|
3
3
|
require 'vcr'
|
4
|
+
require 'sourcify'
|
4
5
|
require 'active_support/all' # time
|
5
6
|
require 'timecop'
|
6
7
|
|
7
8
|
VCR.configure do |c|
|
8
9
|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
9
10
|
c.hook_into :webmock # or :fakeweb
|
11
|
+
c.default_cassette_options = { :record => :new_episodes }
|
10
12
|
end
|
11
13
|
|
12
14
|
module SpecHelper
|
@@ -16,6 +18,27 @@ module SpecHelper
|
|
16
18
|
end
|
17
19
|
|
18
20
|
RSpec.configure do |c|
|
21
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
22
|
+
c.around(:each) do |example|
|
23
|
+
#freeze time unless explicitly said not to!
|
24
|
+
unless example.metadata[:do_not_use_time_cop]
|
25
|
+
Timecop.travel(Time.local(2013, 9, 20, 10, 0, 0))
|
26
|
+
Timecop.freeze
|
27
|
+
end
|
28
|
+
example.run
|
29
|
+
unless example.metadata[:do_not_use_time_cop]
|
30
|
+
Timecop.return
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
c.around(:each) do |example|
|
35
|
+
example_hashified = example.metadata[:description_args].first.unpack("s").first
|
36
|
+
puts "\nRunning example: #{example.metadata[:description_args]}\n"
|
37
|
+
VCR.use_cassette("rspec-example-#{(example_hashified)}") do
|
38
|
+
example.run
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
19
42
|
c.after(:suite) do
|
20
43
|
FileUtils.rm_rf(SpecHelper.tmpdir)
|
21
44
|
end
|
data/spec/velocitator_spec.rb
CHANGED
@@ -2,91 +2,78 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Velocitator do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
# Also, the 10 mins flattens out to 00: but we don't care at this point as it's day by day.
|
8
|
-
Timecop.travel(Time.local(2013, 9, 20, 10, 0, 0))
|
9
|
-
Timecop.freeze
|
5
|
+
it 'raises if you dont pass name and version(s)' do
|
6
|
+
lambda { Velocitator.new(nil,nil) }.should raise_error ArgumentError
|
10
7
|
end
|
11
8
|
|
12
|
-
|
13
|
-
|
9
|
+
it 'raises if the gem is not found' do
|
10
|
+
lambda { Velocitator.new("NOSICHGEMPlZ123","0.1") }.should raise_error NoSuchGem
|
14
11
|
end
|
15
12
|
|
16
|
-
it 'raises if
|
17
|
-
|
13
|
+
it 'raises if the version is not found' do
|
14
|
+
# cause the .pre matters!!1
|
15
|
+
lambda { Velocitator.new("haml-i18n-extractor","100.999.42.666.pre") }.should raise_error NoSuchVersion
|
18
16
|
end
|
19
17
|
|
20
|
-
|
18
|
+
describe "a specific version" do
|
19
|
+
|
21
20
|
it "sets a specific date range according to the gem's info" do
|
22
|
-
|
23
|
-
|
24
|
-
velocitator.effective_date_range.should eq ["2013-06-16T00:00:00Z", "2013-09-20T00:00:00Z"]
|
25
|
-
end
|
21
|
+
velocitator = Velocitator.new("haml-i18n-extractor", "0.0.17")
|
22
|
+
velocitator.effective_date_range.should eq ["2013-06-16T00:00:00Z", "2013-09-20T00:00:00Z"]
|
26
23
|
end
|
27
24
|
|
28
25
|
it "can override the default time ranges if its in the range" do
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
velocitator.line_datas.size.should eq (velocitator.versions.size)
|
34
|
-
end
|
26
|
+
velocitator = Velocitator.new("haml-i18n-extractor", "0.0.17")
|
27
|
+
velocitator.date_range = [1.day.ago, Time.now]
|
28
|
+
velocitator.effective_date_range.should eq ["2013-09-19T00:00:00Z", "2013-09-20T00:00:00Z"]
|
29
|
+
velocitator.line_datas.size.should eq (velocitator.versions.size)
|
35
30
|
end
|
36
31
|
|
37
32
|
it "can set a max and min" do
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
}.should_not raise_error
|
44
|
-
end
|
33
|
+
velocitator = Velocitator.new("haml-i18n-extractor", "0.0.17")
|
34
|
+
lambda {
|
35
|
+
velocitator.max_value = 500
|
36
|
+
velocitator.min_value = 10
|
37
|
+
}.should_not raise_error
|
45
38
|
end
|
46
39
|
|
47
40
|
it "can render a graph" do
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
41
|
+
velocitator = Velocitator.new("haml-i18n-extractor", "0.0.17")
|
42
|
+
velocitator.date_range = [1.day.ago, Time.now]
|
43
|
+
velocitator.root = SpecHelper.tmpdir
|
44
|
+
builder = velocitator.gruff_builder
|
45
|
+
|
46
|
+
# FIXME
|
47
|
+
# also, pending on issue relating to
|
48
|
+
# https://github.com/shaiguitar/rubygems.org/compare/api_not_returning_all_results_over_90_days?expand=1
|
49
|
+
builder.line_datas.should == [[343, 344]]
|
50
|
+
builder.title.should == "haml-i18n-extractor-0.0.17"
|
51
|
+
builder.labels.should == ({1=>"2013-09-19", (builder.line_datas.first.size-2) =>"2013-09-20"})
|
52
|
+
builder.max_value.should == 344
|
53
|
+
builder.min_value.should == 0
|
54
|
+
|
55
|
+
file = builder.write
|
56
|
+
File.exist?(file).should be_true
|
57
|
+
#`open #{file} -a preview.app`
|
58
|
+
#Kernel.sleep(10)
|
66
59
|
end
|
67
60
|
|
68
61
|
it "has a shortcut graph method #1" do
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
File.exist?(file).should be_true
|
73
|
-
end
|
62
|
+
velocitator = Velocitator.new("haml-i18n-extractor", "0.0.17")
|
63
|
+
file = velocitator.graph(SpecHelper.tmpdir,[1.day.ago, Time.now])
|
64
|
+
File.exist?(file).should be_true
|
74
65
|
end
|
75
66
|
|
76
67
|
it "has a shortcut graph method #2" do
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
File.exist?(file).should be_true
|
81
|
-
end
|
68
|
+
velocitator = Velocitator.new("haml-i18n-extractor", "0.0.17")
|
69
|
+
file = velocitator.graph
|
70
|
+
File.exist?(file).should be_true
|
82
71
|
end
|
83
72
|
|
84
73
|
it "has a shortcut graph metho #3" do
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
File.exist?(file).should be_true
|
89
|
-
end
|
74
|
+
velocitator = Velocitator.new("haml-i18n-extractor", "0.0.17")
|
75
|
+
file = velocitator.graph(nil,nil,0,1000)
|
76
|
+
File.exist?(file).should be_true
|
90
77
|
end
|
91
78
|
|
92
79
|
end
|
@@ -94,62 +81,41 @@ describe Velocitator do
|
|
94
81
|
describe "Multiple versions" do
|
95
82
|
before do
|
96
83
|
@some_versions = ["0.0.17", "0.0.5","0.0.10"]
|
97
|
-
Timecop.travel(Time.local(2013, 9, 20, 10, 0, 0))
|
98
|
-
Timecop.freeze
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
|
-
after do
|
103
|
-
Timecop.return
|
104
84
|
end
|
105
85
|
|
106
|
-
|
107
86
|
it "can initialize multiple versions" do
|
108
|
-
|
109
|
-
|
110
|
-
velocitator.versions.should == @some_versions
|
111
|
-
end
|
87
|
+
velocitator = Velocitator.new("haml-i18n-extractor", @some_versions)
|
88
|
+
velocitator.versions.should == @some_versions
|
112
89
|
end
|
113
90
|
|
114
91
|
it "sets the earliest start range from to all of the versions info" do
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
velocitator.effective_date_range.should eq ["2013-03-22T00:00:00Z", "2013-09-20T00:00:00Z"]
|
120
|
-
end
|
92
|
+
# some_versions.map{|v| GemData.new("haml-i18n-extractor").versions_built_at[v]}
|
93
|
+
# => ["2013-06-16T00:00:00Z", "2013-03-22T00:00:00Z", "2013-05-06T00:00:00Z"]
|
94
|
+
velocitator = Velocitator.new("haml-i18n-extractor", @some_versions)
|
95
|
+
velocitator.effective_date_range.should eq ["2013-03-22T00:00:00Z", "2013-09-20T00:00:00Z"]
|
121
96
|
end
|
122
97
|
|
123
98
|
it "sets the max value to the max of all of versions" do
|
124
|
-
|
125
|
-
|
126
|
-
velocitator.default_max_value.should eq 95
|
127
|
-
end
|
99
|
+
velocitator = Velocitator.new("haml-i18n-extractor", @some_versions)
|
100
|
+
velocitator.default_max_value.should eq 344
|
128
101
|
end
|
129
102
|
|
130
103
|
it "sets the max value to the max of all of versions" do
|
131
|
-
|
132
|
-
|
133
|
-
velocitator.default_max_value.should eq 95
|
134
|
-
end
|
104
|
+
velocitator = Velocitator.new("haml-i18n-extractor", @some_versions)
|
105
|
+
velocitator.default_max_value.should eq 344
|
135
106
|
end
|
136
107
|
|
137
108
|
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
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
velocitator.line_datas.map{|d| d.size }.uniq.size.should == 1
|
143
|
-
end
|
109
|
+
velocitator = Velocitator.new("haml-i18n-extractor", @some_versions)
|
110
|
+
velocitator.line_datas.size.should == @some_versions.size
|
111
|
+
# all of them should be the same size, padded with 0's if there is no download info
|
112
|
+
velocitator.line_datas.map{|d| d.size }.uniq.size.should == 1
|
144
113
|
end
|
145
114
|
|
146
115
|
it "has a shortcut graph method" do
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
puts file.inspect
|
151
|
-
File.exist?(file).should be_true
|
152
|
-
end
|
116
|
+
velocitator = Velocitator.new("haml-i18n-extractor", @some_versions)
|
117
|
+
file = velocitator.graph
|
118
|
+
File.exist?(file).should be_true
|
153
119
|
end
|
154
120
|
end
|
155
121
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem_velocity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Shai Rosenfeld
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-10-
|
18
|
+
date: 2013-10-11 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: gruff
|
@@ -159,6 +159,34 @@ dependencies:
|
|
159
159
|
version: "0"
|
160
160
|
type: :development
|
161
161
|
version_requirements: *id010
|
162
|
+
- !ruby/object:Gem::Dependency
|
163
|
+
name: sourcify
|
164
|
+
prerelease: false
|
165
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
166
|
+
none: false
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
hash: 3
|
171
|
+
segments:
|
172
|
+
- 0
|
173
|
+
version: "0"
|
174
|
+
type: :development
|
175
|
+
version_requirements: *id011
|
176
|
+
- !ruby/object:Gem::Dependency
|
177
|
+
name: ParseTree
|
178
|
+
prerelease: false
|
179
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
180
|
+
none: false
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
hash: 3
|
185
|
+
segments:
|
186
|
+
- 0
|
187
|
+
version: "0"
|
188
|
+
type: :development
|
189
|
+
version_requirements: *id012
|
162
190
|
description: generate gem velocity images
|
163
191
|
email:
|
164
192
|
- srosenfeld@engineyard.com
|
@@ -179,6 +207,7 @@ files:
|
|
179
207
|
- examples/rails-4.0.0-3.2.14-2.3.5.png
|
180
208
|
- gem_velocity.gemspec
|
181
209
|
- lib/gem_velocity.rb
|
210
|
+
- lib/gem_velocity/errors.rb
|
182
211
|
- lib/gem_velocity/gem_data.rb
|
183
212
|
- lib/gem_velocity/gruff_builder.rb
|
184
213
|
- lib/gem_velocity/helpers.rb
|