capsaicin 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -24,7 +24,7 @@ end
24
24
 
25
25
  require 'rake/testtask'
26
26
  Rake::TestTask.new(:test) do |test|
27
- test.libs << 'lib' << 'test'
27
+ test.libs << 'test'
28
28
  test.pattern = 'test/**/*_test.rb'
29
29
  test.verbose = true
30
30
  end
@@ -43,19 +43,6 @@ rescue LoadError
43
43
  end
44
44
 
45
45
  # --------- RDoc Documentation ---------
46
- desc "Generate RDoc documentation"
47
- Rake::RDocTask.new(:rdoc) do |rdoc|
48
- rdoc.options << '--line-numbers' << '--inline-source' <<
49
- '--main' << 'README.rdoc' <<
50
- '--title' << "Capsaicin" <<
51
- '--charset' << 'utf-8'
52
- rdoc.rdoc_dir = "doc"
53
- rdoc.rdoc_files.include 'README*'
54
- rdoc.rdoc_files.include('lib/**/*.rb')
55
- end
56
-
57
- task :default => :build
58
-
59
46
  Jeweler::GemcutterTasks.new
60
47
  Jeweler::RubyforgeTasks.new do |rubyforge|
61
48
  rubyforge.doc_task = "rdoc"
@@ -65,7 +52,7 @@ end
65
52
  task :default => :test
66
53
 
67
54
  require 'rake/rdoctask'
68
- Rake::RDocTask.new do |rdoc|
55
+ Rake::RDocTask.new(:rdoc) do |rdoc|
69
56
  if File.exist?('VERSION.yml')
70
57
  config = YAML.load(File.read('VERSION.yml'))
71
58
  version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
@@ -76,7 +63,7 @@ Rake::RDocTask.new do |rdoc|
76
63
  '--main' << 'README.rdoc' <<
77
64
  '--charset' << 'utf-8'
78
65
 
79
- rdoc.rdoc_dir = 'rdoc'
66
+ rdoc.rdoc_dir = 'doc'
80
67
  rdoc.title = "Capsaicin #{version}"
81
68
  rdoc.rdoc_files.include('README*')
82
69
  rdoc.rdoc_files.include('lib/**/*.rb')
