yiifony 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'capistrano', '>= 2.5.20'
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.0.0"
11
+ gem "jeweler", "~> 1.5.2"
12
+ gem "rcov", ">= 0"
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,38 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ capistrano (2.5.20)
5
+ highline
6
+ net-scp (>= 1.0.0)
7
+ net-sftp (>= 2.0.0)
8
+ net-ssh (>= 2.0.14)
9
+ net-ssh-gateway (>= 1.0.0)
10
+ capistrano-ext (1.2.1)
11
+ capistrano (>= 1.0.0)
12
+ git (1.2.5)
13
+ highline (1.6.1)
14
+ jeweler (1.5.2)
15
+ bundler (~> 1.0.0)
16
+ git (>= 1.2.5)
17
+ rake
18
+ net-scp (1.0.4)
19
+ net-ssh (>= 1.99.1)
20
+ net-sftp (2.0.5)
21
+ net-ssh (>= 2.0.9)
22
+ net-ssh (2.1.3)
23
+ net-ssh-gateway (1.0.1)
24
+ net-ssh (>= 1.99.1)
25
+ rake (0.8.7)
26
+ rcov (0.9.9)
27
+ shoulda (2.11.3)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ bundler (~> 1.0.0)
34
+ capistrano (>= 2.5.20)
35
+ capistrano-ext (>= 1.2.1)
36
+ jeweler (~> 1.5.2)
37
+ rcov
38
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Andrey Voronov
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
+ = yiifony
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to yiifony
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) 2011 Andrey Voronov. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,57 @@
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 = "yiifony"
16
+ gem.homepage = "http://github.com/voronov/yiifony"
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 = "voronov84@gmail.com"
21
+ gem.authors = ["Andrey Voronov"]
22
+ gem.executables = ['yiifony']
23
+ gem.files.include "lib/yiifony.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.5.20'
27
+ gem.add_runtime_dependency 'capistrano-ext', '>= 1.2.1'
28
+ gem.add_development_dependency 'capistrano', '>= 2.5.20'
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
+ require 'rcov/rcovtask'
41
+ Rcov::RcovTask.new do |test|
42
+ test.libs << 'test'
43
+ test.pattern = 'test/**/test_*.rb'
44
+ test.verbose = true
45
+ end
46
+
47
+ task :default => :test
48
+
49
+ require 'rake/rdoctask'
50
+ Rake::RDocTask.new do |rdoc|
51
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
+
53
+ rdoc.rdoc_dir = 'rdoc'
54
+ rdoc.title = "yiifony #{version}"
55
+ rdoc.rdoc_files.include('README*')
56
+ rdoc.rdoc_files.include('lib/**/*.rb')
57
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/yiifony 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 capifony, 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 capifony."
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.required_location('yiifony', 'yiifony.rb')
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] yiifonied!"
data/lib/yiifony.rb ADDED
@@ -0,0 +1,81 @@
1
+ require 'yaml'
2
+
3
+ # Dirs that need to remain the same between deploys (shared dirs)
4
+ set :shared_children, %w(log assets)
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
+ desc "Need to overwrite the deploy:cold task so it doesn't try to run the migrations."
72
+ task :cold do
73
+ update
74
+ start
75
+ end
76
+
77
+ end
78
+
79
+ # After finalizing update:
80
+ after "deploy:finalize_update" do
81
+ 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 'yiifony'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestYiifony < 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,234 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yiifony
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Andrey Voronov
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-23 00:00:00 +02:00
19
+ default_executable: yiifony
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ type: :runtime
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 51
29
+ segments:
30
+ - 2
31
+ - 5
32
+ - 20
33
+ version: 2.5.20
34
+ name: capistrano
35
+ version_requirements: *id001
36
+ prerelease: false
37
+ - !ruby/object:Gem::Dependency
38
+ type: :runtime
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 29
45
+ segments:
46
+ - 1
47
+ - 2
48
+ - 1
49
+ version: 1.2.1
50
+ name: capistrano-ext
51
+ version_requirements: *id002
52
+ prerelease: false
53
+ - !ruby/object:Gem::Dependency
54
+ type: :development
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ name: shoulda
65
+ version_requirements: *id003
66
+ prerelease: false
67
+ - !ruby/object:Gem::Dependency
68
+ type: :development
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ hash: 23
75
+ segments:
76
+ - 1
77
+ - 0
78
+ - 0
79
+ version: 1.0.0
80
+ name: bundler
81
+ version_requirements: *id004
82
+ prerelease: false
83
+ - !ruby/object:Gem::Dependency
84
+ type: :development
85
+ requirement: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ hash: 7
91
+ segments:
92
+ - 1
93
+ - 5
94
+ - 2
95
+ version: 1.5.2
96
+ name: jeweler
97
+ version_requirements: *id005
98
+ prerelease: false
99
+ - !ruby/object:Gem::Dependency
100
+ type: :development
101
+ requirement: &id006 !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ hash: 3
107
+ segments:
108
+ - 0
109
+ version: "0"
110
+ name: rcov
111
+ version_requirements: *id006
112
+ prerelease: false
113
+ - !ruby/object:Gem::Dependency
114
+ type: :runtime
115
+ requirement: &id007 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ hash: 51
121
+ segments:
122
+ - 2
123
+ - 5
124
+ - 20
125
+ version: 2.5.20
126
+ name: capistrano
127
+ version_requirements: *id007
128
+ prerelease: false
129
+ - !ruby/object:Gem::Dependency
130
+ type: :runtime
131
+ requirement: &id008 !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ hash: 29
137
+ segments:
138
+ - 1
139
+ - 2
140
+ - 1
141
+ version: 1.2.1
142
+ name: capistrano-ext
143
+ version_requirements: *id008
144
+ prerelease: false
145
+ - !ruby/object:Gem::Dependency
146
+ type: :development
147
+ requirement: &id009 !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ hash: 51
153
+ segments:
154
+ - 2
155
+ - 5
156
+ - 20
157
+ version: 2.5.20
158
+ name: capistrano
159
+ version_requirements: *id009
160
+ prerelease: false
161
+ - !ruby/object:Gem::Dependency
162
+ type: :development
163
+ requirement: &id010 !ruby/object:Gem::Requirement
164
+ none: false
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ hash: 29
169
+ segments:
170
+ - 1
171
+ - 2
172
+ - 1
173
+ version: 1.2.1
174
+ name: capistrano-ext
175
+ version_requirements: *id010
176
+ prerelease: false
177
+ description: Yii deployment with capistrano, useful tasks, rollback deployment and more
178
+ email: voronov84@gmail.com
179
+ executables:
180
+ - yiifony
181
+ extensions: []
182
+
183
+ extra_rdoc_files:
184
+ - LICENSE.txt
185
+ - README.rdoc
186
+ files:
187
+ - .document
188
+ - Gemfile
189
+ - Gemfile.lock
190
+ - LICENSE.txt
191
+ - README.rdoc
192
+ - Rakefile
193
+ - VERSION
194
+ - bin/yiifony
195
+ - lib/yiifony.rb
196
+ - test/helper.rb
197
+ - test/test_yiifony.rb
198
+ has_rdoc: true
199
+ homepage: http://github.com/voronov/yiifony
200
+ licenses:
201
+ - MIT
202
+ post_install_message:
203
+ rdoc_options: []
204
+
205
+ require_paths:
206
+ - lib
207
+ required_ruby_version: !ruby/object:Gem::Requirement
208
+ none: false
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ hash: 3
213
+ segments:
214
+ - 0
215
+ version: "0"
216
+ required_rubygems_version: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ hash: 3
222
+ segments:
223
+ - 0
224
+ version: "0"
225
+ requirements: []
226
+
227
+ rubyforge_project:
228
+ rubygems_version: 1.6.2
229
+ signing_key:
230
+ specification_version: 3
231
+ summary: Yii deployment with capistrano
232
+ test_files:
233
+ - test/helper.rb
234
+ - test/test_yiifony.rb