gap 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -2,7 +2,7 @@ gap.gemspec
2
2
  History.txt
3
3
  Manifest.txt
4
4
  PostInstall.txt
5
- README.rdoc
5
+ README
6
6
  Rakefile
7
7
  lib/gap.rb
8
8
  script/console
@@ -22,3 +22,4 @@ lib/gap/recipes/hg.rb
22
22
  lib/gap/recipes/sys.rb
23
23
  lib/gap/recipes/ruby.rb
24
24
  lib/gap/recipes/god.rb
25
+ lib/gap/recipes/deploy.rb
data/README ADDED
@@ -0,0 +1,99 @@
1
+ gap
2
+
3
+ -----------------------------------------------------------------------------------------------
4
+ あなたがすべき事
5
+ 1 gap のインストール
6
+
7
+ gem install gap
8
+
9
+ 2 homeのrootに.caprcファイルを作り、設定
10
+
11
+ set :user, "hoge" #アプリケーションサーバへのログインユーザ名
12
+ set :sudo_password, "hogehoge" #サーバにおける、sudoパスワード
13
+ set :scm_username, "hoge" #リポジトリサーバへのログインユーザ名
14
+
15
+ 3 (アプリケーション)/config/gap.yml に設定ファイルを作成
16
+
17
+ 4 後はわくわくコマンド。Have a good gap!
18
+
19
+ -----------------------------------------------------------------------------------------------
20
+ 設定ファイルの書き方 #(app_root)/config/gap.yml
21
+
22
+
23
+ global: #グローバルな環境変数設定
24
+ set: #変数を定義
25
+ application: zebra #アプリケーション名
26
+ repository: "ssh://sc02//var/apps/dev/hoge" #リポジトリのuri
27
+ rvm_god_string: 1.9.2@god #godのgemset
28
+ rvm_ruby_string: 1.8.7@zebra #appのgemset
29
+
30
+ local
31
+ rails:
32
+ task: #コマンドを定義
33
+ start: rails server #gap local rails start
34
+ stop: #gap local rails stop
35
+ resstart
36
+ resque
37
+ task:
38
+ start: #gap local resque start
39
+ stop: #gap local resque stop
40
+ restart:
41
+
42
+ dev
43
+ role:
44
+ web: "sc02.galileoscope.com" #deploy先を指定
45
+ rails:
46
+ task:
47
+ start: rails server #gap dev rails start
48
+ stop:
49
+ resstart
50
+ resque
51
+ task:
52
+ start:
53
+ stop:
54
+ restart:
55
+
56
+ alpha:
57
+ role:
58
+ web: "sc02.galileoscope.com"
59
+ rails:
60
+ set:
61
+ god: true #プロセスをgodで監視
62
+ pid_file: #godを使うときは、pidを指定する
63
+ task:
64
+ start: rails server #gap dev rails start
65
+ stop:
66
+ resstart
67
+ resque
68
+ set:
69
+ god: true
70
+ pid_file:
71
+ task:
72
+ start:
73
+ stop:
74
+ restart:
75
+
76
+ beta:
77
+ pro:
78
+
79
+ -----------------------------------------------------------------------------------------------
80
+ コマンド
81
+ alpha環境でdeploy
82
+ -> gap alpha deploy
83
+
84
+ alpha環境でproject起動
85
+ -> gap alpha start
86
+
87
+ alpha環境でrailsだけ起動
88
+ -> gap alpha rails start
89
+
90
+ alpha環境でgodを動かす環境構築
91
+ -> gap alpha god:setup
92
+
93
+ alpha環境でgodに新しい設定ファイルをloadさせる(設定ファイルも自動作成)
94
+ -> gap alpha god:config
95
+
96
+ alpha環境でrailsだけgodに新しい設定ファイルをloadさせる(設定ファイルも自動作成)
97
+ -> gap alpha rails god:config
98
+
99
+
@@ -1,8 +1,8 @@
1
1
  load File.expand_path './recipes/hg.rb', File.dirname(__FILE__)
2
2
  load File.expand_path './recipes/sys.rb', File.dirname(__FILE__)
3
3
  load File.expand_path './recipes/god.rb', File.dirname(__FILE__)
4
- #load 'gap/recipes/hg.rb'
5
- #load 'gap/recipes/sys.rb'
4
+ #load 'deploy' if respond_to?(:namespace)
5
+ load File.expand_path './recipes/deploy.rb', File.dirname(__FILE__)
6
6
 
