plugems_deploy 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ rel_0_2_0:
2
+ date: 2007-05-04
3
+ notes:
4
+ - update action
5
+ - install action
6
+
7
+ rel_0_1_0:
8
+ date: 2007-05-03
9
+ notes:
10
+ - Initial Drop
11
+ - build action
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007 Revolution Health Group LLC. All rights reserved.
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.
data/README CHANGED
@@ -1,5 +1,17 @@
1
+ = Introduction
2
+
1
3
  Provides capistrano recipes for managing plugems.
2
4
 
3
5
  The recipes can be overriden in standard capistrano files (i.e. ~/.caprc, config/deploy.rb, etc) or in a plugems_deploy_ext gem.
4
6
 
7
+ See http://revolutiononrails.blogspot.com/ for more details.
8
+
9
+
10
+ = License
11
+
12
+ Plugems released under the MIT license.
13
+
14
+
15
+ = Support
5
16
 
17
+ The plugin RubyForge page is http://rubyforge.org/projects/plugems
@@ -1,4 +1,4 @@
1
- :version: [0, 1, 0]
1
+ :version: [0, 2, 0]
2
2
  :name: "plugems_deploy"
3
3
  :description: "Plugems deployment scripts"
4
4
  :executables: [ 'plugem' ]
@@ -100,7 +100,7 @@ private
100
100
  def validate_arguments
101
101
 
102
102
  case
103
- when ['push', 'update'].include?(@options[:action]) && @options[:name].nil? then
103
+ when ['push', 'install'].include?(@options[:action]) && @options[:name].nil? then
104
104
  fail "You need to specify the name of the plugem to #{ @options[:action] }"
105
105
  end
106
106
 
@@ -109,6 +109,7 @@ private
109
109
  def process_aliases
110
110
  case @options[:action]
111
111
  when 'up' then @options[:action] = 'update'
112
+ when 'pack' then @options[:action] = 'build'
112
113
  end
113
114
  end
114
115
 
@@ -1,16 +1,15 @@
1
1
  require 'yaml'
2
- # require 'erb'
3
2
 
4
3
  def cfg_dir
5
4
  File.join(File.dirname(__FILE__), '../config')
6
5
  end
7
6
 
8
- # Should be defined in projects
9
- set :gem_servers, lambda { fail("No gem servers are defined. Set :gem_servers to an array of your gem servers") }
7
+ # Could be defined in projects
8
+ set :gem_servers, [ 'http://gems.rubyforge.org']
10
9
 
11
10
  def local_gem_servers
12
11
  gem_servers
13
12
  end
14
13
 
15
14
  # Force sudo usage for installing missing gems instead of running 'sudo plugem'
16
- set :force_sudo_for_plugem, false
15
+ set :force_sudo_for_gem_installs, false
@@ -0,0 +1,66 @@
1
+ require 'rubygems'
2
+ require 'plugems_deploy/gem_service'
3
+ require 'plugems_deploy/dependency_handler'
4
+ require 'plugems_deploy/manifest'
5
+ require 'rubygems/remote_installer'
6
+
7
+ module PlugemsDeployInstall
8
+
9
+ def validate_local_cache_permissions!
10
+ if ! (force_sudo_for_gem_installs || File.writable?(Gem.dir))
11
+ fail "You don't have write permissions to #{ Gem.dir }. Consider using sudo."
12
+ end
13
+ end
14
+
15
+ def local_gems
16
+ @local_gems ||= PlugemsDeploy::GemService.new
17
+ end
18
+
19
+ def not_installed?(gem)
20
+ local_gems.find_gem(gem[:name], gem[:version]).nil?
21
+ end
22
+
23
+ def remote_gems
24
+ PlugemsDeploy::DependencyHandler.new(remote_sources).dependencies(plugem_name, plugem_version, plugem_deps_only)
25
+ end
26
+
27
+ def remote_sources
28
+ PlugemsDeploy::GemService.new(local_gem_servers)
29
+ end
30
+
31
+ def install_gem(gem)
32
+ cmd = "#{sudo_if_needed(gem)}gem install #{gem[:name]} --version #{gem[:version]} --remote --ignore-dependencies --force --source #{gem[:download_source]}"
33
+ system cmd
34
+ rescue Exception => ex
35
+ fail "Error: installing gem #{gem[:name]} -- '#{ex}'\nTry running\n\n#{cmd}\n\n"
36
+ end
37
+
38
+ def sudo_if_needed(gem)
39
+ return "" unless force_sudo_for_gem_installs
40
+ case RUBY_PLATFORM
41
+ when /win32/i
42
+ "cmd /C"
43
+ when /cygwin/i
44
+ ""
45
+ else
46
+ "sudo "
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+ desc 'Installs gems to a local gem repository from remote gem servers'
53
+ task :plugem_install do
54
+
55
+ self.class.send(:include, PlugemsDeployInstall)
56
+
57
+ validate_local_cache_permissions!
58
+
59
+ remote_gems.each do |gem|
60
+ if not_installed?(gem)
61
+ puts "Installing [ #{ gem[:name] }, #{ gem[:version] } ]"
62
+ install_gem(gem)
63
+ end
64
+ end
65
+
66
+ end
@@ -0,0 +1,23 @@
1
+ require 'rubygems'
2
+ require 'plugems_deploy/dependency_handler'
3
+ require 'plugems_deploy/manifest'
4
+
5
+ desc 'Updates local gem repository from remote gem servers based on the content of manifest.yml'
6
+ task :plugem_update do
7
+
8
+ self.class.send(:include, PlugemsDeployInstall)
9
+
10
+ validate_local_cache_permissions!
11
+
12
+ manifest = PlugemsDeploy::Manifest.new
13
+
14
+ manifest.dependencies.each do |name, version|
15
+ puts "Updating #{ name } (#{ version })"
16
+ set :plugem_name, name
17
+ set :plugem_version, version
18
+ plugem_install
19
+ end
20
+
21
+ end
22
+
23
+
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: plugems_deploy
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2007-05-03 00:00:00 -04:00
6
+ version: 0.2.0
7
+ date: 2007-05-04 00:00:00 -04:00
8
8
  summary: Plugems deployment scripts
9
9
  require_paths:
10
10
  - lib
@@ -30,8 +30,10 @@ authors:
30
30
  -
31
31
  files:
32
32
  - bin
33
+ - CHANGELOG
33
34
  - config
34
35
  - lib
36
+ - MIT-LICENSE
35
37
  - README
36
38
  - recipes
37
39
  - bin/plugem
@@ -44,6 +46,8 @@ files:
44
46
  - lib/plugems_deploy/manifest.rb
45
47
  - recipes/build.rb
46
48
  - recipes/configuration.rb
49
+ - recipes/install.rb
50
+ - recipes/update.rb
47
51
  test_files: []
48
52
 
49
53
  rdoc_options: []