capiyii 0.0.3

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.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'capistrano', '>= 2.11.0'
4
+ gem 'capistrano-ext', '>= 1.2.1'
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.2.1"
11
+ gem "jeweler", "~> 1.8.4"
12
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Mlanawo Mbechezi
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.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = capiyii
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to capiyii
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * 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.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2012 Mlanawo Mbechezi. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,50 @@
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 = "capiyii"
16
+ gem.homepage = "http://github.com/deways/capiyii"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{Yii deployment with capistrano}
19
+ gem.description = %Q{Yii deployment with capistrano, useful tasks, rollback deployment and more}
20
+ gem.email = "nawo@deways.com"
21
+ gem.authors = ["Mlanawo Mbechezi"]
22
+ gem.executables = ['capiyii']
23
+ gem.files.include "lib/capiyii.rb"
24
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
25
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
26
+ gem.add_runtime_dependency 'capistrano', '>= 2.11.0'
27
+ gem.add_runtime_dependency 'capistrano-ext', '>= 1.2.1'
28
+ gem.add_development_dependency 'capistrano', '>= 2.11.0'
29
+ gem.add_development_dependency 'capistrano-ext', '>= 1.2.1'
30
+ end
31
+ Jeweler::RubygemsDotOrgTasks.new
32
+
33
+ require 'rake/testtask'
34
+ Rake::TestTask.new(:test) do |test|
35
+ test.libs << 'lib' << 'test'
36
+ test.pattern = 'test/**/test_*.rb'
37
+ test.verbose = true
38
+ end
39
+
40
+ task :default => :test
41
+
42
+ require 'rake/task'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "capiyii #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
data/bin/capiyii ADDED
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'fileutils'
5
+
6
+ OptionParser.new do |opts|
7
+ opts.banner = "Usage: #{File.basename($0)} [path]"
8
+
9
+ opts.on("-h", "--help", "Displays this help info") do
10
+ puts opts
11
+ exit 0
12
+ end
13
+
14
+ begin
15
+ opts.parse!(ARGV)
16
+ rescue OptionParser::ParseError => e
17
+ warn e.message
18
+ puts opts
19
+ exit 1
20
+ end
21
+ end
22
+
23
+ if ARGV.empty?
24
+ abort "Please specify the directory to capiyii, e.g. `#{File.basename($0)} .'"
25
+ elsif !File.exists?(ARGV.first)
26
+ abort "`#{ARGV.first}' does not exist."
27
+ elsif !File.directory?(ARGV.first)
28
+ abort "`#{ARGV.first}' is not a directory."
29
+ elsif ARGV.length > 1
30
+ abort "Too many arguments; please specify only the directory to capiyii."
31
+ end
32
+
33
+ def unindent(string)
34
+ indentation = string[/\A\s*/]
35
+ string.strip.gsub(/^#{indentation}/, "")
36
+ end
37
+
38
+ files = {
39
+ "Capfile" => unindent(<<-FILE),
40
+ load 'deploy' if respond_to?(:namespace) # cap2 differentiator
41
+ load Gem.find_files('capiyii.rb').first.to_s
42
+ load 'config/deploy' # remove this line to skip loading any of the default tasks
43
+ FILE
44
+
45
+ "config/deploy.rb" => 'set :application, "set your application name here"
46
+ set :domain, "#{application}.com"
47
+ set :deploy_to, "/var/www/#{domain}"
48
+
49
+ set :repository, "#{domain}:/var/repos/#{application}.git"
50
+ set :scm, :git
51
+ # Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, `subversion` or `none`
52
+
53
+ role :web, domain # Your HTTP server, Apache/etc
54
+ role :app, domain # This may be the same as your `Web` server
55
+ role :db, domain, :primary => true # This is where Rails migrations will run
56
+
57
+ set :keep_releases, 3'}
58
+
59
+ base = ARGV.shift
60
+ files.each do |file, content|
61
+ file = File.join(base, file)
62
+ if File.exists?(file)
63
+ warn "[skip] '#{file}' already exists"
64
+ elsif File.exists?(file.downcase)
65
+ warn "[skip] '#{file.downcase}' exists, which could conflict with `#{file}'"
66
+ else
67
+ unless File.exists?(File.dirname(file))
68
+ puts "[add] making directory '#{File.dirname(file)}'"
69
+ FileUtils.mkdir(File.dirname(file))
70
+ end
71
+ puts "[add] writing '#{file}'"
72
+ File.open(file, "w") { |f| f.write(content) }
73
+ end
74
+ end
75
+
76
+ puts "[done] capiyiified!"
data/capiyii.gemspec ADDED
@@ -0,0 +1,54 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
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 = 'capiyii'
8
+ s.version = "0.0.3"
9
+ s.platform = Gem::Platform::RUBY
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["Deways"]
13
+ s.date = '2012-10-03'
14
+ s.default_executable = 'capiyii'
15
+ s.description = <<-DESC
16
+ Yii deployment with capistrano, useful tasks, rollback deployment and more
17
+ DESC
18
+ s.summary = <<-DESC.strip.gsub(/\n\s+/, " ")
19
+ Deploying Yii framework applications with Capistrano.
20
+ DESC
21
+ s.email = 'nawo@deways.com'
22
+ s.executables << "capiyii"
23
+ s.extra_rdoc_files = [
24
+ "LICENSE.txt",
25
+ "README.rdoc"
26
+ ]
27
+ s.files = [
28
+ "Gemfile",
29
+ "LICENSE.txt",
30
+ "README.rdoc",
31
+ "Rakefile",
32
+ "bin/capiyii",
33
+ "lib/capiyii.rb",
34
+ "test/helper.rb",
35
+ "test/test_capiyii.rb",
36
+ "capiyii.gemspec"
37
+ ]
38
+ s.homepage = 'http://github.com/deways/capiyii'
39
+ s.licenses = ["MIT"]
40
+ s.require_paths = ["lib"]
41
+ s.test_files = [
42
+ "test/helper.rb",
43
+ "test/test_capiyii.rb"
44
+ ]
45
+
46
+ s.add_runtime_dependency(%q<capistrano>, [">= 2.11.0"])
47
+ s.add_runtime_dependency(%q<capistrano-ext>, [">= 1.2.1"])
48
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
49
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
50
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.2"])
51
+ s.add_development_dependency(%q<capistrano>, [">= 2.11.0"])
52
+ s.add_development_dependency(%q<capistrano-ext>, [">= 1.2.1"])
53
+ end
54
+
data/lib/capiyii.rb ADDED
@@ -0,0 +1,89 @@
1
+ require 'yaml'
2
+
3
+ # Dirs that need to remain the same between deploys (shared dirs)
4
+ set :shared_children, %w(assets protected/runtime)
5
+
6
+ # Files that need to remain the same between deploys
7
+ set :shared_files, %w()
8
+
9
+ # Asset folders (that need to be timestamped)
10
+ set :asset_children, %w(assets)
11
+
12
+ # PHP binary to execute
13
+ set :php_bin, "php"
14
+
15
+ # yii environment on local
16
+ set :yii_env_local, "dev"
17
+
18
+ # yii environment
19
+ set :yii_env, "prod"
20
+
21
+
22
+ namespace :deploy do
23
+ desc "Overwrite the start task because yii doesn't need it."
24
+ task :start do ; end
25
+
26
+ desc "Overwrite the restart task because yii doesn't need it."
27
+ task :restart do ; end
28
+
29
+ desc "Overwrite the stop task because yii doesn't need it."
30
+ task :stop do ; end
31
+
32
+ desc "Customize migrate task because yii doesn't need it."
33
+ task :migrate do
34
+ yii.orm.migrate
35
+ end
36
+
37
+ desc "Symlink static directories and static files that need to remain between deployments."
38
+ task :share_childs do
39
+ if shared_children
40
+ shared_children.each do |link|
41
+ run "mkdir -p #{shared_path}/#{link}"
42
+ run "if [ -d #{release_path}/#{link} ] ; then rm -rf #{release_path}/#{link}; fi"
43
+ run "ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
44
+ end
45
+ end
46
+ if shared_files
47
+ shared_files.each do |link|
48
+ link_dir = File.dirname("#{shared_path}/#{link}")
49
+ run "mkdir -p #{link_dir}"
50
+ run "touch #{shared_path}/#{link}"
51
+ run "ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
52
+ end
53
+ end
54
+ end
55
+
56
+ desc "Customize the finalize_update task to work with yii."
57
+ task :finalize_update, :except => { :no_release => true } do
58
+ run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
59
+ run "mkdir -p #{latest_release}/cache"
60
+
61
+ # Share common files & folders
62
+ share_childs
63
+
64
+ if fetch(:normalize_asset_timestamps, true)
65
+ stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S")
66
+ asset_paths = asset_children.map { |p| "#{latest_release}/#{p}" }.join(" ")
67
+ run "find #{asset_paths} -exec touch -t #{stamp} {} ';'; true", :env => { "TZ" => "UTC" }
68
+ end
69
+ end
70
+
71
+ task :setup, :except => { :no_release => true } do
72
+ dirs = [deploy_to, releases_path, shared_path]
73
+ dirs += shared_children.map { |d| File.join(shared_path, d) }
74
+ run "#{try_sudo} mkdir -p #{dirs.join(' ')} && #{try_sudo} chmod g+w #{dirs.join(' ')}"
75
+ run "#{try_sudo} chmod a+rwx #{shared_children.map { |d| File.join(shared_path, d) }.join(' ')}"
76
+ end
77
+
78
+ desc "Need to overwrite the deploy:cold task so it doesn't try to run the migrations."
79
+ task :cold do
80
+ update
81
+ start
82
+ end
83
+
84
+ end
85
+
86
+ # After finalizing update:
87
+ after "deploy:finalize_update" do
88
+ run "#{try_sudo} chmod a+rwx #{shared_path}/protected"
89
+ end
data/test/helper.rb ADDED
@@ -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 'capiyii'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestCapiyii < 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,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capiyii
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Deways
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.11.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.11.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: capistrano-ext
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 1.2.1
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.2.1
46
+ - !ruby/object:Gem::Dependency
47
+ name: shoulda
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: bundler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.0.0
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.0.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: jeweler
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 1.8.2
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 1.8.2
94
+ - !ruby/object:Gem::Dependency
95
+ name: capistrano
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: 2.11.0
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 2.11.0
110
+ - !ruby/object:Gem::Dependency
111
+ name: capistrano-ext
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.2.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: 1.2.1
126
+ description: ! ' Yii deployment with capistrano, useful tasks, rollback deployment
127
+ and more
128
+
129
+ '
130
+ email: nawo@deways.com
131
+ executables:
132
+ - capiyii
133
+ extensions: []
134
+ extra_rdoc_files:
135
+ - LICENSE.txt
136
+ - README.rdoc
137
+ files:
138
+ - Gemfile
139
+ - LICENSE.txt
140
+ - README.rdoc
141
+ - Rakefile
142
+ - bin/capiyii
143
+ - lib/capiyii.rb
144
+ - test/helper.rb
145
+ - test/test_capiyii.rb
146
+ - capiyii.gemspec
147
+ homepage: http://github.com/deways/capiyii
148
+ licenses:
149
+ - MIT
150
+ post_install_message:
151
+ rdoc_options: []
152
+ require_paths:
153
+ - lib
154
+ required_ruby_version: !ruby/object:Gem::Requirement
155
+ none: false
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ required_rubygems_version: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ requirements: []
167
+ rubyforge_project:
168
+ rubygems_version: 1.8.24
169
+ signing_key:
170
+ specification_version: 3
171
+ summary: Deploying Yii framework applications with Capistrano.
172
+ test_files:
173
+ - test/helper.rb
174
+ - test/test_capiyii.rb