gem_velocity 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,26 +1,30 @@
1
1
  # GemVelocity
2
2
 
3
- A way to see gem velocity. Right now it's just aggregated totals.
3
+ A way to see gem velocity. There are three ways you can view graphs.
4
4
 
5
- So, not a number of downloads each day, but rather just the general timeline of total downloads.
5
+ `AggregatedVelocitator`
6
+
7
+ `SingleVelocitator`
8
+
9
+ `MultipleVelocitator`
10
+
11
+ Some examples are noted below.
6
12
 
7
13
  ## Note
8
14
 
9
- The data is currently somewhat incorrect, due to inconstancies outlined in:
15
+ There may be some inconstancies. These are outlined in:
10
16
 
11
17
  [https://gist.github.com/shaiguitar/d2af997b7f58e24fd305](https://gist.github.com/shaiguitar/d2af997b7f58e24fd305)
12
18
 
13
- 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.
19
+ 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.
14
20
 
15
21
  ## Requirements
16
22
 
17
- It draws graphs. So...you'll need imagemagick/rmagick. I'm sure you'll survive. Any problems with installation let me know and I'll try to help out.
23
+ It draws graphs. So...you'll need imagemagick/rmagick. Any problems with installation let me know and I'll try to help out.
18
24
 
19
- # Example
20
-
21
- Here's one: [celluloid](https://gist.github.com/shaiguitar/7e6d95971c5254fa3665)
25
+ There are plans to put it on the web somewhere, so if you wait long enough you may not even need to install it.
22
26
 
23
- Here's some more:
27
+ # Example
24
28
 
25
29
  <pre>
26
30
  velocitator = MultipleVelocitator.new("rails", ["4.0.0","3.2.14","2.3.5"])
@@ -42,14 +46,37 @@ Produces:
42
46
 
43
47
  ![here](examples/rails-4.0.0-3.2.14-0.9.1.png)
44
48
 
49
+ <pre>
50
+ velocitator = AggregatedVelocitator.new("rails", "4")
51
+ # matches any version /^4.\d/ etc
52
+ file = velocitator.graph("/tmp")
53
+ </pre>
54
+
55
+ Produces:
56
+
57
+ ![here](examples/rails-4.0.1.rc1-4.0.0-4.0.0.rc2-4.0.0.rc1-4.0.0.beta1.png)
58
+
59
+ Another: [celluloid](https://gist.github.com/shaiguitar/7e6d95971c5254fa3665)
60
+
61
+ You could do the same with a `SingleVelocitator` as well:
62
+
63
+ <pre>
64
+ velocitator = SingleVelocitator.new("rails", "4.0.0")
65
+ file = velocitator.graph("/tmp")
66
+ </pre>
67
+
68
+ That image is left as an excerise to the reader. Actually it's late. But try it and see.
69
+
45
70
  Also, you should be able to pass in max,min values which completes you being able to manipulate the boundries of the graph in question.
46
71
 
47
72
  ## Web UI
48
73
 
49
74
  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? I could do it, but I need to know it's worth the hassle.
50
75
 
76
+ Also, if you have any idea of how you'd like to use it, please leave a comment on the [issue](https://github.com/shaiguitar/gem_velocities/issues/3)
77
+
51
78
  Lemme know.
52
79
 
53
80
  ## Feedback
54
81
 
55
- Is appreciated! Any (other) ideas?
82
+ Is appreciated! Also, contributions! Any (other) ideas?
data/TODO CHANGED
@@ -12,3 +12,5 @@ in default_line_datas.
12
12
  if rubygems 606 isn't solved, why not just put a total on there and let the inconsistnecies just be with some notice?
13
13
 
14
14
  rename time_format_str_small alias
15
+
16
+ swap out gruff_builder to some other composing object of a builder, that can mash up the various velocitators?
@@ -38,11 +38,7 @@ class AggregatedVelocitator < BaseVelocitator
38
38
  end
39
39
 
40
40
  def title
41
- "#{@gem_name}: #{@top_level_ver}X"
42
- end
43
-
44
- def totals
45
- super.map {|x| x[:version_downloads]}.sum
41
+ "#{@gem_name}: #{@top_level_ver}X\n(downloads: #{num_downloads})"
46
42
  end
47
43
 
48
44
  end
@@ -41,6 +41,11 @@ class BaseVelocitator
41
41
  end
42
42
  end
43
43
 
44
+ def num_downloads
45
+ sum = totals.map {|t| t[:version_downloads]}.sum
46
+ ActiveSupport::NumberHelper.number_to_delimited(sum)
47
+ end
48
+
44
49
  private
45
50
 
46
51
  def initialize(gem_name, versions)
@@ -18,7 +18,7 @@ class MultipleVelocitator < BaseVelocitator
18
18
  :labels => ({1 => time_format_str_small(effective_start_time), (line_datas.first.size-2) => time_format_str_small(effective_end_time) }),
19
19
  :max_value => effective_max_value,
20
20
  :min_value => effective_min_value,
21
- :line_datas => line_datas
21
+ :line_datas => line_datas,
22
22
  }
23
23
  end
24
24
 
@@ -36,11 +36,7 @@ class SingleVelocitator < BaseVelocitator
36
36
  end
37
37
 
38
38
  def title
39
- "#{gem_name}-#{version}"
40
- end
41
-
42
- def totals
43
- super.first
39
+ "#{gem_name}-#{version}\n(downloads: #{num_downloads})"
44
40
  end
45
41
 
46
42
  end
@@ -1,3 +1,3 @@
1
1
  module GemVelocity
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -25,11 +25,11 @@ describe 'with no time stubbing', :do_not_use_time_cop do
25
25
  # x = Gems.downloads(velocitator.gem_name, velocitator.versions.first, velocitator.effective_date_range.first, velocitator.effective_date_range.last)
26
26
  # x.to_a.index{|z| z.last.nonzero?}
27
27
  # => 1198
28
- velocitator = SingleVelocitator.new("rails", "2.3.5")
29
28
  #x.to_a.index{|z| z.last.nonzero?}
29
+ # FIXME . got local dump of database
30
30
  #binding.pry
31
+ velocitator = SingleVelocitator.new("rails", "2.3.5")
31
32
  file = velocitator.graph("/tmp")
32
- raise 'wtf'
33
33
  end
34
34
 
35
35
  it "has a shortcut graph method #2" do
@@ -15,7 +15,7 @@ describe "a Velocitator rendering graphs" do
15
15
  # should this be the specific date range values?? aggregated since when? not aggregated?
16
16
  velocitator.graph_options[:line_datas].should == [[303, 303, 303, 304, 304]]
17
17
 
18
- velocitator.graph_options[:title].should == "haml-i18n-extractor-0.0.17"
18
+ velocitator.graph_options[:title].should == "haml-i18n-extractor-0.0.17\n(downloads: 377)"
19
19
  velocitator.graph_options[:labels].should == ({1=>"2013-09-13", (velocitator.line_datas.first.size-2) =>"2013-09-17"})
20
20
  velocitator.graph_options[:max_value].should == 306 # the max in the range (time.now)
21
21
  velocitator.graph_options[:min_value].should == 0
@@ -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.should == {:total_downloads=>5355, :version_downloads=>377}
63
+ velocitator.totals.first[:version_downloads].should eq 377
64
64
  #binding.pry
65
65
  end
66
66
 
@@ -103,7 +103,7 @@ describe MultipleVelocitator do
103
103
 
104
104
  it "holds the totals of the gem" do
105
105
  velocitator = MultipleVelocitator.new("haml-i18n-extractor", ["0.0.17"])
106
- velocitator.totals.should eq [{:total_downloads=>5355, :version_downloads=>377}]
106
+ velocitator.totals.first[:version_downloads].should eq 377
107
107
  end
108
108
 
109
109
  it "sets the earliest start range from to all of the versions info" do
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: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
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-19 00:00:00 Z
18
+ date: 2013-10-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: gruff
@@ -205,6 +205,7 @@ files:
205
205
  - TODO
206
206
  - examples/rails-4.0.0-3.2.14-0.9.1.png
207
207
  - examples/rails-4.0.0-3.2.14-2.3.5.png
208
+ - examples/rails-4.0.1.rc1-4.0.0-4.0.0.rc2-4.0.0.rc1-4.0.0.beta1.png
208
209
  - gem_velocity.gemspec
209
210
  - lib/gem_velocity.rb
210
211
  - lib/gem_velocity/errors.rb