luban 0.2.0

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.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +37 -0
  6. data/Rakefile +1 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +7 -0
  9. data/exe/luban +3 -0
  10. data/lib/luban/deployment/cli/application/authenticator.rb +106 -0
  11. data/lib/luban/deployment/cli/application/base.rb +179 -0
  12. data/lib/luban/deployment/cli/application/builder.rb +67 -0
  13. data/lib/luban/deployment/cli/application/publisher.rb +215 -0
  14. data/lib/luban/deployment/cli/application/repository.rb +175 -0
  15. data/lib/luban/deployment/cli/application/scm/git.rb +49 -0
  16. data/lib/luban/deployment/cli/application/scm/rsync.rb +47 -0
  17. data/lib/luban/deployment/cli/application.rb +5 -0
  18. data/lib/luban/deployment/cli/command.rb +360 -0
  19. data/lib/luban/deployment/cli/package/binary.rb +241 -0
  20. data/lib/luban/deployment/cli/package/dependency.rb +49 -0
  21. data/lib/luban/deployment/cli/package/dependency_set.rb +71 -0
  22. data/lib/luban/deployment/cli/package/installer/core.rb +98 -0
  23. data/lib/luban/deployment/cli/package/installer/install.rb +330 -0
  24. data/lib/luban/deployment/cli/package/installer/paths.rb +81 -0
  25. data/lib/luban/deployment/cli/package/installer.rb +3 -0
  26. data/lib/luban/deployment/cli/package/service.rb +17 -0
  27. data/lib/luban/deployment/cli/package/worker.rb +43 -0
  28. data/lib/luban/deployment/cli/package.rb +6 -0
  29. data/lib/luban/deployment/cli/project.rb +94 -0
  30. data/lib/luban/deployment/cli.rb +4 -0
  31. data/lib/luban/deployment/configuration/core.rb +67 -0
  32. data/lib/luban/deployment/configuration/filter.rb +54 -0
  33. data/lib/luban/deployment/configuration/question.rb +38 -0
  34. data/lib/luban/deployment/configuration/server.rb +70 -0
  35. data/lib/luban/deployment/configuration/server_set.rb +86 -0
  36. data/lib/luban/deployment/configuration.rb +5 -0
  37. data/lib/luban/deployment/error.rb +5 -0
  38. data/lib/luban/deployment/helpers/configuration.rb +159 -0
  39. data/lib/luban/deployment/helpers/utils.rb +180 -0
  40. data/lib/luban/deployment/helpers.rb +2 -0
  41. data/lib/luban/deployment/packages/bundler.rb +81 -0
  42. data/lib/luban/deployment/packages/git.rb +37 -0
  43. data/lib/luban/deployment/packages/openssl.rb +59 -0
  44. data/lib/luban/deployment/packages/ruby.rb +125 -0
  45. data/lib/luban/deployment/packages/rubygems.rb +89 -0
  46. data/lib/luban/deployment/packages/yaml.rb +33 -0
  47. data/lib/luban/deployment/parameters.rb +160 -0
  48. data/lib/luban/deployment/runner.rb +99 -0
  49. data/lib/luban/deployment/templates/envrc.erb +30 -0
  50. data/lib/luban/deployment/templates/unset_envrc.erb +28 -0
  51. data/lib/luban/deployment/version.rb +5 -0
  52. data/lib/luban/deployment/worker/base.rb +71 -0
  53. data/lib/luban/deployment/worker/controller.rb +11 -0
  54. data/lib/luban/deployment/worker/local.rb +19 -0
  55. data/lib/luban/deployment/worker/remote.rb +55 -0
  56. data/lib/luban/deployment/worker/task.rb +25 -0
  57. data/lib/luban/deployment/worker.rb +4 -0
  58. data/lib/luban/deployment.rb +8 -0
  59. data/lib/luban.rb +4 -0
  60. data/luban.gemspec +29 -0
  61. metadata +174 -0
