zwr 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/zwr +4 -6
- data/lib/tasks/zwr.rake +13 -0
- data/lib/zwr/app_template.rb +2 -2
- data/zwr.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5647a916fa9019f6e1b66b76faa2b0b630e84534
|
4
|
+
data.tar.gz: 2fef4a6528ab6d8aae2948d6d135fa2d3024aad6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 779744f7ca42cc34d3c808a6b71b4faf92ec7312a46e4dfcaf535082d69421d291dc18afcce7bef127f01b39e077ec8e22d4099a7a349bf3d9cc487a07d42cdc
|
7
|
+
data.tar.gz: 2ad03b49b4f425b209a9c0fdb163b918aab4d513a9373393b2ab22d7d54fdf8bc6f74a6a672f27d481c1ec89912cb2f2e5a1fa2ee3112ea9046c2f0f7461a80c
|
data/bin/zwr
CHANGED
@@ -97,11 +97,9 @@ when 'deploy'
|
|
97
97
|
puts "This script must be run as super user. Use sudo zwr deploy #{ARGV[2]}"
|
98
98
|
else
|
99
99
|
if File.directory? "/var/rails_apps/#{ARGV[1]}"
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
`cd /var/rails_apps/#{ARGV[1]} ; git checkout production`
|
104
|
-
`cd /var/rails_apps/#{ARGV[1]} ; git reset --hard origin/production`
|
100
|
+
puts "Project is already deployed, do the following:"
|
101
|
+
puts "cd /var/rails_apps/#{ARGV[1]}"
|
102
|
+
puts "rake zwr:production:update"
|
105
103
|
else
|
106
104
|
Dir.chdir "/var/rails_apps"
|
107
105
|
putsv "Deploying new project #{ARGV[1]}"
|
@@ -130,8 +128,8 @@ when 'deploy'
|
|
130
128
|
VHFILE
|
131
129
|
`echo "#{virtual_host_file}" > /etc/httpd/virtual_hosts/#{ARGV[1]}.conf`
|
132
130
|
`service httpd reload`
|
131
|
+
`touch /var/rails_apps/#{ARGV[1]}/tmp/restart.txt`
|
133
132
|
end
|
134
|
-
`touch /var/rails_apps/#{ARGV[1]}/tmp/restart.txt`
|
135
133
|
end
|
136
134
|
else
|
137
135
|
show_usage
|
data/lib/tasks/zwr.rake
CHANGED
@@ -13,6 +13,18 @@ namespace :zwr do
|
|
13
13
|
`sed "s/# gem 'theruby/gem 'theruby/" -i Gemfile`
|
14
14
|
end
|
15
15
|
|
16
|
+
namespace :production do
|
17
|
+
desc "updates production environment to latest production branch"
|
18
|
+
task :update do
|
19
|
+
`git fetch`
|
20
|
+
`git checkout production -q`
|
21
|
+
`git reset --hard origin/production`
|
22
|
+
`touch tmp/restart`
|
23
|
+
puts "now with the latest code from origin/production."
|
24
|
+
puts "server restarted."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
16
28
|
desc "prepares production branch ready to roll"
|
17
29
|
task :prepare do
|
18
30
|
Dir.chdir Rails.root
|
@@ -43,6 +55,7 @@ namespace :zwr do
|
|
43
55
|
`git commit -asm "precompiled resources"`
|
44
56
|
`git push -u origin master`
|
45
57
|
`git push -uf origin production`
|
58
|
+
`git checkout master`
|
46
59
|
end
|
47
60
|
end
|
48
61
|
end
|
data/lib/zwr/app_template.rb
CHANGED
@@ -72,7 +72,7 @@ if use_devise
|
|
72
72
|
inject_into_file 'app/models/user.rb', <<-FILE.strip_heredoc, before: "## Database authenticatable\n"
|
73
73
|
## ZWR generated fields
|
74
74
|
field :name, type: String, default: ""
|
75
|
-
field :admin, type: Boolean, default:
|
75
|
+
field :admin, type: Boolean, default: false
|
76
76
|
|
77
77
|
FILE
|
78
78
|
gsub_file 'app/models/user.rb', "## Database authenticatable", " ## Database authenticatable"
|
@@ -83,7 +83,7 @@ if use_devise
|
|
83
83
|
puts " \033[35mfound\033[0m #{filename}"
|
84
84
|
inject_into_file(filename, <<-FILE, :after => "Database authenticatable\n")
|
85
85
|
t.string :name
|
86
|
-
t.boolean :admin
|
86
|
+
t.boolean :admin, default: false
|
87
87
|
FILE
|
88
88
|
gsub_file "test/test_helper.rb","fixtures :all", "include FactoryGirl::Syntax::Methods"
|
89
89
|
end
|
data/zwr.gemspec
CHANGED