aeon 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in aeon.gemspec
4
+ gemspec
@@ -0,0 +1,26 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ aeon (0.0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.1.2)
10
+ rake (0.8.7)
11
+ rspec (2.5.0)
12
+ rspec-core (~> 2.5.0)
13
+ rspec-expectations (~> 2.5.0)
14
+ rspec-mocks (~> 2.5.0)
15
+ rspec-core (2.5.2)
16
+ rspec-expectations (2.5.0)
17
+ diff-lcs (~> 1.1.2)
18
+ rspec-mocks (2.5.0)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ aeon!
25
+ rake
26
+ rspec
data/README ADDED
@@ -0,0 +1,19 @@
1
+ Aeon
2
+ ===========================================================
3
+ An analytics tool measuring how old a projects dependencies
4
+ are.
5
+
6
+
7
+ Example
8
+ -----------------------------------------------------------
9
+
10
+ require 'aeon'
11
+
12
+ p Aeon.score
13
+
14
+ TODO
15
+ -----------------------------------------------------------
16
+ * Spec it out a little bit
17
+ * Build a rake task which can break when score exceeds
18
+ threshhold
19
+
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc 'Runs specs'
6
+ RSpec::Core::RakeTask.new do |t|
7
+ end
8
+
9
+ task :default => :spec
10
+
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "aeon/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "aeon"
7
+ s.version = Aeon::VERSION
8
+ s.authors = ["Andrew Kiellor"]
9
+ s.email = ["akiellor@gmail.com"]
10
+ s.homepage = ""
11
+
12
+ s.summary = %q{Aeon scores the age of your bundles dependencies.}
13
+ s.description = %q{Aeon is an analysis tool to score the age of your bundles dependencies.}
14
+ s.rubyforge_project = "aeon"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+ s.add_development_dependency('rspec')
21
+ s.add_development_dependency('rake')
22
+ end
@@ -0,0 +1,51 @@
1
+ require "aeon/version"
2
+
3
+ module Aeon
4
+ def self.score
5
+ Dependency.outdated.map(&:score).inject(0) {|sum, score| sum + score}
6
+ end
7
+
8
+ class Version
9
+ attr_reader :segments
10
+
11
+ def initialize version
12
+ @segments = version.split('.')
13
+ end
14
+
15
+ def - other
16
+ @segments.zip(other.segments).map do |dot_pair|
17
+ r = dot_pair[0].to_i - dot_pair[1].to_i
18
+ r < 0 ? 0 : r
19
+ end
20
+ end
21
+ end
22
+
23
+ class Dependency
24
+ attr_reader :name
25
+
26
+ def initialize name, local_version, remote_version
27
+ @name = name
28
+ @local_version = local_version
29
+ @remote_version = remote_version
30
+ end
31
+
32
+ def score
33
+ dot_pair_delta = @remote_version - @local_version
34
+
35
+ (0..(dot_pair_delta.size - 1)).to_a.inject(0) do |result, dot_offset|
36
+ result + ((10.rpower dot_offset) * dot_pair_delta[(dot_pair_delta.size - 1) - dot_offset])
37
+ end
38
+ end
39
+
40
+ def self.outdated
41
+ `gem outdated`.split("\n").map do |dep_line|
42
+ if m = dep_line.match(/^([^\s]+) \(([^\s]+) < ([^\)]+)\)$/)
43
+ name, local_version, remote_version = m.captures
44
+ Dependency.new name, Version.new(local_version), Version.new(remote_version)
45
+ else
46
+ raise "Failed to parse line: #{depline}"
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,3 @@
1
+ module Aeon
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aeon
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Andrew Kiellor
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-06-01 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rake
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :development
47
+ version_requirements: *id002
48
+ description: Aeon is an analysis tool to score the age of your bundles dependencies.
49
+ email:
50
+ - akiellor@gmail.com
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files: []
56
+
57
+ files:
58
+ - Gemfile
59
+ - Gemfile.lock
60
+ - README
61
+ - Rakefile
62
+ - aeon.gemspec
63
+ - lib/aeon.rb
64
+ - lib/aeon/version.rb
65
+ homepage: ""
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options: []
70
+
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ requirements: []
92
+
93
+ rubyforge_project: aeon
94
+ rubygems_version: 1.8.5
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: Aeon scores the age of your bundles dependencies.
98
+ test_files: []
99
+