@@ -0,0 +1,11 @@
1
+ module Luban
2
+ module Deployment
3
+ module Worker
4
+ class Controller < Base
5
+ def bin_path
6
+ @bin_path ||= install_path.join('bin')
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ module Luban
2
+ module Deployment
3
+ module Worker
4
+ class Local < Base
5
+ def project_path
6
+ @project_path ||= work_dir
7
+ end
8
+
9
+ def apps_path
10
+ @apps_path ||= project_path.join('apps')
11
+ end
12
+
13
+ def app_path
14
+ @app_path ||= apps_path.join(application)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,55 @@
1
+ module Luban
2
+ module Deployment
3
+ module Worker
4
+ class Remote < Base
5
+ def env_path
6
+ @env_path ||= luban_root_path.join('env')
7
+ end
8
+
9
+ def etc_path
10
+ @etc_path ||= luban_root_path.join('etc')
11
+ end
12
+
13
+ def tmp_path
14
+ @tmp_path ||= luban_root_path.join('tmp')
15
+ end
16
+
17
+ def project_path
18
+ @project_path ||= env_path.join("#{stage}.#{project}")
19
+ end
20
+
21
+ def app_path
22
+ @app_path ||= project_path.join(application)
23
+ end
24
+
25
+ def app_bin_path
26
+ @app_bin_path ||= app_path.join('bin')
27
+ end
28
+
29
+ def app_tmp_path
30
+ @app_tmp_path ||= app_path.join('tmp')
31
+ end
32
+
33
+ def releases_path
34
+ @releases_path ||= app_path.join('releases')
35
+ end
36
+
37
+ def shared_path
38
+ @shared_path ||= app_path.join('shared')
39
+ end
40
+
41
+ def luban_install_path
42
+ @luban_install_path ||= project_path.join('.luban')
43
+ end
44
+
45
+ def envrc_file
46
+ @envrc_file ||= app_path.join(".envrc")
47
+ end
48
+
49
+ def unset_envrc_file
50
+ @unset_envrc_file ||= app_path.join(".unset_envrc")
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,25 @@
1
+ require 'ostruct'
2
+
3
+ module Luban
4
+ module Deployment
5
+ module Worker
6
+ class Task
7
+ attr_reader :cmd
8
+ attr_reader :args
9
+ attr_reader :opts
10
+ attr_reader :result
11
+
12
+ def initialize(task)
13
+ @cmd = task[:cmd]
14
+ @args = OpenStruct.new(task[:args])
15
+ @opts = OpenStruct.new(task[:opts])
16
+ @result = OpenStruct.new
17
+ end
18
+
19
+ def to_h
20
+ { cmd: cmd, args: args.to_h, opts: opts.to_h, result: result.to_h }
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,4 @@
1
+ require_relative 'worker/task'
2
+ require_relative 'worker/base'
3
+ require_relative 'worker/local'
4
+ require_relative 'worker/remote'
@@ -0,0 +1,8 @@
1
+ require_relative 'deployment/version'
2
+ require_relative 'deployment/error'
3
+ require_relative 'deployment/configuration'
4
+ require_relative 'deployment/helpers'
5
+ require_relative 'deployment/parameters'
6
+ require_relative 'deployment/worker'
7
+ require_relative 'deployment/cli'
8
+ require_relative 'deployment/runner'
data/lib/luban.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ require 'sshkit'
3
+ require 'luban/cli'
4
+ require 'luban/deployment'
data/luban.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'luban/deployment/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "luban"
8
+ spec.version = Luban::Deployment::VERSION
9
+ spec.authors = ["Rubyist Lei"]
10
+ spec.email = ["rubyist.chi@gmail.com"]
11
+
12
+ spec.summary = %q{Ruby framework for server automation and application deployment}
13
+ spec.description = %q{Luban is a framework to manage server automation and application deployment}
14
+ spec.homepage = "https://github.com/lubanrb/luban"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.required_ruby_version = ">= 2.1.0"
23
+ spec.add_dependency 'luban-cli'
24
+ spec.add_dependency 'sshkit'
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.9"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "minitest"
29
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: luban
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Rubyist Lei
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: luban-cli
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sshkit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.9'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Luban is a framework to manage server automation and application deployment
84
+ email:
85
+ - rubyist.chi@gmail.com
86
+ executables:
87
+ - luban
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/console
97
+ - bin/setup
98
+ - exe/luban
99
+ - lib/luban.rb
100
+ - lib/luban/deployment.rb
101
+ - lib/luban/deployment/cli.rb
102
+ - lib/luban/deployment/cli/application.rb
103
+ - lib/luban/deployment/cli/application/authenticator.rb
104
+ - lib/luban/deployment/cli/application/base.rb
105
+ - lib/luban/deployment/cli/application/builder.rb
106
+ - lib/luban/deployment/cli/application/publisher.rb
107
+ - lib/luban/deployment/cli/application/repository.rb
108
+ - lib/luban/deployment/cli/application/scm/git.rb
109
+ - lib/luban/deployment/cli/application/scm/rsync.rb
110
+ - lib/luban/deployment/cli/command.rb
111
+ - lib/luban/deployment/cli/package.rb
112
+ - lib/luban/deployment/cli/package/binary.rb
113
+ - lib/luban/deployment/cli/package/dependency.rb
114
+ - lib/luban/deployment/cli/package/dependency_set.rb
115
+ - lib/luban/deployment/cli/package/installer.rb
116
+ - lib/luban/deployment/cli/package/installer/core.rb
117
+ - lib/luban/deployment/cli/package/installer/install.rb
118
+ - lib/luban/deployment/cli/package/installer/paths.rb
119
+ - lib/luban/deployment/cli/package/service.rb
120
+ - lib/luban/deployment/cli/package/worker.rb
121
+ - lib/luban/deployment/cli/project.rb
122
+ - lib/luban/deployment/configuration.rb
123
+ - lib/luban/deployment/configuration/core.rb
124
+ - lib/luban/deployment/configuration/filter.rb
125
+ - lib/luban/deployment/configuration/question.rb
126
+ - lib/luban/deployment/configuration/server.rb
127
+ - lib/luban/deployment/configuration/server_set.rb
128
+ - lib/luban/deployment/error.rb
129
+ - lib/luban/deployment/helpers.rb
130
+ - lib/luban/deployment/helpers/configuration.rb
131
+ - lib/luban/deployment/helpers/utils.rb
132
+ - lib/luban/deployment/packages/bundler.rb
133
+ - lib/luban/deployment/packages/git.rb
134
+ - lib/luban/deployment/packages/openssl.rb
135
+ - lib/luban/deployment/packages/ruby.rb
136
+ - lib/luban/deployment/packages/rubygems.rb
137
+ - lib/luban/deployment/packages/yaml.rb
138
+ - lib/luban/deployment/parameters.rb
139
+ - lib/luban/deployment/runner.rb
140
+ - lib/luban/deployment/templates/envrc.erb
141
+ - lib/luban/deployment/templates/unset_envrc.erb
142
+ - lib/luban/deployment/version.rb
143
+ - lib/luban/deployment/worker.rb
144
+ - lib/luban/deployment/worker/base.rb
145
+ - lib/luban/deployment/worker/controller.rb
146
+ - lib/luban/deployment/worker/local.rb
147
+ - lib/luban/deployment/worker/remote.rb
148
+ - lib/luban/deployment/worker/task.rb
149
+ - luban.gemspec
150
+ homepage: https://github.com/lubanrb/luban
151
+ licenses:
152
+ - MIT
153
+ metadata: {}
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: 2.1.0
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 2.4.5
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Ruby framework for server automation and application deployment
174
+ test_files: []