dolphin 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64b7b1836dabf66d97b69fe469e1f8f4033f79e1
4
- data.tar.gz: 83df23c962252ad8e9410219d8a8a69fb0be9229
3
+ metadata.gz: f57b22721a91a02e69fcd6d356ece041a59215cc
4
+ data.tar.gz: 68fa17486f27058ec05277c34dd814f12e242ef1
5
5
  SHA512:
6
- metadata.gz: 1cbff0b4fe5d73c500a6b99b7ef944083407fef7c4670c3d9adc9b24b369aa6a7087223d313a941ebc56fce142071bf5a6c0bebecbed1e2310480b0e8ce255c5
7
- data.tar.gz: 7fb173b1c59804e27891accfba0a29e25f4485afaad496b669abaf7080ac54f50d3215013651bd1e97be282623ceb33730e9499c38e3b83d3f28406d30aed0fb
6
+ metadata.gz: 4f93b35088ea62118f1c33fa44f2c5f8fca4ba43de04e90f1f4b4717685b891f937c09a731d1581605cf6ad60c1c2adc7e949e40ce2132c22cfd0d4153fa2506
7
+ data.tar.gz: e70d4ffcf6d3ab66d9d79d36d0a4fbf4258591d5a347caef49f723b132e20e470831c05b5d9c7fd7a6270155b4413aed46b0df8a1cf4ba92f18dfee1226d66f6
data/README.md CHANGED
@@ -16,9 +16,78 @@ Or install it yourself as:
16
16
 
17
17
  $ gem install dolphin
18
18
 
19
+ ## Rails generator
20
+
21
+ Run generator from your Rails application:
22
+
23
+ $ bin/rails g dolphin:install
24
+
25
+ This will create an executable script as bin/dolphin.
26
+
27
+ ## Configuration
28
+
29
+ Edit the bin/dolphin script generated as above to adjust settings. Please refer to detailed comments inside the script. Minimum config would require the following:
30
+
31
+ # settings require user input
32
+ # -----------------------------
33
+ # name of this application
34
+ @application = 'best_app'
35
+ # on server, the user account for deploying
36
+ @user = 'deploy'
37
+ # location of git repository
38
+ @github = "git@github.com:nengxu/dolphin.git"
39
+ # which ruby, for chruby
40
+ @ruby_version = 'ruby-2.0.0-p195'
41
+
42
+ case @env
43
+ when 'qa'
44
+ @servers = [
45
+ 'qa01.best_app.com',
46
+ 'qa02.best_app.com',
47
+ ]
48
+ when 'production'
49
+ @servers = [
50
+ 'prod01.best_app.com',
51
+ 'prod02.best_app.com',
52
+ ]
53
+ else # @env == 'alpha'
54
+ # list of servers for this environment
55
+ @servers = [
56
+ 'dev01.best_app.com',
57
+ 'dev02.best_app.com',
58
+ ]
59
+ # customized branch, default is the same as @env
60
+ @branch = 'master'
61
+ end
62
+
19
63
  ## Usage
20
64
 
21
- TODO: Write usage instructions here
65
+ Show top level command modules:
66
+
67
+ $ bin/dolphin
68
+
69
+ Show subcommands under one module:
70
+
71
+ $ bin/dolphin deploy
72
+ $ bin/dolphin git
73
+ $ bin/dolphin lock
74
+ $ bin/dolphin nginx
75
+ $ bin/dolphin puma
76
+ $ bin/dolphin setup
77
+
78
+ Execute a subcommand, for example, normal deployment:
79
+
80
+ $ bin/dolphin deploy go -e production
81
+
82
+ ## Related gems
83
+
84
+ * [capistrano]
85
+ * [chruby]
86
+ * [git-deploy]
87
+ * [hell]
88
+ * [mina]
89
+ * [moonshine]
90
+ * [strano]
22
91
 
23
92
  ## Contributing
24
93
 
@@ -27,3 +96,11 @@ TODO: Write usage instructions here
27
96
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
97
  4. Push to the branch (`git push origin my-new-feature`)
29
98
  5. Create new Pull Request
99
+
100
+ [capistrano]: https://github.com/capistrano/capistrano
101
+ [chruby]: https://github.com/postmodern/chruby
102
+ [git-deploy]: https://github.com/mislav/git-deploy
103
+ [hell]: https://github.com/seatgeek/hell
104
+ [mina]: https://github.com/nadarei/mina
105
+ [moonshine]: https://github.com/railsmachine/moonshine
106
+ [strano]: https://github.com/joelmoss/strano
@@ -6,11 +6,11 @@ require 'dolphin/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "dolphin"
8
8
  spec.version = Dolphin::VERSION
9
- spec.authors = ["Neng Xu\n"]
9
+ spec.authors = ["Neng Xu"]
10
10
  spec.email = ["neng2.xu2@gmail.com"]
