apprise 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ = Apprise!
2
+
3
+ Apprise looks at your Ruby on Rails application and tried to figure out all
4
+ the dependencies of the project and which ones are outdated.
5
+
6
+ Apprise currently looks for three types of dependencies.
7
+
8
+ - Gems specified in the Gemfile
9
+ - Git checkouts of plugins in vendor/plugins
10
+ - Subversion checkout of plugins in vendor/plugins
11
+
12
+ == Using Apprise as a Rails plugin
13
+
14
+ $ ./script/plugin install git://github.com/Fingertips/apprise.git
15
+ $ rake deps:outdated
16
+
17
+ == Using Apprise as a gem
18
+
19
+ $ gem install apprise --source http://gemcutter.org
20
+ $ apprise /path/to/rails
21
+
22
+ == Requirements
23
+
24
+ Apprise currently needs a patched version of Bundler, this version is
25
+ available on the Fingertips GitHub repository:
26
+
27
+ http://github.com/Fingertips/bundler
28
+
29
+ You can install it in the following way:
30
+
31
+ $ git clone git://github.com/Fingertips/bundler.git
32
+ $ cd bundler
33
+ $ sudo rake install
34
+
35
+ If you don't use Bundler, you don't have to install it. Apprise will
36
+ work without it as well.
data/TODO ADDED
@@ -0,0 +1,2 @@
1
+ - Add an `update' task.
2
+ - Use executioner to shell out instead of using backticks.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.9.9
@@ -0,0 +1,51 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{apprise}
8
+ s.version = "0.9.9"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Manfred Stienstra", "Eloy Duran"]
12
+ s.date = %q{2009-10-31}
13
+ s.default_executable = %q{apprise}
14
+ s.description = %q{Apprise gives an overview of the dependencies of a Rails application.}
15
+ s.email = ["manfred@fngtps.com", "eloy@fngtps.com"]
16
+ s.executables = ["apprise"]
17
+ s.extra_rdoc_files = [
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ "README.rdoc",
22
+ "TODO",
23
+ "VERSION",
24
+ "apprise.gemspec",
25
+ "bin/apprise",
26
+ "design/requirements.txt",
27
+ "lib/apprise.rb",
28
+ "lib/apprise/bundler.rb",
29
+ "lib/apprise/plugin.rb",
30
+ "lib/apprise/plugin/base.rb",
31
+ "lib/apprise/plugin/git.rb",
32
+ "lib/apprise/plugin/svn.rb",
33
+ "lib/tasks/apprise.rake",
34
+ "rails/init.rb"
35
+ ]
36
+ s.homepage = %q{http://github.com/Fingertips/apprise}
37
+ s.rdoc_options = ["--charset=UTF-8"]
38
+ s.require_paths = ["lib"]
39
+ s.rubygems_version = %q{1.3.5}
40
+ s.summary = %q{Apprise gives an overview of the dependencies of a Rails application.}
41
+
42
+ if s.respond_to? :specification_version then
43
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
+ else
48
+ end
49
+ else
50
+ end
51
+ end
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift File.expand_path('../../lib', __FILE__)
4
+ require 'apprise'
5
+
6
+ action = :outdated
7
+ ARGV.clone.options do |options|
8
+ options.banner = "Usage: apprise [options]"
9
+
10
+ options.on("-o", "--outdated", "Show outdated dependencies (default)") { action = :outdated }
11
+ options.on("-a", "--all", "Show all dependencies") { action = :dependencies }
12
+
13
+ options.on("-h", "--help", "Show this help message.") { puts options; exit }
14
+
15
+ options.parse!(ARGV)
16
+ end
17
+
18
+ Apprise.rails_root = Pathname.new(ARGV[0] || Dir.pwd)
19
+ Apprise.send("display_#{action}")
@@ -0,0 +1,28 @@
1
+ Requirements Apprise
2
+
3
+ - Manfred Stienstra, manfred@fngtps.com, Fingertips, http://www.fngtps.com
4
+ - Eloy Durán, eloy@fngtps.com, Fingertips, http://www.fngtps.com
5
+
6
+ Apprise is a Ruby on Rails plugin to keep dependencies of an application up to date.
7
+
8
+ USER STORIES
9
+
10
+ Dependencies
11
+
12
+ As a developer I would like to see all outdated dependencies so that I know when I'm not up to date. - #1 must done
13
+ As a developer I would like to see all dependencies so that I can inspect them. - #2 could todo
14
+ As a developer I would like to update all outdated dependencies so that I'm up to date again. - #3 could todo
15
+
16
+ ROLES
17
+
18
+ Developer: Anyone working on the development of an application.
19
+
20
+ THEMES
21
+
22
+ Dependencies: Stories related to dependencies.
23
+ Non-functional: Stories related to non-functional requirements.
24
+ Other: Stories that don’t fit anywhere else.
25
+
26
+ DEFINITIONS
27
+
28
+ NOTES
@@ -0,0 +1,66 @@
1
+ require 'apprise/plugin'
2
+ require 'apprise/bundler'
3
+
4
+ module Apprise
5
+ class << self
6
+ attr_accessor :rails_root
7
+ end
8
+
9
+ def self.dependencies
10
+ aggregate :dependencies
11
+ end
12
+
13
+ def self.outdated
14
+ aggregate :outdated
15
+ end
16
+
17
+ def self.display_dependencies
18
+ dependencies = self.dependencies
19
+ if dependencies.empty?
20
+ puts "There are no dependencies."
21
+ else
22
+ puts "All dependencies"
23
+ dependencies.each do |name, source_type|
24
+ puts " * #{name} (#{humanize_source_type(source_type)})"
25
+ end
26
+ end
27
+ end
28
+
29
+ def self.display_outdated
30
+ outdated = self.outdated
31
+ if outdated.empty?
32
+ puts "There are no outdated dependencies."
33
+ else
34
+ puts "Outdated dependencies"
35
+ outdated.each do |name, source_type|
36
+ puts " * #{name} (#{humanize_source_type(source_type)})"
37
+ end
38
+ end
39
+ end
40
+
41
+ private
42
+
43
+ def self.discover_root
44
+ Object.const_defined?(:Rails) ? Rails.root : Pathname.new(Dir.pwd)
45
+ end
46
+
47
+ self.rails_root = discover_root
48
+
49
+ def self.aggregate(type)
50
+ list = []
51
+ list.concat Apprise::Bundler.send(type) if Apprise::Bundler.usable?
52
+ list.concat Apprise::Plugin.send(type)
53
+ list.sort_by { |name, _| name }
54
+ end
55
+
56
+ def self.humanize_source_type(source_type)
57
+ case source_type
58
+ when 'svn'
59
+ 'Subversion external'
60
+ when 'git'
61
+ 'Git submodule'
62
+ else
63
+ 'Gem'
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,38 @@
1
+ module Apprise
2
+ class Bundler
3
+ begin
4
+ require 'rubygems' rescue nil
5
+ require 'bundler'
6
+
7
+ def self.gemfile_path
8
+ Apprise.rails_root + 'Gemfile'
9
+ end
10
+
11
+ def self.dependencies
12
+ gem_dependencies.map { |gem| [gem.name, 'gem'] }
13
+ end
14
+
15
+ def self.outdated
16
+ repository.outdated_gems.map do |name|
17
+ [name, 'gem']
18
+ end
19
+ end
20
+
21
+ def self.repository
22
+ environment.send(:repository)
23
+ end
24
+
25
+ def self.gem_dependencies
26
+ environment.send(:gem_dependencies)
27
+ end
28
+
29
+ def self.environment
30
+ @environment ||= ::Bundler::Environment.load(gemfile_path)
31
+ end
32
+
33
+ def self.usable?; true; end
34
+ rescue LoadError
35
+ def self.usable?; false; end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,38 @@
1
+ require 'pathname'
2
+
3
+ module Apprise
4
+ module Plugin
5
+ def self.plugin_root
6
+ Apprise.rails_root + 'vendor/plugins'
7
+ end
8
+
9
+ def self.scms
10
+ @scms ||= []
11
+ end
12
+
13
+ def self.all
14
+ Pathname.glob(plugin_root + '*').map do |child|
15
+ if child.directory? && scm = scms.find { |s| s.repo?(child) }
16
+ scm.new(child)
17
+ end
18
+ end.compact
19
+ end
20
+
21
+ def self.dependencies
22
+ names_and_types all
23
+ end
24
+
25
+ def self.outdated
26
+ names_and_types all.reject { |p| p.up_to_date? }
27
+ end
28
+
29
+ private
30
+
31
+ def self.names_and_types(array)
32
+ array.map { |p| [p.name, p.class.scm] }
33
+ end
34
+ end
35
+ end
36
+
37
+ require 'apprise/plugin/git'
38
+ require 'apprise/plugin/svn'
@@ -0,0 +1,51 @@
1
+ module Apprise
2
+ module Plugin
3
+ class Base
4
+ class NotImplementedError < StandardError; end
5
+
6
+ def self.inherited(klass)
7
+ Apprise::Plugin.scms << klass
8
+ end
9
+
10
+ def self.scm
11
+ name.split('::').last.downcase
12
+ end
13
+
14
+ def self.repo?(directory)
15
+ raise NotImplementedError, "The class `#{self.class.name}' does not implement ::repo?"
16
+ end
17
+
18
+ def self.executable(name)
19
+ define_method name do |args|
20
+ out = ''
21
+ Dir.chdir(@pathname) { out = `#{name} #{args}` }
22
+ out.strip
23
+ end
24
+ end
25
+
26
+ def initialize(pathname)
27
+ @pathname = pathname
28
+ end
29
+
30
+ def name
31
+ @pathname.basename.to_s
32
+ end
33
+
34
+ def current_revision
35
+ raise NotImplementedError, "The class `#{self.class.name}' does not implement #current_revision."
36
+ end
37
+
38
+ def latest_revision
39
+ raise NotImplementedError, "The class `#{self.class.name}' does not implement #latest_revision."
40
+ end
41
+
42
+ def up_to_date?
43
+ current_revision == latest_revision
44
+ end
45
+
46
+ def update!
47
+ raise NotImplementedError, "The class `#{self.class.name}' does not implement #update!."
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,44 @@
1
+ require 'apprise/plugin/base'
2
+
3
+ module Apprise
4
+ module Plugin
5
+ class Git < Base
6
+ def self.repo?(directory)
7
+ (directory + '.git').exist?
8
+ end
9
+
10
+ executable :git
11
+
12
+ def current_branch
13
+ git('branch -a').match(/^\* (.+)$/)[1]
14
+ end
15
+
16
+ def current_remote
17
+ git 'remote'
18
+ end
19
+
20
+ def latest_revision
21
+ fetch!
22
+ revision "#{current_remote}/#{current_branch}"
23
+ end
24
+
25
+ def current_revision
26
+ revision
27
+ end
28
+
29
+ def update!
30
+ git "pull #{current_remote} #{current_branch} 2>&1"
31
+ end
32
+
33
+ private
34
+
35
+ def fetch!
36
+ git "fetch #{current_remote} #{current_branch} 2>&1"
37
+ end
38
+
39
+ def revision(refspec = nil)
40
+ git "log -n 1 --pretty=format:%H #{refspec}"
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,35 @@
1
+ require 'apprise/plugin/base'
2
+
3
+ module Apprise
4
+ module Plugin
5
+ class SVN < Base
6
+ def self.repo?(directory)
7
+ (directory + '.svn').exist?
8
+ end
9
+
10
+ executable :svn
11
+
12
+ def url
13
+ @url ||= svn('info').match(/^URL: (.+)$/)[1]
14
+ end
15
+
16
+ def latest_revision
17
+ revision url
18
+ end
19
+
20
+ def current_revision
21
+ revision
22
+ end
23
+
24
+ def update!
25
+ svn "up"
26
+ end
27
+
28
+ private
29
+
30
+ def revision(url = nil)
31
+ svn("log -l 1 #{url}").match(/^r(\d+)\s\|/)[1].to_i
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,14 @@
1
+ $:.unshift(File.expand_path('../../', __FILE__))
2
+ require 'apprise'
3
+
4
+ namespace :deps do
5
+ desc "Print all dependencies"
6
+ task :all do
7
+ Apprise.display_dependencies
8
+ end
9
+
10
+ desc "Print all outdated dependencies"
11
+ task :outdated do
12
+ Apprise.display_outdated
13
+ end
14
+ end
@@ -0,0 +1 @@
1
+ require 'apprise'
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: apprise
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.9
5
+ platform: ruby
6
+ authors:
7
+ - Manfred Stienstra
8
+ - Eloy Duran
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-10-31 00:00:00 +01:00
14
+ default_executable: apprise
15
+ dependencies: []
16
+
17
+ description: Apprise gives an overview of the dependencies of a Rails application.
18
+ email:
19
+ - manfred@fngtps.com
20
+ - eloy@fngtps.com
21
+ executables:
22
+ - apprise
23
+ extensions: []
24
+
25
+ extra_rdoc_files:
26
+ - README.rdoc
27
+ files:
28
+ - README.rdoc
29
+ - TODO
30
+ - VERSION
31
+ - apprise.gemspec
32
+ - bin/apprise
33
+ - design/requirements.txt
34
+ - lib/apprise.rb
35
+ - lib/apprise/bundler.rb
36
+ - lib/apprise/plugin.rb
37
+ - lib/apprise/plugin/base.rb
38
+ - lib/apprise/plugin/git.rb
39
+ - lib/apprise/plugin/svn.rb
40
+ - lib/tasks/apprise.rake
41
+ - rails/init.rb
42
+ has_rdoc: true
43
+ homepage: http://github.com/Fingertips/apprise
44
+ licenses: []
45
+
46
+ post_install_message:
47
+ rdoc_options:
48
+ - --charset=UTF-8
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ version:
63
+ requirements: []
64
+
65
+ rubyforge_project:
66
+ rubygems_version: 1.3.5
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Apprise gives an overview of the dependencies of a Rails application.
70
+ test_files: []
71
+