rapt 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/MIT-LICENSE +21 -0
- data/README +4 -0
- data/Rakefile +74 -0
- data/bin/rapt +6 -0
- data/lib/commands/plugin.rb +65 -0
- data/lib/commands/plugin/commands.rb +486 -0
- data/lib/commands/plugin/plugin.rb +148 -0
- data/lib/commands/plugin/rails_environment.rb +87 -0
- data/lib/commands/plugin/recursive_http_fetcher.rb +65 -0
- data/lib/commands/plugin/repositories.rb +128 -0
- data/lib/commands/plugin/repository.rb +34 -0
- data/test/commands/plugin/plugin_test.rb +58 -0
- data/test/commands/plugin/repository_test.rb +20 -0
- data/test/commands/plugin_test.rb +75 -0
- data/test/mocks/rails_environment.rb +5 -0
- data/test/sandbox/rails_app/config/boot.rb +44 -0
- data/test/sandbox/rails_app/config/environment.rb +0 -0
- data/test/sandbox/rails_app/script/plugin +3 -0
- metadata +75 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
$testing = true
|
4
|
+
require File.dirname(__FILE__) + "/../../../lib/commands/plugin"
|
5
|
+
require File.dirname(__FILE__) + "/../../mocks/rails_environment"
|
6
|
+
|
7
|
+
# TODO Mock the remote repository so we don't have to hit an actual server for the plugins.
|
8
|
+
class Commands::Plugin::PluginTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@name = 'exception_notification'
|
12
|
+
@uri = "http://dev.rubyonrails.org/svn/rails/plugins/#{@name}"
|
13
|
+
@plugin = Plugin.new @uri, @name
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_name_and_uri
|
17
|
+
assert_equal @name, @plugin.name
|
18
|
+
assert_equal @uri, @plugin.uri
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_to_s
|
22
|
+
assert_equal 'exception_notification http://dev.rubyonrails.org/svn/rails/plugins/exception_notification', @plugin.to_s
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_find
|
26
|
+
assert_equal @name, Plugin.find(@name).name
|
27
|
+
assert_equal @name, Plugin.find(@uri).name, "Given a URI, a new plugin should be made and the name should be auto-discovered"
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_svn_url_eh
|
31
|
+
assert Plugin.new("svn://topfunky.net/svn/plugins/ar_fixtures").svn_url?, "A URL starting with svn: should be recognized as a Subversion URL"
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_installed_eh
|
35
|
+
assert !@plugin.installed?
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_install
|
39
|
+
@plugin.install :http
|
40
|
+
assert @plugin.installed?
|
41
|
+
|
42
|
+
@plugin.uninstall
|
43
|
+
assert !@plugin.installed?
|
44
|
+
ensure
|
45
|
+
FileUtils.rm_rf RailsEnvironment.default.root + "/vendor/plugins/#{@name}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_about
|
49
|
+
assert_match %r!#{@uri}!, @plugin.about['plugin']
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_about_should_return_uri_if_nonexistent
|
53
|
+
fake_uri = 'http://topfunky.net/svn/plugins/nonexistent'
|
54
|
+
p = Plugin.new(fake_uri)
|
55
|
+
assert_equal fake_uri, p.about['plugin']
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
$testing = true
|
4
|
+
require File.dirname(__FILE__) + "/../../../lib/commands/plugin"
|
5
|
+
require File.dirname(__FILE__) + "/../../mocks/rails_environment"
|
6
|
+
|
7
|
+
# TODO Mock the remote repository so we don't have to hit an actual server for the plugins.
|
8
|
+
class Commands::Plugin::RepositoryTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@name = 'meta_tags'
|
12
|
+
@uri = 'http://topfunky.net/svn/plugins'
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_plugins
|
16
|
+
r = Repository.new @uri
|
17
|
+
assert r.plugins.map {|p| p.name }.include?(@name), "#{@name} should have been in the plugin list."
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'fileutils'
|
4
|
+
$testing = true
|
5
|
+
require File.dirname(__FILE__) + "/../../lib/commands/plugin"
|
6
|
+
require File.dirname(__FILE__) + "/../mocks/rails_environment"
|
7
|
+
|
8
|
+
# TODO Mock the remote repository so we don't have to hit an actual server for the plugins.
|
9
|
+
class Commands::PluginTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def setup
|
12
|
+
@plugin_name = 'meta_tags'
|
13
|
+
@remote_source = 'http://topfunky.net/svn/plugins'
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_list
|
17
|
+
output = run_command('list', "--source=#{@remote_source}")
|
18
|
+
%w(topfunky_power_tools ar_fixtures meta_tags gruff sparklines).each do |plugin|
|
19
|
+
assert_match %r!#{plugin}!, output.to_yaml
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_sources
|
24
|
+
output = run_command('sources')
|
25
|
+
assert_match %r!http://dev.rubyonrails.com/svn/rails/plugins!, output.to_yaml
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_about
|
29
|
+
run_command('source', @remote_source)
|
30
|
+
|
31
|
+
assert_nothing_raised {
|
32
|
+
run_command('about', @plugin_name)
|
33
|
+
run_command('about', 'exception_notification')
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_install
|
38
|
+
run_command('install', File.join(@remote_source, @plugin_name))
|
39
|
+
assert File.exists?(path_to_plugin(@plugin_name) + "/lib"),
|
40
|
+
"Plugin should have been installed at #{path_to_plugin(@plugin_name)}"
|
41
|
+
|
42
|
+
output = run_command('list', "--local")
|
43
|
+
assert_match %r!#{@plugin_name}!, output.to_yaml
|
44
|
+
|
45
|
+
run_command('remove', @plugin_name)
|
46
|
+
deny File.exists?(path_to_plugin(@plugin_name) + "/lib"),
|
47
|
+
"Plugin should have been removed at #{path_to_plugin(@plugin_name)}"
|
48
|
+
ensure
|
49
|
+
FileUtils.rm_rf path_to_plugin(@plugin_name)
|
50
|
+
end
|
51
|
+
|
52
|
+
# TODO Takes too long...find a way to speed it up
|
53
|
+
# def test_sources
|
54
|
+
# assert_nothing_raised {
|
55
|
+
# run_command('sources', '--refresh')
|
56
|
+
# }
|
57
|
+
# end
|
58
|
+
|
59
|
+
protected
|
60
|
+
|
61
|
+
def deny(condition, message=nil)
|
62
|
+
assert !condition, message
|
63
|
+
end
|
64
|
+
|
65
|
+
def run_command(*args)
|
66
|
+
Commands::Plugin.parse! args
|
67
|
+
end
|
68
|
+
|
69
|
+
# Returns the full path to a locally installed plugin
|
70
|
+
def path_to_plugin(name)
|
71
|
+
RailsEnvironment.default.root + "/vendor/plugins/#{name}"
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
|
2
|
+
|
3
|
+
unless defined?(RAILS_ROOT)
|
4
|
+
root_path = File.join(File.dirname(__FILE__), '..')
|
5
|
+
|
6
|
+
unless RUBY_PLATFORM =~ /mswin32/
|
7
|
+
require 'pathname'
|
8
|
+
root_path = Pathname.new(root_path).cleanpath(true).to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
RAILS_ROOT = root_path
|
12
|
+
end
|
13
|
+
|
14
|
+
unless defined?(Rails::Initializer)
|
15
|
+
if File.directory?("#{RAILS_ROOT}/vendor/rails")
|
16
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
17
|
+
else
|
18
|
+
require 'rubygems'
|
19
|
+
|
20
|
+
environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
|
21
|
+
environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
|
22
|
+
rails_gem_version = $1
|
23
|
+
|
24
|
+
if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
|
25
|
+
rails_gem = Gem.cache.search('rails', "=#{version}").first
|
26
|
+
|
27
|
+
if rails_gem
|
28
|
+
require_gem "rails", "=#{version}"
|
29
|
+
require rails_gem.full_gem_path + '/lib/initializer'
|
30
|
+
else
|
31
|
+
STDERR.puts %(Cannot find gem for Rails =#{version}:
|
32
|
+
Install the missing gem with 'gem install -v=#{version} rails', or
|
33
|
+
change environment.rb to define RAILS_GEM_VERSION with your desired version.
|
34
|
+
)
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
else
|
38
|
+
require_gem "rails"
|
39
|
+
require 'initializer'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
Rails::Initializer.run(:set_load_path)
|
44
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.11
|
3
|
+
specification_version: 1
|
4
|
+
name: rapt
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2006-07-06 00:00:00 -07:00
|
8
|
+
summary: Rails plugin manager.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: boss@topfunky.com
|
12
|
+
homepage: http://nubyonrails.com/pages/rapt
|
13
|
+
rubyforge_project: rapt
|
14
|
+
description: Install, remove, and discover new plugins for your Ruby on Rails app.
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: false
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
authors:
|
29
|
+
- Ryan Tomayko
|
30
|
+
- Geoffrey Grosenbach
|
31
|
+
files:
|
32
|
+
- Rakefile
|
33
|
+
- README
|
34
|
+
- CHANGELOG
|
35
|
+
- MIT-LICENSE
|
36
|
+
- bin/rapt
|
37
|
+
- lib/commands
|
38
|
+
- lib/commands/plugin
|
39
|
+
- lib/commands/plugin.rb
|
40
|
+
- lib/commands/plugin/commands.rb
|
41
|
+
- lib/commands/plugin/plugin.rb
|
42
|
+
- lib/commands/plugin/rails_environment.rb
|
43
|
+
- lib/commands/plugin/recursive_http_fetcher.rb
|
44
|
+
- lib/commands/plugin/repositories.rb
|
45
|
+
- lib/commands/plugin/repository.rb
|
46
|
+
- test/commands
|
47
|
+
- test/mocks
|
48
|
+
- test/sandbox
|
49
|
+
- test/commands/plugin
|
50
|
+
- test/commands/plugin_test.rb
|
51
|
+
- test/commands/plugin/plugin_test.rb
|
52
|
+
- test/commands/plugin/repository_test.rb
|
53
|
+
- test/mocks/rails_environment.rb
|
54
|
+
- test/sandbox/rails_app
|
55
|
+
- test/sandbox/rails_app/config
|
56
|
+
- test/sandbox/rails_app/script
|
57
|
+
- test/sandbox/rails_app/vendor
|
58
|
+
- test/sandbox/rails_app/config/boot.rb
|
59
|
+
- test/sandbox/rails_app/config/environment.rb
|
60
|
+
- test/sandbox/rails_app/script/plugin
|
61
|
+
- test/sandbox/rails_app/vendor/plugins
|
62
|
+
test_files: []
|
63
|
+
|
64
|
+
rdoc_options: []
|
65
|
+
|
66
|
+
extra_rdoc_files: []
|
67
|
+
|
68
|
+
executables:
|
69
|
+
- rapt
|
70
|
+
extensions: []
|
71
|
+
|
72
|
+
requirements:
|
73
|
+
- none
|
74
|
+
dependencies: []
|
75
|
+
|