11
11
  spec.description = %q{Dolphin: deploy smartly}
12
12
  spec.summary = %q{Dolphin: deploy smartly}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/nengxu/dolphin"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -15,8 +15,7 @@ class Dolphin::Lock < Dolphin::Base
15
15
 
16
16
  desc "create", "Create lock"
17
17
  def create
18
- lock_message = "Deploy started at #{@deploy_date} in progress\n"
19
- command = "echo '#{lock_message}' > #{@lock_file}"
18
+ command = "echo '#{@lock_message}' > #{@lock_file}"
20
19
  puts capture(command, @lead_server)
21
20
  end
22
21
 
@@ -1,3 +1,3 @@
1
1
  module Dolphin
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,14 @@
1
+ require 'rails/generators'
2
+
3
+ class Dolphin::InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../templates", __FILE__)
5
+
6
+ def setup
7
+ target = "bin/dolphin"
8
+ copy_file "dolphin", target
9
+ # make it executable
10
+ chmod(target, 0755)
11
+ puts "Now edit bin/dolphin to adjust deployment settings\nThen run bin/dolphin to deploy."
12
+ end
13
+
14
+ end
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env ruby
2
+ require "dolphin"
3
+
4
+ class Dolphin::Base
5
+
6
+ private
7
+
8
+ # deployment environments
9
+ def env
10
+ # ===================================
11
+ # common options for all environments
12
+ # ===================================
13
+
14
+ # settings require user input
15
+ # -----------------------------
16
+ # name of this application
17
+ @application = 'best_app'
18
+ # on server, the user account for deploying
19
+ @user = 'deploy'
20
+ # location of git repository
21
+ @github = "git@github.com:nengxu/dolphin.git"
22
+ # which ruby, for chruby
23
+ @ruby_version = 'ruby-2.0.0-p195'
24
+
25
+ # settings with default values
26
+ # -----------------------------
27
+ # on servers, the directory where Rails applications reside
28
+ @app_dir = '/rails'
29
+ # on servers under @app_dir, the directory where this application resides
30
+ @deploy_dir = "#{@app_dir}/#{@application}"
31
+ # puma related settings
32
+ @sockets = "#{@deploy_dir}/tmp/sockets"
33
+ @pids = "#{@deploy_dir}/tmp/pids"
34
+
35
+ # internal variables, no need to change by user
36
+ # -----------------------------
37
+ # ssh sessions
38
+ @sessions = {}
39
+
40
+ # ===================================
41
+ # environment specific options
42
+ # ===================================
43
+
44
+ # when deploy, need to specify the environment by using "-e env_name"
45
+ # for example: bin/dolphin deploy go -e alpha
46
+
47
+ # @env is the environment as specified
48
+ # @branch is the git branch for this environment
49
+ # by default @branch is the same as @env
50
+ @env = @branch =options[:env]
51
+
52
+ case @env
53
+ when 'qa'
54
+ @servers = [
55
+ 'qa01.best_app.com',
56
+ 'qa02.best_app.com',
57
+ ]
58
+ when 'production'
59
+ @servers = [
60
+ 'prod01.best_app.com',
61
+ 'prod02.best_app.com',
62
+ ]
63
+ else # @env == 'alpha'
64
+ # list of servers for this environment
65
+ @servers = [
66
+ 'dev01.best_app.com',
67
+ 'dev02.best_app.com',
68
+ ]
69
+ # customized branch, default is the same as @env
70
+ @branch = 'master'
71
+ end
72
+
73
+ # ===================================
74
+ # settings to avoid simultaneous deployments
75
+ # ===================================
76
+
77
+ # current deployment will abort when another deployment is still in progress
78
+
79
+ # lead server for lock status
80
+ @lead_server = @servers[0]
81
+ # name and location of the lock file
82
+ @lock_file = "#{@deploy_dir}/tmp/pids/dolphin.lock"
83
+ # format of date/time for lock file
84
+ @deploy_date = Time.now.strftime("%m%d%H%M")
85
+ # custom content for the lock file
86
+ @lock_message = "Deploy started at #{@deploy_date} in progress\n"
87
+
88
+ end
89
+ end
90
+
91
+ # start the CLI
92
+ Dolphin::CLI.start
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dolphin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
- - |
8
- Neng Xu
7
+ - Neng Xu
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-13 00:00:00.000000000 Z
11
+ date: 2013-06-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: thor
@@ -99,7 +98,9 @@ files:
99
98
  - lib/dolphin/deploy.rb
100
99
  - lib/dolphin/lock.rb
101
100
  - lib/dolphin/version.rb
102
- homepage: ''
101
+ - lib/generators/dolphin/install_generator.rb
102
+ - lib/generators/dolphin/templates/dolphin
103
+ homepage: https://github.com/nengxu/dolphin
103
104
  licenses:
104
105
  - MIT
105
106
  metadata: {}