gem_velocity 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,17 +10,19 @@ This is a single line graph of a single version.
10
10
 
11
11
  This is a signle line graph that has an aggregated view of a major version (or bunch of single minor versions, etc).
12
12
 
13
- See specs and examples for more info.
13
+ See specs and [examples](examples/) for more info.
14
14
 
15
15
  There is also the `Multiplexer`, this is a wrapper around being able to draw multiple lines at once. You pass it any number of the above and it will graph multiple lines together in one graph.
16
16
 
17
17
  ## Note
18
18
 
19
- There may be some inconstancies due to bad data coming back from the api. These are outlined in:
19
+ There are inconstancies of some bad data coming back from the api.
20
20
 
21
- [https://gist.github.com/shaiguitar/d2af997b7f58e24fd305](https://gist.github.com/shaiguitar/d2af997b7f58e24fd305)
21
+ Sometimes this is due to older data, some historical data was deleted to accommodate for performance issues at the time.
22
22
 
23
- It seems it happens with older data. I'm investigating though with the help of the rubygems team as per [this](https://github.com/rubygems/rubygems.org/pull/606) and will hopefully have some progress soon.
23
+ [This](https://github.com/rubygems/rubygems.org/pull/606) [this](https://github.com/rubygems/rubygems.org/issues/616) and [this](https://gist.github.com/shaiguitar/d2af997b7f58e24fd305) have a bit more info if you want to dig in yourself.
24
+
25
+ There are some other smaller slight inconsistencies due to the [rubygems.org](https://github.com/rubygems/rubygems.org) counter implementation that I believe is being worked on as well.
24
26
 
25
27
  ## Requirements
26
28
 
@@ -38,14 +40,8 @@ This essentially completes you being able to manipulate the boundries of the gra
38
40
 
39
41
  ## Web UI
40
42
 
41
- Do you want to see this with ease (Hey, the api is easy. Whatever) on the web at `http://rubygems-velocity.org/gem/rails/4.0.0,3.2.14` or something similar?
42
-
43
- [Work](https://github.com/shaiguitar/gem_velocity_web) has been started to put it on a UI, but your feedback in necessary for it to be useful:
44
-
45
- So if you have any idea of how you'd like to use it, please put your thoughts on the [issue](https://github.com/shaiguitar/gem_velocities/issues/3)
46
-
47
- Lemme know.
43
+ Do you want to just see this on web at `http://rubygems-velocity.org/gem/rails/4.0.0,3.2.14` or something similar?
48
44
 
49
- ## Feedback
45
+ [Work](https://github.com/shaiguitar/gem_velocity_web) has been started to put it on a UI, but your feedback/contributions will be necessary for it to be useful.
50
46
 
51
- Is appreciated! Also, contributions! Any (other) ideas?
47
+ Feel free to put your thoughts on the [issue](https://github.com/shaiguitar/gem_velocities/issues/3) and or pull requests.
data/TODO CHANGED
@@ -16,3 +16,13 @@ consolidate velocitator fixtrues or at least repeatable generators in specs.
16
16
  cassandra says to have an option to have the multiplexer start them from the same data (to see curve/adoption rate). I see it.
17
17
 
18
18
  hardcode a time limit of earliest_time since historical data is not reliable.
19
+
20
+ speed the fuck out of it:
21
+
22
+ b = rails, 3.2.x
23
+ 1.9.3-p392 :009 > puts Time.now ; file = b.graph; puts Time.now; puts file.inspect
24
+ 2013-10-27 17:33:54 -0700
25
+ Wrote graph to /Users/shair/projects/gem_velocities2/gem_velocity_web/public/images/AggregatedVelocitator-rails-3.2.x.png
26
+ 2013-10-27 17:46:53 -0700
27
+
28
+ add total that is displayed on rubygems (vs total that it gets back and calculates per day).
@@ -14,10 +14,13 @@ class AggregatedVelocitator < BaseVelocitator
14
14
  @version = top_level_ver #with a wildcard/x
15
15
  @versions = @aggregated_versions = gem_data.versions.select{|v| v.match(/^#{Regexp.escape(remove_trailing_x(top_level_ver))}/) }
16
16
  super(gem_name, @aggregated_versions)
17
+
18
+ raise NoSuchVersion, "no versions found for #{@version}!" if @aggregated_versions.empty?
17
19
  end
18
20
 
19
21
  def default_start
20
- base_earliest_time_for(@aggregated_versions)
22
+ earliest_start = @aggregated_versions.map{|v| Date.parse(time_built(v)) }.compact.min
23
+ time_format_str(earliest_start)
21
24
  end
22
25
 
23
26
  def default_max_value
@@ -60,15 +60,18 @@ class BaseVelocitator
60
60
  @passed_min_value || default_min_value
61
61
  end
62
62
 
63
- def totals
63
+ def totals_map_by_version
64
+ h = {}
64
65
  versions.map do |v|
65
- gem_data.total_for_version(v)
66
+ total_for_version = gem_data.total_for_version(v)
67
+ h.merge!(v => total_for_version)
66
68
  end
69
+ h
67
70
  end
68
71
 
69
72
  def num_downloads
70
- sum = totals.map {|t| t[:version_downloads]}.sum
71
- ActiveSupport::NumberHelper.number_to_delimited(sum)
73
+ sum_of_all_versions = totals_map_by_version.values.map {|t| t[:version_downloads]}.sum
74
+ ActiveSupport::NumberHelper.number_to_delimited(sum_of_all_versions)
72
75
  end
73
76
 
74
77
  def time_built(version)
@@ -125,11 +128,6 @@ class BaseVelocitator
125
128
  [version]
126
129
  end
127
130
 
128
- def base_earliest_time_for(verzionz)
129
- earliest_start = verzionz.map{|v| Date.parse(time_built(v)) }.min
130
- default_start = time_format_str(earliest_start)
131
- end
132
-
133
131
  def base_max_for(verzionz)
134
132
  totals = []
135
133
  verzionz.each {|v|
@@ -1,3 +1,3 @@
1
1
  module GemVelocity
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -60,7 +60,7 @@ describe SingleVelocitator do
60
60
 
61
61
  it "holds the totals of the gem" do
62
62
  velocitator = SingleVelocitator.new("haml-i18n-extractor", "0.0.17")
63
- velocitator.totals.first[:version_downloads].should eq 377
63
+ velocitator.totals_map_by_version["0.0.17"][:version_downloads].should eq 377
64
64
  #binding.pry
65
65
  end
66
66
 
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: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 9
10
- version: 0.0.9
9
+ - 10
10
+ version: 0.0.10
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-27 00:00:00 Z
18
+ date: 2013-10-28 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: gruff