7
7
  $:.unshift(File.expand_path('./lib', ENV['rvm_path']))
8
8
  require "rvm/capistrano"
@@ -0,0 +1,4 @@
1
+ task :deploy do
2
+ hg.fetch
3
+ restart
4
+ end
data/lib/gap/tasks.rb CHANGED
@@ -52,26 +52,22 @@ module Gap
52
52
  v.each { |attr, val| set attr, val } if v
53
53
  when "task"
54
54
  if god
55
- task(attr) do
56
55
 
56
+ task(attr) do
57
57
  namespace :god do
58
58
  task(:config) do
59
59
  god_config_path = File.join( deploy_to, "config/god_#{application}_#{attr}.rb")
60
60
  tmpl_path = File.expand_path 'tmpl.erb', File.dirname(__FILE__)
61
61
  god_config = Gap::GodErb.new(tmpl_path,application, attr, v)
62
62
  upload( god_config.render, god_config_path, :via => :scp)
63
- use_god_rvm do
64
- sudo "god load #{god_config_path}"
65
- end
63
+ sudo "rvm-shell '#{rvm_god_string}' -c 'god load #{god_config_path}'"
66
64
  end
67
65
  end
68
66
 
69
67
  v.each do |name, command|
70
68
  if ["start","stop","restart"].include?(name)
71
69
  task(name) do
72
- use_god_rvm do
73
- sudo "god #{name} #{attr}_#{application}"
74
- end
70
+ sudo "rvm-shell '#{rvm_god_string}' -c 'god #{name} #{attr}_#{application}'"
75
71
  end
76
72
  else
77
73
  task(name) do
@@ -79,7 +75,6 @@ module Gap
79
75
  end
80
76
  end
81
77
  end
82
-
83
78
  end
84
79
  else
85
80
  task(attr) do
@@ -95,10 +90,5 @@ module Gap
95
90
  end
96
91
  end
97
92
 
98
- def use_god_rvm
99
- ruby_string_tmp = rvm_ruby_string
100
- set :rvm_ruby_string, rvm_god_string
101
- yield
102
- end
103
93
  end
104
94
  end
data/lib/gap.rb CHANGED
@@ -2,5 +2,5 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module Gap
5
- VERSION = '0.0.11'
5
+ VERSION = '0.0.12'
6
6
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gap
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.11
5
+ version: 0.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Takashi Yaguchi
@@ -61,7 +61,7 @@ files:
61
61
  - History.txt
62
62
  - Manifest.txt
63
63
  - PostInstall.txt
64
- - README.rdoc
64
+ - README
65
65
  - Rakefile
66
66
  - lib/gap.rb
67
67
  - script/console
@@ -81,6 +81,7 @@ files:
81
81
  - lib/gap/recipes/sys.rb
82
82
  - lib/gap/recipes/ruby.rb
83
83
  - lib/gap/recipes/god.rb
84
+ - lib/gap/recipes/deploy.rb
84
85
  - .gemtest
85
86
  homepage: http://github.com/#{github_username}/#{project_name}
86
87
  licenses: []
data/README.rdoc DELETED
@@ -1,48 +0,0 @@
1
- = gap
2
-
3
- * http://github.com/#{github_username}/#{project_name}
4
-
5
- == DESCRIPTION:
6
-
7
- FIX (describe your package)
8
-
9
- == FEATURES/PROBLEMS:
10
-
11
- * FIX (list of features or problems)
12
-
13
- == SYNOPSIS:
14
-
15
- FIX (code sample of usage)
16
-
17
- == REQUIREMENTS:
18
-
19
- * FIX (list of requirements)
20
-
21
- == INSTALL:
22
-
23
- * FIX (sudo gem install, anything else)
24
-
25
- == LICENSE:
26
-
27
- (The MIT License)
28
-
29
- Copyright (c) 2012 FIXME full name
30
-
31
- Permission is hereby granted, free of charge, to any person obtaining
32
- a copy of this software and associated documentation files (the
33
- 'Software'), to deal in the Software without restriction, including
34
- without limitation the rights to use, copy, modify, merge, publish,
35
- distribute, sublicense, and/or sell copies of the Software, and to
36
- permit persons to whom the Software is furnished to do so, subject to
37
- the following conditions:
38
-
39
- The above copyright notice and this permission notice shall be
40
- included in all copies or substantial portions of the Software.
41
-
42
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.