meskyanichi-generators 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +25 -0
- data/README.rdoc +26 -15
- data/VERSION.yml +1 -1
- data/generators/capistrano_template/capistrano_template_generator.rb +1 -1
- data/generators/capistrano_template/templates/deploy.rb +47 -25
- data/generators/git_template/git_template_generator.rb +3 -1
- data/generators.gemspec +2 -2
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,4 +1,29 @@
|
|
1
1
|
|
2
|
+
Meskyanichi - Generators |0.3.3|
|
3
|
+
-----------------------------------------------------------
|
4
|
+
|
5
|
+
- Extracted 3 symlink tasks and merged them into a single task.
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
Meskyanichi - Generators |0.3.2|
|
10
|
+
-----------------------------------------------------------
|
11
|
+
|
12
|
+
- Automatically sets up the db and assets folder when the
|
13
|
+
"cap deploy:setup" is run. Also generates three other folders
|
14
|
+
within the assets folder "images, videos, files".
|
15
|
+
- Renamed the task "cap deploy:syn_database" to
|
16
|
+
"cap deploy:sync_database_config_file"
|
17
|
+
- Added the task "cap deploy:sync_sqlite3"
|
18
|
+
- Added the task "cap deploy:symlink_sqlite3"
|
19
|
+
- Added the task "cap deploy:reset_capistrano_environment"
|
20
|
+
- "cap deploy:setup" no longer automatically updates repository
|
21
|
+
- "cap deploy:repository" will now be called manually, it will update
|
22
|
+
the local repository and push it to the remote repository, and afterwards
|
23
|
+
deploy it to the server.
|
24
|
+
- The symlink_database task has been renamed to symlink_database_config_file
|
25
|
+
- After deployment, the assets folder will be symlinked from shared/assets to public/assets
|
26
|
+
|
2
27
|
Meskyanichi - Generators |0.3.1|
|
3
28
|
-----------------------------------------------------------
|
4
29
|
|
data/README.rdoc
CHANGED
@@ -13,17 +13,17 @@ a few simple generators that might help you get your application up and running
|
|
13
13
|
|
14
14
|
Essentially what this does, is generate a basic Capistrano deployment recipe. The recipe does a couple of things initially when you set it up.
|
15
15
|
|
16
|
-
Create the necessary folders and files, namely the releases, current(symlink) and the shared folder
|
17
|
-
Creates a log folder and generates a new production.log
|
18
|
-
Creates a
|
16
|
+
*Create the necessary folders and files, namely the releases, current(symlink) and the shared folder
|
17
|
+
*Creates a log folder and generates a new production.log
|
18
|
+
*Creates a assets folder in the shared folder on the remote server, linking to the public/assets in the rails app
|
19
|
+
*Creates a config folder and then syncs the database.yml from your Rails application to the remote server
|
19
20
|
|
20
21
|
During every deployment, the recipe will:
|
21
22
|
|
22
|
-
|
23
|
-
After deployment, will
|
24
|
-
|
25
|
-
|
26
|
-
writable to avoid script caching errors
|
23
|
+
*After deployment, will restart the application for Passenger
|
24
|
+
*After deployment, will place the symlinks for the database, production.log, assets and production.sqlite3 files correctly
|
25
|
+
*Make the javascripts and stylesheets directory, located in the RAILS_ROOT/public directory,
|
26
|
+
writable to avoid script caching errors
|
27
27
|
|
28
28
|
If you wish to generate the simple Capistrano Template, open the terminal, go to the root of your rails application and type the following:
|
29
29
|
|
@@ -55,8 +55,8 @@ Now the whole process in steps:
|
|
55
55
|
2: sudo gem install meskyanichi-generators
|
56
56
|
3: go to root of rails app and type "capify ."
|
57
57
|
4: then type "script/generate capistrano_template [arg1..arg6]"
|
58
|
-
5:
|
59
|
-
6: now type "cap deploy:setup" to set up the whole directory structure and files
|
58
|
+
5: type "capify ."
|
59
|
+
6: now type "cap deploy:setup" to set up the whole directory structure and files on the remote server
|
60
60
|
7: after the setup is finished, and assuming you have your local git repository set up correctly,
|
61
61
|
type "cap deploy" and your application will go live in a matter of seconds!
|
62
62
|
|
@@ -69,7 +69,11 @@ deploy.rb file located in the config directory and have a look. You can easily m
|
|
69
69
|
The recipe provides a few commands which are pretty useful. Including syncing your local database.yml file
|
70
70
|
with the one on the server so that you are not forced to go SSH or FTP to the server to manually change it.
|
71
71
|
|
72
|
-
cap deploy:
|
72
|
+
cap deploy:sync_database_config_file
|
73
|
+
|
74
|
+
The command below will sync your local production.sqlite3 file to the remote server, in the right location so the symlink will effectively work.
|
75
|
+
|
76
|
+
cap deploy:sync_sqlite3
|
73
77
|
|
74
78
|
If you wish to restart your application for Passenger without re-deploying your application, for example, after syncing the new database.yml,
|
75
79
|
and you once again don't want to SHH manually, then you can do a:
|
@@ -85,7 +89,15 @@ but also executes the tasks I mentioned at the top of this README.
|
|
85
89
|
|
86
90
|
cap deploy
|
87
91
|
|
88
|
-
After you've setup Capistrano correctly using the cap deploy:setup, you
|
92
|
+
After you've setup Capistrano correctly using the cap deploy:setup, you can use the above command to deploy your rails application!
|
93
|
+
|
94
|
+
cap deploy:update_repository
|
95
|
+
|
96
|
+
This command will first update your local repository, and then deploy to the remote server.
|
97
|
+
|
98
|
+
cap deploy:reset_capistrano_environment
|
99
|
+
|
100
|
+
The command above will first remove all releases and shared files/folders, then reinitialize the setup process.
|
89
101
|
|
90
102
|
|
91
103
|
|
@@ -128,6 +140,7 @@ The default ignoration rules that are added to the main .gitignore file located
|
|
128
140
|
tmp/**/*
|
129
141
|
config/database.yml
|
130
142
|
db/*.sqlite3
|
143
|
+
public/assets
|
131
144
|
|
132
145
|
|
133
146
|
== Rake Tasks
|
@@ -178,6 +191,4 @@ If all was set up correctly, you should now be able to push your local repositor
|
|
178
191
|
|
179
192
|
== Copyright
|
180
193
|
|
181
|
-
Copyright (c) 2009 Michael. See LICENSE for details.
|
182
|
-
|
183
|
-
|
194
|
+
Copyright (c) 2009 Michael. See LICENSE for details.
|
data/VERSION.yml
CHANGED
@@ -5,7 +5,7 @@ class CapistranoTemplateGenerator < Rails::Generator::Base
|
|
5
5
|
|
6
6
|
@domain_name = @args[0] || "MyDomain.com"
|
7
7
|
@scm = @args[1] || "git"
|
8
|
-
@repository = @args[2] || "ssh://MyDomain.com/MyRepository.git"
|
8
|
+
@repository = @args[2] || "ssh://user@MyDomain.com/MyRepository.git"
|
9
9
|
@branch = @args[3] || "master"
|
10
10
|
@user = @args[4] || "root"
|
11
11
|
@deploy_to = @args[5] || "/var/www/vhosts/#{domain_name}/httpdocs"
|
@@ -31,15 +31,27 @@ default_run_options[:pty] = true
|
|
31
31
|
# You can add additional deployment tasks, or alter the ones below.
|
32
32
|
namespace :deploy do
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
# Tasks performed before deployment
|
35
|
+
desc "Updates repository before deployment."
|
36
|
+
task :update_repository do
|
37
|
+
system "git add ."
|
38
|
+
system "git commit -a -m 'Comitted for deployment.'"
|
39
|
+
system "git push origin master"
|
40
|
+
system "cap deploy"
|
38
41
|
end
|
39
42
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
+
# Tasks performed during/after deployment
|
44
|
+
desc "Sets up all symlinks."
|
45
|
+
task :setup_symlinks do
|
46
|
+
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
47
|
+
run "ln -nfs #{shared_path}/db/production.sqlite3 #{release_path}/db/production.sqlite3"
|
48
|
+
run "ln -nfs #{shared_path}/assets #{release_path}/public/assets"
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "Make javascripts and stylesheets directories writable."
|
52
|
+
task :make_js_and_css_writable do
|
53
|
+
run "chmod 777 #{release_path}/public/javascripts"
|
54
|
+
run "chmod 777 #{release_path}/public/stylesheets"
|
43
55
|
end
|
44
56
|
|
45
57
|
desc "Restart Application with Passenger."
|
@@ -47,33 +59,43 @@ namespace :deploy do
|
|
47
59
|
run "touch #{current_path}/tmp/restart.txt"
|
48
60
|
end
|
49
61
|
|
50
|
-
|
51
|
-
|
52
|
-
|
62
|
+
# Tasks performed during capistrano setup
|
63
|
+
desc "Sets up the shared folder on the remote server"
|
64
|
+
task :setup_shared_folder do
|
65
|
+
run "touch #{shared_path}/log/production.log"
|
66
|
+
run "chmod 0666 #{shared_path}/log/production.log"
|
67
|
+
run "mkdir #{shared_path}/db"
|
68
|
+
run "mkdir -p #{shared_path}/assets/images"
|
69
|
+
run "chmod 777 #{shared_path}/assets/images"
|
70
|
+
run "mkdir -p #{shared_path}/assets/videos"
|
71
|
+
run "chmod 777 #{shared_path}/assets/videos"
|
72
|
+
run "mkdir -p #{shared_path}/assets/files"
|
73
|
+
run "chmod 777 #{shared_path}/assets/files"
|
53
74
|
end
|
54
75
|
|
55
|
-
desc "
|
56
|
-
task :
|
57
|
-
|
58
|
-
run "chmod 777 #{release_path}/public/stylesheets"
|
76
|
+
desc "Syncs the database.yml to the server"
|
77
|
+
task :sync_database_config_file do
|
78
|
+
system "rsync -vr --exclude='.DS_Store' config/database.yml #{user}@#{application}:#{shared_path}/config/"
|
59
79
|
end
|
60
80
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
81
|
+
# Tasks that are performed only manually
|
82
|
+
desc "Syncs the production sqlite3 file to the server."
|
83
|
+
task :sync_sqlite3 do
|
84
|
+
system "rsync -vr --exclude='.DS_Store' db/production.sqlite3 #{user}@#{application}:#{shared_path}/db/production.sqlite3"
|
85
|
+
end
|
86
|
+
|
87
|
+
desc "Reset Capistrano Environment."
|
88
|
+
task :reset_capistrano_environment do
|
89
|
+
run "rm -rf #{shared_path}/"
|
90
|
+
run "rm -rf #{release_path}/"
|
91
|
+
system "cap deploy:setup"
|
66
92
|
end
|
67
93
|
|
68
94
|
end
|
69
95
|
|
70
|
-
# Tasks that run before the deployment process
|
71
|
-
before 'deploy', 'deploy:update_repository'
|
72
|
-
|
73
96
|
# Tasks that run directly after the initial setup
|
74
97
|
after 'deploy:setup', 'deploy:setup_shared_folder'
|
75
|
-
after 'deploy:setup', 'deploy:
|
98
|
+
after 'deploy:setup', 'deploy:sync_database_config_file'
|
76
99
|
|
77
100
|
# Tasks that run directly after deployment
|
78
|
-
after 'deploy:update_code', 'deploy:
|
79
|
-
after 'deploy:update_code', 'deploy:make_js_and_css_writable'
|
101
|
+
after 'deploy:update_code', 'deploy:setup_symlinks'
|
data/generators.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{generators}
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Michael"]
|
9
|
-
s.date = %q{2009-06-
|
9
|
+
s.date = %q{2009-06-05}
|
10
10
|
s.email = %q{meskyan@gmail.com}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"LICENSE",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meskyanichi-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-05 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|