@@ -1,5 +1,5 @@
1
- ---
2
- :patch: 8
3
- :build:
4
- :major: 0
5
- :minor: 1
1
+ ---
2
+ :major: 0
3
+ :minor: 1
4
+ :build:
5
+ :patch: 9
@@ -1,71 +1,71 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{capsaicin}
8
- s.version = "0.1.8"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Joe Khoobyar"]
12
- s.date = %q{2010-05-03}
13
- s.description = %q{Spicy capistrano extensions for various needs}
14
- s.email = %q{joe@ankhcraft.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".gitignore",
21
- "LICENSE",
22
- "README.rdoc",
23
- "Rakefile",
24
- "VERSION.yml",
25
- "capsaicin.gemspec",
26
- "lib/capistrano/recipes/deploy/strategy/local_copy.rb",
27
- "lib/capsaicin.rb",
28
- "lib/capsaicin/bundle.rb",
29
- "lib/capsaicin/files.rb",
30
- "lib/capsaicin/files/local.rb",
31
- "lib/capsaicin/files/remote.rb",
32
- "lib/capsaicin/invocation.rb",
33
- "lib/capsaicin/namespace.rb",
34
- "lib/capsaicin/service.rb",
35
- "lib/capsaicin/service/command.rb",
36
- "lib/capsaicin/service/crm.rb",
37
- "lib/capsaicin/service/lsb.rb",
38
- "lib/capsaicin/service/windows.rb",
39
- "lib/capsaicin/sys.rb",
40
- "lib/capsaicin/ui.rb",
41
- "test/helper.rb",
42
- "test/test_local_files.rb"
43
- ]
44
- s.homepage = %q{http://github.com/joekhoobyar/capsaicin}
45
- s.rdoc_options = ["--charset=UTF-8"]
46
- s.require_paths = ["lib"]
47
- s.rubyforge_project = %q{capsaicin}
48
- s.rubygems_version = %q{1.3.6}
49
- s.summary = %q{Joe Khoobyar's spicy capistrano extensions}
50
- s.test_files = [
51
- "test/helper.rb",
52
- "test/test_local_files.rb"
53
- ]
54
-
55
- if s.respond_to? :specification_version then
56
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
57
- s.specification_version = 3
58
-
59
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
60
- s.add_runtime_dependency(%q<capistrano>, [">= 2.0"])
61
- s.add_runtime_dependency(%q<archive-tar-minitar>, [">= 0.5"])
62
- else
63
- s.add_dependency(%q<capistrano>, [">= 2.0"])
64
- s.add_dependency(%q<archive-tar-minitar>, [">= 0.5"])
65
- end
66
- else
67
- s.add_dependency(%q<capistrano>, [">= 2.0"])
68
- s.add_dependency(%q<archive-tar-minitar>, [">= 0.5"])
69
- end
70
- end
71
-
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{capsaicin}
8
+ s.version = "0.1.9"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Joe Khoobyar"]
12
+ s.date = %q{2010-06-15}
13
+ s.description = %q{Spicy capistrano extensions for various needs}
14
+ s.email = %q{joe@ankhcraft.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION.yml",
25
+ "capsaicin.gemspec",
26
+ "lib/capistrano/recipes/deploy/strategy/local_copy.rb",
27
+ "lib/capsaicin.rb",
28
+ "lib/capsaicin/bundle.rb",
29
+ "lib/capsaicin/files.rb",
30
+ "lib/capsaicin/files/local.rb",
31
+ "lib/capsaicin/files/remote.rb",
32
+ "lib/capsaicin/invocation.rb",
33
+ "lib/capsaicin/namespace.rb",
34
+ "lib/capsaicin/service.rb",
35
+ "lib/capsaicin/service/command.rb",
36
+ "lib/capsaicin/service/crm.rb",
37
+ "lib/capsaicin/service/lsb.rb",
38
+ "lib/capsaicin/service/windows.rb",
39
+ "lib/capsaicin/sys.rb",
40
+ "lib/capsaicin/ui.rb",
41
+ "test/capsaicin/files/local_test.rb",
42
+ "test/helper.rb"
43
+ ]
44
+ s.homepage = %q{http://github.com/joekhoobyar/capsaicin}
45
+ s.rdoc_options = ["--charset=UTF-8"]
46
+ s.require_paths = ["lib"]
47
+ s.rubyforge_project = %q{capsaicin}
48
+ s.rubygems_version = %q{1.3.6}
49
+ s.summary = %q{Joe Khoobyar's spicy capistrano extensions}
50
+ s.test_files = [
51
+ "test/capsaicin/files/local_test.rb",
52
+ "test/helper.rb"
53
+ ]
54
+
55
+ if s.respond_to? :specification_version then
56
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
57
+ s.specification_version = 3
58
+
59
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
60
+ s.add_runtime_dependency(%q<capistrano>, [">= 2.0"])
61
+ s.add_runtime_dependency(%q<archive-tar-minitar>, [">= 0.5"])
62
+ else
63
+ s.add_dependency(%q<capistrano>, [">= 2.0"])
64
+ s.add_dependency(%q<archive-tar-minitar>, [">= 0.5"])
65
+ end
66
+ else
67
+ s.add_dependency(%q<capistrano>, [">= 2.0"])
68
+ s.add_dependency(%q<archive-tar-minitar>, [">= 0.5"])
69
+ end
70
+ end
71
+
@@ -1,12 +1,12 @@
1
1
  require 'capistrano/recipes/deploy/strategy/base'
2
2
  require 'tempfile'
3
3
 
4
- module Capistrano
5
- module Deploy
6
- module Strategy
7
- class LocalCopy < Base
4
+ module Capistrano # :nodoc:
5
+ module Deploy # :nodoc:
6
+ module Strategy # :nodoc:
7
+ class LocalCopy < Base # :nodoc:
8
8
 
9
- def deploy!
9
+ def deploy! # :nodoc:
10
10
  logger.debug "compressing local copy to #{filename}"
11
11
  local_files.tar_cz filename, '.', :verbose=>false do |item|
12
12
  if (item=item[2..-1]) and item.length > 0
@@ -28,36 +28,36 @@ module Capistrano
28
28
  FileUtils.rm_rf destination rescue nil
29
29
  end
30
30
 
31
- def check!
31
+ def check! # :nodoc:
32
32
  end
33
33
 
34
34
  private
35
35
 
36
- def local_copy_dir
36
+ def local_copy_dir # :nodoc:
37
37
  @local_copy_dir ||= configuration.fetch(:local_copy_dir, '.')
38
38
  end
39
39
 
40
- def copy_exclude
40
+ def copy_exclude # :nodoc:
41
41
  @copy_exclude ||= Array(configuration.fetch(:copy_exclude, %w(.*)))
42
42
  end
43
43
 
44
- def copy_prune
44
+ def copy_prune # :nodoc:
45
45
  @copy_prune ||= Array(configuration.fetch(:copy_exclude, %w(.svn .git)))
46
46
  end
47
47
 
48
- def copy_directory_only
48
+ def copy_directory_only # :nodoc:
49
49
  @copy_directory_only ||= Array(configuration.fetch(:copy_directory_only, %w(log tmp)))
50
50
  end
51
51
 
52
- def filename
52
+ def filename # :nodoc:
53
53
  @filename ||= File.join(Dir.tmpdir, "#{configuration.fetch(:application, 'local_copy')}.tgz")
54
54
  end
55
55
 
56
- def remote_dir
56
+ def remote_dir # :nodoc:
57
57
  @remote_dir ||= configuration[:copy_remote_dir] || "/tmp"
58
58
  end
59
59
 
60
- def remote_filename
60
+ def remote_filename # :nodoc:
61
61
  @remote_filename ||= File.join(remote_dir, File.basename(filename))
62
62
  end
63
63
  end
@@ -136,6 +136,10 @@ module Capsaicin
136
136
  require 'archive/tar/minitar' unless defined? Archive::Tar::Minitar
137
137
  Archive::Tar::Minitar
138
138
  end
139
+
140
+ def fu_output_message(msg)
141
+ logger.trace msg if logger
142
+ end
139
143
  end
140
144
  end
141
145
  end
File without changes
File without changes
@@ -0,0 +1,174 @@
1
+ require 'helper'
2
+ require 'tmpdir'
3
+ require 'capsaicin/files'
4
+ require 'capsaicin/files/local'
5
+
6
+ class Capsaicin::Files::LocalTest < Test::Unit::TestCase
7
+
8
+ def setup
9
+ @local = CapistranoMock.new
10
+ @local.extend Capsaicin::Files::Local
11
+ end
12
+
13
+ def teardown
14
+ @tmpdir and FileUtils.rm_rf(@tmpdir)
15
+ end
16
+
17
+ def test_exists
18
+ assert @local.exists?(__FILE__)
19
+ assert_equal "test -e #{__FILE__}", @local.logbuf.string.strip
20
+ end
21
+
22
+ def test_not_exists
23
+ assert ! @local.exists?(__FILE__+'/nope')
24
+ end
25
+
26
+ def test_readable
27
+ assert @local.readable?(__FILE__)
28
+ assert_equal "test -r #{__FILE__}", @local.logbuf.string.strip
29
+ end
30
+
31
+ def test_not_readable
32
+ assert ! @local.readable?(__FILE__+'/nope')
33
+ end
34
+
35
+ def test_writable
36
+ assert @local.writable?(Dir.tmpdir)
37
+ assert_equal "test -w #{Dir.tmpdir}", @local.logbuf.string.strip
38
+ end
39
+
40
+ def test_not_writable
41
+ assert ! @local.writable?(__FILE__+'/nope')
42
+ end
43
+
44
+ def test_file
45
+ assert @local.file?(__FILE__)
46
+ assert_equal "test -f #{__FILE__}", @local.logbuf.string.strip
47
+ end
48
+
49
+ def test_not_file
50
+ assert ! @local.file?(__FILE__+'/nope')
51
+ end
52
+
53
+ def test_directory
54
+ assert @local.directory?(File.dirname(__FILE__))
55
+ assert_equal "test -d #{File.dirname __FILE__}", @local.logbuf.string.strip
56
+ end
57
+
58
+ def test_not_directory
59
+ assert ! @local.directory?(__FILE__)
60
+ end
61
+
62
+ def test_mkdir
63
+ assert @local.mkdir(d = tmpdir('test-mkdir'))
64
+ assert File.directory?(d)
65
+ assert_equal "mkdir #{d}", @local.logbuf.string.strip
66
+ end
67
+
68
+ def test_mkdir_not_p
69
+ assert_raise Errno::ENOENT do
70
+ @local.mkdir(tmpdir('test-mkdir','p'))
71
+ end
72
+ assert ! File.directory?(d = tmpdir('test-mkdir','p'))
73
+ assert_equal "mkdir #{d}", @local.logbuf.string.strip
74
+ end
75
+
76
+ def test_mkdir_p
77
+ assert @local.mkdir_p(d = tmpdir('test-mkdir','p'))
78
+ assert File.directory?(d)
79
+ assert_equal "mkdir -p #{d}", @local.logbuf.string.strip
80
+ end
81
+
82
+ def test_mkdir_p_one
83
+ assert @local.mkdir_p(d = tmpdir('test-mkdir-p'))
84
+ assert File.directory?(d)
85
+ assert_equal "mkdir -p #{d}", @local.logbuf.string.strip
86
+ end
87
+
88
+ def test_rmdir
89
+ FileUtils.mkdir(d = tmpdir('test-rmdir'))
90
+ assert @local.rmdir(d)
91
+ assert ! File.directory?(d)
92
+ assert ! File.exists?(d)
93
+ assert_equal "rmdir #{d}", @local.logbuf.string.strip
94
+ end
95
+
96
+ def test_cp
97
+ assert_nil @local.cp(__FILE__, f = tmpdir('test-cp'))
98
+ assert_equal File.read(__FILE__), File.read(f)
99
+ assert_equal "cp #{__FILE__} #{f}", @local.logbuf.string.strip
100
+ end
101
+
102
+ def test_cp_r
103
+ assert_nil @local.cp_r(File.dirname(__FILE__), d = tmpdir('test-cp-r'))
104
+ assert_equal File.read(__FILE__), File.read(File.join(d,File.basename(__FILE__)))
105
+ assert_equal "cp -r #{File.dirname __FILE__} #{d}", @local.logbuf.string.strip
106
+ end
107
+
108
+ def test_rm
109
+ FileUtils.cp(__FILE__, f = tmpdir('test-cp'))
110
+ assert @local.rm(f)
111
+ assert ! File.exists?(f)
112
+ assert_equal "rm #{f}", @local.logbuf.string.strip
113
+ end
114
+
115
+ def test_rm_missing
116
+ assert_raise Errno::ENOENT do
117
+ assert @local.rm(tmpdir('test-cp'))
118
+ end
119
+ assert_equal "rm #{tmpdir('test-cp')}", @local.logbuf.string.strip
120
+ end
121
+
122
+ def test_rm_f
123
+ FileUtils.cp(__FILE__, f = tmpdir('test-cp'))
124
+ assert @local.rm_f(f)
125
+ assert ! File.exists?(f)
126
+ assert_equal "rm -f #{f}", @local.logbuf.string.strip
127
+ end
128
+
129
+ def test_rm_f_missing
130
+ assert @local.rm_f(f = tmpdir('test-cp'))
131
+ assert ! File.exists?(f)
132
+ assert_equal "rm -f #{f}", @local.logbuf.string.strip
133
+ end
134
+
135
+ def test_rm_r
136
+ FileUtils.cp_r(File.dirname(__FILE__), d = tmpdir('test-cp-r'))
137
+ assert @local.rm_r(d)
138
+ assert ! File.directory?(d)
139
+ assert ! File.exists?(d)
140
+ assert_equal "rm -r #{d}", @local.logbuf.string.strip
141
+ end
142
+
143
+ def test_rm_r_missing
144
+ assert_raise Errno::ENOENT do
145
+ assert @local.rm_r(tmpdir('test-cp-r'))
146
+ end
147
+ assert_equal "rm -r #{tmpdir('test-cp-r')}", @local.logbuf.string.strip
148
+ end
149
+
150
+ def test_rm_rf
151
+ FileUtils.cp_r(File.dirname(__FILE__), d = tmpdir('test-cp-r'))
152
+ assert @local.rm_rf(d)
153
+ assert ! File.directory?(d)
154
+ assert ! File.exists?(d)
155
+ assert_equal "rm -rf #{d}", @local.logbuf.string.strip
156
+ end
157
+
158
+ def test_rm_rf_missing
159
+ assert @local.rm_rf(d = tmpdir('test-cp-r'))
160
+ assert ! File.directory?(d)
161
+ assert ! File.exists?(d)
162
+ assert_equal "rm -rf #{d}", @local.logbuf.string.strip
163
+ end
164
+
165
+ protected
166
+
167
+ def tmpdir(*args)
168
+ @tmpdir ||= "#{Dir.tmpdir}/capsaicin".tap do |d|
169
+ FileUtils.rm_rf d
170
+ FileUtils.mkdir_p d
171
+ end
172
+ File.join @tmpdir, *args
173
+ end
174
+ end
@@ -1,4 +1,5 @@
1
1
  require 'stringio'
2
+ require 'test/unit'
2
3
  require 'rubygems'
3
4
  require 'capistrano/logger'
4
5
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 8
9
- version: 0.1.8
8
+ - 9
9
+ version: 0.1.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joe Khoobyar
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-03 00:00:00 -04:00
17
+ date: 2010-06-15 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -74,8 +74,8 @@ files:
74
74
  - lib/capsaicin/service/windows.rb
75
75
  - lib/capsaicin/sys.rb
76
76
  - lib/capsaicin/ui.rb
77
+ - test/capsaicin/files/local_test.rb
77
78
  - test/helper.rb
78
- - test/test_local_files.rb
79
79
  has_rdoc: true
80
80
  homepage: http://github.com/joekhoobyar/capsaicin
81
81
  licenses: []
@@ -107,5 +107,5 @@ signing_key:
107
107
  specification_version: 3
108
108
  summary: Joe Khoobyar's spicy capistrano extensions
109
109
  test_files:
110
+ - test/capsaicin/files/local_test.rb
110
111
  - test/helper.rb
111
- - test/test_local_files.rb
@@ -1,58 +0,0 @@
1
- require 'test/unit'
2
- require 'helper'
3
- require 'tmpdir'
4
- require 'capsaicin/files'
5
- require 'capsaicin/files/local'
6
-
7
- class TestLocalFiles < Test::Unit::TestCase
8
-
9
- def setup
10
- @local = CapistranoMock.new
11
- @local.extend Capsaicin::Files::Local
12
- end
13
-
14
- def test_exists
15
- assert @local.exists?(__FILE__)
16
- assert_equal "test -e #{__FILE__}", @local.logbuf.string.strip
17
- end
18
-
19
- def test_not_exists
20
- assert ! @local.exists?(__FILE__+'/nope')
21
- end
22
-
23
- def test_readable
24
- assert @local.readable?(__FILE__)
25
- assert_equal "test -r #{__FILE__}", @local.logbuf.string.strip
26
- end
27
-
28
- def test_not_readable
29
- assert ! @local.readable?(__FILE__+'/nope')
30
- end
31
-
32
- def test_writable
33
- assert @local.writable?(Dir.tmpdir)
34
- assert_equal "test -w #{Dir.tmpdir}", @local.logbuf.string.strip
35
- end
36
-
37
- def test_not_writable
38
- assert ! @local.writable?(__FILE__+'/nope')
39
- end
40
-
41
- def test_file
42
- assert @local.file?(__FILE__)
43
- assert_equal "test -f #{__FILE__}", @local.logbuf.string.strip
44
- end
45
-
46
- def test_not_file
47
- assert ! @local.file?(__FILE__+'/nope')
48
- end
49
-
50
- def test_directory
51
- assert @local.directory?(File.dirname(__FILE__))
52
- assert_equal "test -d #{File.dirname __FILE__}", @local.logbuf.string.strip
53
- end
54
-
55
- def test_not_directory
56
- assert ! @local.directory?(__FILE__)
57
- end
58
- end