bleeding_edge 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.5.2"
12
+ gem "rcov", ">= 0"
13
+ end
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.5.2)
6
+ bundler (~> 1.0.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.8.7)
10
+ rcov (0.9.9)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.5.2)
19
+ rcov
20
+ shoulda
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Andy Marks
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ = bleeding_edge
2
+
3
+ The power of Ruby makes development fast. RubyGems makes packaging and using Ruby library trivial. However the combination of these two
4
+ technologies places far more emphasis on managing these fast-changing dependencies closely and good codebases can quickly take on considerable
5
+ technical debt if they stray too far from modern versions of their gems.
6
+
7
+ Bleeding Edge examines all the RubyGems-managed gems currently in scope (i.e., "gem list") and then produces a report showing how far each gem
8
+ is from it's most recent release.
9
+
10
+ With this information, you can where your risks are with respect to falling too far behind the current state of your dependent gems.
11
+
12
+ Bleeding Edge does not currently handle transitive dependencies between gems (e.g., Rails 2.3.x requires ActiveRecord 2.3.x), so it may show
13
+ gem versions that you cannot use because of these transitive dependencies.
14
+
15
+ == Contributing to bleeding_edge
16
+
17
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
18
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
19
+ * Fork the project
20
+ * Start a feature/bugfix branch
21
+ * Commit and push until you are happy with your contribution
22
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
23
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
24
+
25
+ == Copyright
26
+
27
+ Copyright (c) 2011 Andy Marks. See LICENSE.txt for
28
+ further details.
29
+
@@ -0,0 +1,53 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "bleeding_edge"
16
+ gem.homepage = "http://github.com/andeemarks/bleeding_edge"
17
+ gem.license = "MIT"
18
+ gem.summary = "Generates report showing how up-to-date your RubyGems gems are"
19
+ gem.description = "A gem that analyses your currently installed set of RubyGems and looks ahead to see how close to the 'bleeding edge' of each gem you are. Produces report to show how up-to-date your gems are."
20
+ gem.email = "andy@corvine.org"
21
+ gem.authors = ["Andy Marks"]
22
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
23
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rake/testtask'
30
+ Rake::TestTask.new(:test) do |test|
31
+ test.libs << 'lib' << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+
36
+ require 'rcov/rcovtask'
37
+ Rcov::RcovTask.new do |test|
38
+ test.libs << 'test'
39
+ test.pattern = 'test/**/test_*.rb'
40
+ test.verbose = true
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "bleeding_edge #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,24 @@
1
+ <html>
2
+ <head>
3
+ <style type='text/css'>
4
+ td.major {background: #C11B17}
5
+ td.minor {background: #D4A017}
6
+ td.build {background: #ffff00}
7
+ td {font-family: sans-serif}
8
+ </style>
9
+ </head>
10
+ <body>
11
+ <table border='1' cellspacing='0'>
12
+ <thead>
13
+ <tr><td>Gem</td><td>Current<br>Version</td><td>#<br>Future<br>versions</td></tr>
14
+ </thead>
15
+ <tbody>
16
+ <tr><td class='gem'>bundler</td><td class='current-version'>1.0.10</td><td class='versions-behind'>N/a</td></tr><tr><td class='gem'>git</td><td class='current-version'>1.2.5</td><td class='versions-behind'>N/a</td></tr><tr><td class='gem'>jeweler</td><td class='current-version'>1.5.2</td><td class='versions-behind'>N/a</td></tr><tr><td class='gem'>rake</td><td class='current-version'>0.8.7</td><td class='versions-behind'>N/a</td></tr> </tbody>
17
+ <tfoot>
18
+ <tr>
19
+ <td colspan="3">Report generated by bleeding-edge</td>
20
+ </tr>
21
+ </tfoot>
22
+ </table>
23
+ </body>
24
+ </html>
@@ -0,0 +1,53 @@
1
+ #!/opt/local/bin/ruby
2
+
3
+ require 'rubygems'
4
+ require 'installed_gem_future'
5
+
6
+ class BleedingEdge
7
+ def initialize
8
+ @installed_gems = Array.new
9
+ @fetcher = Gem::SpecFetcher.new
10
+ end
11
+
12
+ def find_futures_for_gems
13
+ puts "Looking for most recent versions of installed gems for platform #{Gem.platforms.to_a}..."
14
+ @installed_gems.each do |gem|
15
+ find_future_versions_for(gem)
16
+ end
17
+ end
18
+
19
+ def find_future_versions_for(gem)
20
+ version_filter = Gem::Requirement.create("> " + gem.installed_version)
21
+ dep = Gem::Dependency.new gem.name, version_filter
22
+ matching_specs = @fetcher.find_matching dep, true, true, false
23
+ matching_specs.each do |spec|
24
+ gem.add_future_version spec[0][1].version
25
+ end
26
+ puts "Found #{gem.count} versions for #{dep}"
27
+ end
28
+
29
+ def find_installed_gems
30
+ Gem.searcher.find_all("*").each do |gem|
31
+ @installed_gems << InstalledGemFuture.new(gem)
32
+ end
33
+
34
+ puts "Found #{@installed_gems.size.to_s} installed gems in scope"
35
+ end
36
+
37
+ def output_as_html
38
+ File.open("bleeding-edge-report.html", "w") do |f|
39
+ @installed_gems.sort! { |a,b| b.count <=> a.count}
40
+
41
+ f.write File.open("report-header.html", "r").readlines
42
+ @installed_gems.each do |future|
43
+ f.write future.to_html
44
+ end
45
+ f.write File.open("report-footer.html", "r").readlines
46
+ end
47
+ end
48
+ end
49
+
50
+ be = BleedingEdge.new
51
+ be.find_installed_gems
52
+ be.find_futures_for_gems
53
+ be.output_as_html
@@ -0,0 +1,61 @@
1
+
2
+ class InstalledGemFuture
3
+ attr_reader :gem, :installed_version, :name
4
+
5
+ def initialize(gem)
6
+ @gem = gem
7
+ @name = gem.name
8
+ @installed_version = gem.version.to_s
9
+ @futures = Array.new
10
+ end
11
+
12
+ def add_future_version(version)
13
+ @futures << version unless @futures.include? version
14
+ end
15
+
16
+ def count
17
+ @futures.size
18
+ end
19
+
20
+ def inspect
21
+ "#{@name} (#{@installed_version}): #{PP.pp(@futures, ' ')}"
22
+ end
23
+
24
+ def to_html
25
+ "<tr><td class='gem'>#{@name}</td><td class='current-version'>#{@installed_version}</td><td class='versions-behind'>#{versions_behind}</td>#{futures_to_html}</tr>"
26
+ end
27
+
28
+ private
29
+
30
+ def versions_behind
31
+ return count if count > 0
32
+
33
+ "N/a"
34
+ end
35
+
36
+ def futures_to_html
37
+ html = ""
38
+ previous_version = @installed_version
39
+ @futures.each do |future|
40
+ html << "<td class='#{version_change_label(previous_version, future)}'>#{future}</td>"
41
+ previous_version = future
42
+ end
43
+
44
+ html
45
+ end
46
+
47
+ def version_change_label(from_version, to_version)
48
+ from_components = from_version.split(".")
49
+ to_components = to_version.split(".")
50
+
51
+ begin
52
+ return "major" if (from_components[0].to_i < to_components[0].to_i)
53
+ return "minor" if (from_components[1].to_i < to_components[1].to_i)
54
+ return "build" if (from_components[2].to_i < to_components[2].to_i)
55
+ rescue NoMethodError
56
+ "unknown"
57
+ end
58
+
59
+ "trivial"
60
+ end
61
+ end
@@ -0,0 +1,9 @@
1
+ </tbody>
2
+ <tfoot>
3
+ <tr>
4
+ <td colspan="3">Report generated by bleeding-edge</td>
5
+ </tr>
6
+ </tfoot>
7
+ </table>
8
+ </body>
9
+ </html>
@@ -0,0 +1,15 @@
1
+ <html>
2
+ <head>
3
+ <style type='text/css'>
4
+ td.major {background: #C11B17}
5
+ td.minor {background: #D4A017}
6
+ td.build {background: #ffff00}
7
+ td {font-family: sans-serif}
8
+ </style>
9
+ </head>
10
+ <body>
11
+ <table border='1' cellspacing='0'>
12
+ <thead>
13
+ <tr><td>Gem</td><td>Current<br>Version</td><td>#<br>Future<br>versions</td></tr>
14
+ </thead>
15
+ <tbody>
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'bleeding_edge'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestBleedingEdge < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bleeding_edge
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Andy Marks
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-15 00:00:00 +11:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ type: :development
23
+ prerelease: false
24
+ name: shoulda
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ type: :development
37
+ prerelease: false
38
+ name: bundler
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 23
45
+ segments:
46
+ - 1
47
+ - 0
48
+ - 0
49
+ version: 1.0.0
50
+ requirement: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ type: :development
53
+ prerelease: false
54
+ name: jeweler
55
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 7
61
+ segments:
62
+ - 1
63
+ - 5
64
+ - 2
65
+ version: 1.5.2
66
+ requirement: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ type: :development
69
+ prerelease: false
70
+ name: rcov
71
+ version_requirements: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ requirement: *id004
81
+ description: A gem that analyses your currently installed set of RubyGems and looks ahead to see how close to the 'bleeding edge' of each gem you are. Produces report to show how up-to-date your gems are.
82
+ email: andy@corvine.org
83
+ executables: []
84
+
85
+ extensions: []
86
+
87
+ extra_rdoc_files:
88
+ - LICENSE.txt
89
+ - README.rdoc
90
+ files:
91
+ - .document
92
+ - Gemfile
93
+ - Gemfile.lock
94
+ - LICENSE.txt
95
+ - README.rdoc
96
+ - Rakefile
97
+ - VERSION
98
+ - lib/bleeding-edge-report.html
99
+ - lib/bleeding_edge.rb
100
+ - lib/installed_gem_future.rb
101
+ - lib/report-footer.html
102
+ - lib/report-header.html
103
+ - test/helper.rb
104
+ - test/test_bleeding_edge.rb
105
+ has_rdoc: true
106
+ homepage: http://github.com/andeemarks/bleeding_edge
107
+ licenses:
108
+ - MIT
109
+ post_install_message:
110
+ rdoc_options: []
111
+
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ hash: 3
120
+ segments:
121
+ - 0
122
+ version: "0"
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ hash: 3
129
+ segments:
130
+ - 0
131
+ version: "0"
132
+ requirements: []
133
+
134
+ rubyforge_project:
135
+ rubygems_version: 1.3.7
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: Generates report showing how up-to-date your RubyGems gems are
139
+ test_files:
140
+ - test/helper.rb
141
+ - test/test_bleeding_edge.rb