necktie 1.0.6 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,26 @@
1
+ 1.1.0 (2010-04-12)
2
+ * Changed: Capistrano can pull from one of these locations ($ denotes variable):
3
+ $necktie_url master
4
+ $necktie_url $necktie_branch
5
+ $repository necktie
6
+ $repository $necktie_branch
7
+
8
+ If you use a separate repository from your main application, set necktie_url
9
+ to that repository. The default branch is origin/master.
10
+
11
+ If you use the same repository as your main application, the default branch
12
+ is origin/necktie. To create an empty origin/necktie branch:
13
+
14
+ $ git symbolic-ref HEAD refs/heads/necktie
15
+ $ rm .git/index
16
+ $ git clean -fdx
17
+ $ echo "# My Necktie file" > Necktie
18
+ $ git add .
19
+ $ git commit -a -m "First commit"
20
+ $ git push origin necktie
21
+ * Added: --branch command line options to clone/update given branch. Defaults to necktie.
22
+ * Removed: No long supports --ref command line options. Sorry.
23
+
1
24
  1.0.6 (2009-12-08)
2
25
  * Fixed: cap necktie crapping on web enable/disable.
3
26
 
data/README.rdoc CHANGED
@@ -75,12 +75,41 @@ only runs once, before that directory exists.
75
75
 
76
76
  I use Capistrano to setup new instances and upgrade existing ones.
77
77
 
78
- To use the Necktie task, set the necktie_url variable to the URL of your
79
- Necktie repository, and require necktie/capistrano. For example:
78
+ You can store your Necktie files in a separate repository, or same repository as
79
+ your application but in a separate branch.
80
+
81
+ If using a separate repository, set the variable necktie_url to the URL of the
82
+ Necktie repository. You can also set necktie_branch to particular branch name,
83
+ the default is master.
84
+
85
+ For example:
80
86
 
81
87
  require "necktie/capistrano"
82
88
  set :necktie_url, "git@example.com:mysetup"
83
89
 
90
+ If using the same repository and separate branch, do not set necktie_url. You
91
+ can set necktie_branch to a particular branch name, the default in this case is
92
+ necktie. You still need to require "necktie/capistrano".
93
+
94
+ To create a new empty branch for Necktie that will live in the same repository
95
+ as your application (note: make sure to commit all changes first, or you'll lose
96
+ them):
97
+
98
+ $ git symbolic-ref HEAD refs/heads/necktie
99
+ $ rm .git/index
100
+ $ git clean -fdx
101
+ $ echo "# My Necktie file" > Necktie
102
+ $ git add .
103
+ $ git commit -a -m "First commit"
104
+ $ git push origin necktie
105
+
106
+ Rather than switching back and forth, you can clone this repository within your
107
+ application's working directory:
108
+
109
+ $ cd myapp
110
+ $ git clone -b necktie git:myapp.git .necktie
111
+ $ ls necktie
112
+
84
113
  Setting up a new EC2 instance:
85
114
 
86
115
  cap necktie ROLES=app HOSTS=ec2-75-101-239-12.compute-1.amazonaws.com
@@ -48,4 +48,34 @@ server {
48
48
 
49
49
  }
50
50
 
51
+ server {
52
+ listen 0.0.0.0:8080;
53
+ server_name _;
54
+
55
+ location / {
56
+ root /var/myapp/current/public/;
57
+ if (-f $request_filename) {
58
+ break; # Static asset
59
+ }
60
+ error_page 500 501 502 503 504 /500.html;
61
+ proxy_pass http://unicorn;
62
+ proxy_set_header Host $host;
63
+ proxy_set_header X-Real-IP $remote_addr;
64
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
65
+ client_max_body_size 10m;
66
+ client_body_buffer_size 128k;
67
+ proxy_connect_timeout 90;
68
+ proxy_send_timeout 90;
69
+ proxy_read_timeout 90;
70
+ proxy_buffer_size 16k;
71
+ proxy_buffers 32 16k;
72
+ proxy_busy_buffers_size 64k;
73
+
74
+ error_page 503 /system/maintenance.html;
75
+ location /system/maintenance.html {
76
+ error_page 405 /system/maintenance.html;
77
+ rewrite ^ /system/maintenance.html break;
78
+ }
79
+ }
80
+ }
51
81
 
@@ -10,6 +10,7 @@ module Necktie
10
10
  @rakefiles = ["Necktie", "necktie", "Necktie.rb", "necktie.rb"]
11
11
  options.nosearch = true
12
12
  options.env = "production"
