fork_legacy_deploy 0.1.0

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
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
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.6.4"
12
+ gem "rcov", ">= 0"
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.6.4)
6
+ bundler (~> 1.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.9.2)
10
+ rcov (0.9.10)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.6.4)
19
+ rcov
20
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Sam Tubbax
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
+ = fork_legacy_deploy
2
+
3
+ Deploy old as hell fork projects
4
+
5
+ == Contributing to fork_legacy_deploy
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 Sam Tubbax. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "fork_legacy_deploy"
18
+ gem.homepage = "http://github.com/samtubbax/fork_legacy_deploy"
19
+ gem.license = "MIT"
20
+ gem.summary = "Deploy old versions of fork CMS"
21
+ gem.description = "Deploy old versions of fork CMS. Specifically the one that says 'Copyright 2006', no idea what version it is"
22
+ gem.email = "sam@sumocoders.be"
23
+ gem.authors = ["Sam Tubbax", "Tijs Verkoyen", "Jan De Poorter"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ test.rcov_opts << '--exclude "gems/*"'
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "fork_legacy_deploy #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,62 @@
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 = "fork_legacy_deploy"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Sam Tubbax", "Tijs Verkoyen", "Jan De Poorter"]
12
+ s.date = "2011-09-22"
13
+ s.description = "Deploy old versions of fork CMS. Specifically the one that says 'Copyright 2006', no idea what version it is"
14
+ s.email = "sam@sumocoders.be"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "fork_legacy_deploy.gemspec",
28
+ "lib/fork_legacy_deploy.rb",
29
+ "lib/forkcms_deploy/defaults.rb",
30
+ "lib/forkcms_deploy/forkcms.rb",
31
+ "lib/forkcms_deploy/overwrites.rb",
32
+ "test/helper.rb",
33
+ "test/test_fork_legacy_deploy.rb"
34
+ ]
35
+ s.homepage = "http://github.com/samtubbax/fork_legacy_deploy"
36
+ s.licenses = ["MIT"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = "1.8.10"
39
+ s.summary = "Deploy old versions of fork CMS"
40
+
41
+ if s.respond_to? :specification_version then
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
46
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
48
+ s.add_development_dependency(%q<rcov>, [">= 0"])
49
+ else
50
+ s.add_dependency(%q<shoulda>, [">= 0"])
51
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
52
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
53
+ s.add_dependency(%q<rcov>, [">= 0"])
54
+ end
55
+ else
56
+ s.add_dependency(%q<shoulda>, [">= 0"])
57
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
58
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
59
+ s.add_dependency(%q<rcov>, [">= 0"])
60
+ end
61
+ end
62
+
@@ -0,0 +1,2 @@
1
+ require 'forkcms_deploy/forkcms'
2
+ require 'forkcms_deploy/overwrites'
@@ -0,0 +1,22 @@
1
+ configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
2
+
3
+ configuration.load do
4
+ # don't use sudo, on most shared setups we won't have sudo-access
5
+ set :use_sudo, false
6
+
7
+ # we're on a share setup so group_writable isn't allowed
8
+ set :group_writable, false
9
+
10
+ # 3 releases should be enough.
11
+ set :keep_releases, 3
12
+
13
+ # remote caching will keep a local git repo on the server you're deploying to and simply run a fetch from that
14
+ # rather than an entire clone. This is probably the best option and will only fetch the differences each deploy
15
+ set :deploy_via, :remote_cache
16
+
17
+ # set the value for pseudo terminals in Capistrano
18
+ default_run_options[:pty] = true
19
+
20
+ # your computer must be running ssh-agent for the git checkout to work from the server to the git server
21
+ set :ssh_options, { :forward_agent => true }
22
+ end
@@ -0,0 +1,59 @@
1
+ configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
2
+
3
+ configuration.load do
4
+ # define some extra folder to create
5
+ set :shared_children, %w(files config/frontend config/backend config/library)
6
+
7
+ # custom events configuration
8
+ after 'deploy:setup' do
9
+ forkcms.link_document_root
10
+ end
11
+
12
+ after 'deploy:update_code' do
13
+ forkcms.link_configs
14
+ forkcms.link_files
15
+ end
16
+
17
+ # Fork CMS specific tasks
18
+ namespace :forkcms do
19
+ desc 'Link the config files'
20
+ task :link_configs do
21
+
22
+ # change the path to current_path
23
+ run "if [ -f #{shared_path}/config/library/globals.php ]; then sed -i 's/#{version_dir}\\/[0-9]*/#{current_dir}/' #{shared_path}/config/library/globals.php; fi"
24
+
25
+ # symlink the globals
26
+ run %{
27
+ ln -sf #{shared_path}/config/library/globals.php #{release_path}/library/globals.php
28
+ }
29
+ end
30
+
31
+ desc 'link the document root to the current/default_www-folder'
32
+ task :link_document_root do
33
+ # create symlink for document_root if it doesn't exists
34
+ documentRootExists = capture("if [ ! -e #{document_root} ]; then ln -sf #{current_path}/public #{document_root}; echo 'no'; fi").chomp
35
+
36
+ unless documentRootExists == 'no'
37
+ warn "Warning: Document root (#{document_root}) already exists"
38
+ warn "to link it to the Fork deploy issue the following command:"
39
+ warn " ln -sf #{current_path}/public #{document_root}"
40
+ end
41
+ end
42
+
43
+ desc 'Create needed symlinks'
44
+ task :link_files do
45
+ # get the list of folders in /frontend/files
46
+ folders = capture("ls -1 #{release_path}/public/userfiles").split(/\r?\n/)
47
+
48
+ # loop the folders
49
+ folders.each do |folder|
50
+ # copy them to the shared path, remove them from the release and symlink them
51
+ run %{
52
+ cp -r #{release_path}/public/userfiles/#{folder} #{shared_path}/files/#{folder} &&
53
+ rm -rf #{release_path}/public/userfiles/#{folder} &&
54
+ ln -s #{shared_path}/files/#{folder} #{release_path}/public/userfiles/#{folder}
55
+ }
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,31 @@
1
+ configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
2
+
3
+ configuration.load do
4
+ # Deployment process
5
+ namespace :deploy do
6
+ desc 'Prepares the servers for deployment.'
7
+ task :setup, :except => { :no_release => true } do
8
+ # this method is overwritten because Fork CMS isn't a Rails-application
9
+
10
+ # define folders to create
11
+ dirs = [deploy_to, releases_path, shared_path]
12
+
13
+ # add folder that aren't standard
14
+ dirs += shared_children.map { |d| File.join(shared_path, d) }
15
+
16
+ # create the dirs
17
+ run %{
18
+ #{try_sudo} mkdir -p #{dirs.join(' ')} &&
19
+ #{try_sudo} chmod g+w #{dirs.join(' ')}
20
+ }
21
+ end
22
+
23
+ task :finalize_update, :except => { :no_release => true } do
24
+ # Fork CMS isn't a Rails-application so don't do Rails specific stuff
25
+ run 'chmod -R g+w #{latest_release}' if fetch(:group_writable, true)
26
+ end
27
+
28
+ # overrule restart
29
+ task :restart do; end
30
+ end
31
+ 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 'fork_legacy_deploy'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestForkLegacyDeploy < 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,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fork_legacy_deploy
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Sam Tubbax
14
+ - Tijs Verkoyen
15
+ - Jan De Poorter
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2011-09-22 00:00:00 Z
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ name: shoulda
33
+ prerelease: false
34
+ type: :development
35
+ requirement: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ hash: 23
43
+ segments:
44
+ - 1
45
+ - 0
46
+ - 0
47
+ version: 1.0.0
48
+ name: bundler
49
+ prerelease: false
50
+ type: :development
51
+ requirement: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ hash: 7
59
+ segments:
60
+ - 1
61
+ - 6
62
+ - 4
63
+ version: 1.6.4
64
+ name: jeweler
65
+ prerelease: false
66
+ type: :development
67
+ requirement: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ version_requirements: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ name: rcov
79
+ prerelease: false
80
+ type: :development
81
+ requirement: *id004
82
+ description: Deploy old versions of fork CMS. Specifically the one that says 'Copyright 2006', no idea what version it is
83
+ email: sam@sumocoders.be
84
+ executables: []
85
+
86
+ extensions: []
87
+
88
+ extra_rdoc_files:
89
+ - LICENSE.txt
90
+ - README.rdoc
91
+ files:
92
+ - .document
93
+ - Gemfile
94
+ - Gemfile.lock
95
+ - LICENSE.txt
96
+ - README.rdoc
97
+ - Rakefile
98
+ - VERSION
99
+ - fork_legacy_deploy.gemspec
100
+ - lib/fork_legacy_deploy.rb
101
+ - lib/forkcms_deploy/defaults.rb
102
+ - lib/forkcms_deploy/forkcms.rb
103
+ - lib/forkcms_deploy/overwrites.rb
104
+ - test/helper.rb
105
+ - test/test_fork_legacy_deploy.rb
106
+ homepage: http://github.com/samtubbax/fork_legacy_deploy
107
+ licenses:
108
+ - MIT
109
+ post_install_message:
110
+ rdoc_options: []
111
+
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ hash: 3
120
+ segments:
121
+ - 0
122
+ version: "0"
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ hash: 3
129
+ segments:
130
+ - 0
131
+ version: "0"
132
+ requirements: []
133
+
134
+ rubyforge_project:
135
+ rubygems_version: 1.8.10
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: Deploy old versions of fork CMS
139
+ test_files: []
140
+