13
+ options.branch = "necktie"
13
14
  end
14
15
 
15
16
  def run
@@ -19,15 +20,14 @@ module Necktie
19
20
  if File.exist?(repo)
20
21
  Dir.chdir repo do
21
22
  puts "Pulling latest updates to #{repo} ..."
22
- sh "git pull origin master", :verbose=>false
23
- end if options.pull
23
+ sh "git pull origin #{options.branch}"
24
+ end
24
25
  else
25
26
  options.git_url or fail "Need to set Git URL: use --source command line option"
26
27
  puts "Cloning #{options.git_url} to #{repo}"
27
- sh "git clone #{options.git_url} #{repo.inspect}", :verbose=>false
28
+ sh "git clone --branch #{options.branch} #{options.git_url} #{repo.inspect}"
28
29
  end
29
30
  Dir.chdir repo do
30
- sh "git checkout #{options.ref}" if options.ref
31
31
  @sha = `git rev-parse --verify HEAD --short`.strip
32
32
  puts "(in #{Dir.pwd}, head is #{@sha}, environment is #{options.env})"
33
33
  syslog :info, "environment is %s", options.env
@@ -49,8 +49,8 @@ module Necktie
49
49
  ['--source', '-S GIT_URL', "Git URL to your Necktie repository",
50
50
  lambda { |value| options.git_url = value }
51
51
  ],
52
- ['--ref', '-R REF', "Checkout specific reference (commit, tag, tree)",
53
- lambda { |value| options.ref = value }
52
+ ['--branch', '-B BRANCH', "Checkout specific branch (default is necktie)",
53
+ lambda { |value| options.branch = value }
54
54
  ],
55
55
  ['--update', '-U', "Update .necktie directory (git pull)",
56
56
  lambda { |value| options.pull = true }
@@ -12,8 +12,10 @@ Capistrano::Configuration.instance.load do
12
12
 
13
13
  desc "[internal] Pull updates from Git"
14
14
  task :pull do
15
- fail "You need to set :necktie_url, <git_url>" unless necktie_url
16
- sudo "necktie --environment #{fetch(:rails_env, "production")} --source #{necktie_url} --update"
15
+ url = fetch(:necktie_url, repository) # necktie_url+origin/master or repository+origin/necktie
16
+ branch = fetch(:necktie_branch, exists?(:necktie_url) ? "master" : "necktie")
17
+ puts " ** Pulling from #{url} #{branch}"
18
+ sudo "necktie --environment #{fetch(:rails_env, "production")} --source #{url} --branch #{branch}"
17
19
  end
18
20
 
19
21
  desc "[internal] Run necktie upgrade"
@@ -26,7 +28,6 @@ Capistrano::Configuration.instance.load do
26
28
 
27
29
  desc "Run necktie on all servers (you can use HOSTS or RAILS env vars)"
28
30
  task :default do
29
- fail "You need to set :necktie_url, <git_url>" unless necktie_url
30
31
  install
31
32
  pull
32
33
  upgrade
data/necktie.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "necktie"
3
- spec.version = "1.0.6"
3
+ spec.version = "1.1.0"
4
4
  spec.author = "Assaf Arkin"
5
5
  spec.email = "assaf@labnotes.org"
6
6
  spec.homepage = "http://github.com/assaf/necktie"
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: necktie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 1
8
+ - 0
9
+ version: 1.1.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Assaf Arkin
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-12-08 00:00:00 -08:00
17
+ date: 2010-04-12 00:00:00 -07:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -256,7 +261,7 @@ licenses: []
256
261
  post_install_message:
257
262
  rdoc_options:
258
263
  - --title
259
- - Necktie 1.0.6
264
+ - Necktie 1.1.0
260
265
  - --main
261
266
  - README.rdoc
262
267
  - --webcvs
@@ -267,18 +272,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
267
272
  requirements:
268
273
  - - ">="
269
274
  - !ruby/object:Gem::Version
275
+ segments:
276
+ - 0
270
277
  version: "0"
271
- version:
272
278
  required_rubygems_version: !ruby/object:Gem::Requirement
273
279
  requirements:
274
280
  - - ">="
275
281
  - !ruby/object:Gem::Version
282
+ segments:
283
+ - 0
276
284
  version: "0"
277
- version:
278
285
  requirements: []
279
286
 
280
287
  rubyforge_project:
281
- rubygems_version: 1.3.5
288
+ rubygems_version: 1.3.6
282
289
  signing_key:
283
290
  specification_version: 3
284
291
  summary: Dress to impress