app_builder-rails 0.1.4 → 0.2.11

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
- SHA1:
3
- metadata.gz: ec23c0eb27045ac1b67da87008430b5f3287d44c
4
- data.tar.gz: 6c04154d51cb0b89213cc2e296b42b37125e2728
2
+ SHA256:
3
+ metadata.gz: c316150a306a4022e81a316c49837269d86e0b4389580174b6b197a2ce046d72
4
+ data.tar.gz: 620a06b0c9534fc51d9f4b35c0390bff662f47d47685329c3951c2331166f784
5
5
  SHA512:
6
- metadata.gz: 17f5c3d651a7803b14b0b44ca566a3428e95524dc9d6c5bad6337ee15a283e2bc8daf0d24801951e449a4cad4129010e880463e320ba75224b23cac56158c96d
7
- data.tar.gz: 8d51a69594d32487814e7bb642e22b539cb9ecbbd9e977ba8a8b39e21d708d153eb3d3a87690ea6b72b7186c4980865f7a61a3964bd68353a536499b65c83d23
6
+ metadata.gz: 9a5bfd4ed4dd276328006cf304bc8b31cb813f8ee6fc2e65e363a4d56cd628879624272a57b47f08850ec9ab3f90857438e37dabb92c3f671db502e7ae62d663
7
+ data.tar.gz: b191de9fdc2aaaa71b31118b5c26558d9697e77d8c0b4ddaa094f0e16686973738c838e499b308db19e46c82429534a782dfdd0e8a75d86a423a93e9dd6d580f
data/.rubocop.yml ADDED
@@ -0,0 +1,34 @@
1
+ Style/StringLiterals:
2
+ EnforcedStyle: double_quotes
3
+
4
+ Style/StringLiteralsInInterpolation:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/Documentation:
8
+ Enabled: false
9
+
10
+ Style/BlockDelimiters:
11
+ Enabled: false
12
+
13
+ Style/MultilineBlockChain:
14
+ Enabled: false
15
+
16
+ Style/ClassAndModuleChildren:
17
+ Enabled: false
18
+
19
+ Layout/IndentationConsistency:
20
+ Enabled: true
21
+ EnforcedStyle: rails
22
+
23
+ Metrics/AbcSize:
24
+ Max: 20
25
+
26
+ Metrics/BlockLength:
27
+ Exclude:
28
+ - "**/*.rake"
29
+
30
+ Metrics/MethodLength:
31
+ Max: 20
32
+
33
+ Metrics/LineLength:
34
+ Max: 120
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in app_builder-rails.gemspec
6
6
  gemspec
data/README.md CHANGED
@@ -1,28 +1,49 @@
1
1
  # AppBuilder::Rails
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/app_builder/rails`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Generate application to be deployed and upload to s3 (or deploy server).
6
4
 
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
10
8
 
11
9
  ```ruby
12
- gem 'app_builder-rails'
10
+ gem "app_builder-rails"
13
11
  ```
14
12
 
15
13
  And then execute:
16
14
 
17
- $ bundle
15
+ ```
16
+ $ bundle install
17
+ $ bundle exec rails generate app_builder:install
18
+ ```
18
19
 
19
- Or install it yourself as:
20
+ Adds following files:
20
21
 
21
- $ gem install app_builder-rails
22
+ - `config/deploy/environment.yml`
23
+ - `config/deploy/templates/manifest.yml.erb`
24
+ - `lib/tasks/deploy.rake`
22
25
 
23
26
  ## Usage
24
27
 
25
- TODO: Write usage instructions here
28
+ Build source and upload to S3:
29
+
30
+ ```
31
+ $ APP_ENV=develop TARGET_BRANCH=develop bundle exec rails deploy:prepare
32
+ INFO 2018-01-01 12:00:00.000000 9999 Execute command [local]: mkdir -p /var/tmp/project /var/tmp/project/archive/20180101120000 /var/tmp/project/build/20180101120000
33
+ INFO 2018-01-01 12:00:00.000000 9999 Execute command [local]: git remote update (with: {:chdir=>"/var/tmp/project/repo"})
34
+ INFO 2018-01-01 12:00:00.000000 9999 Execute command [local]: git archive develop | tar -x -C /var/tmp/project/archive/20180101120000 (with: {:chdir=>"/var/tmp/project/repo"})
35
+ INFO 2018-01-01 12:00:00.000000 9999 Create revision: {"branch"=>"develop", "revision"=>"0123456789abcdef0123456789abcdef0123456"}
36
+ INFO 2018-01-01 12:00:00.000000 9999 Execute command [local]: tar zcf /var/tmp/project/build/20180101120000/20180101120000.tar.gz . (with: {:chdir=>"/var/tmp/project/archive/20180101120000"})
37
+ INFO 2018-01-01 12:00:00.000000 9999 Uploaded /var/tmp/project/build/20180101120000/20180101120000.tar.gz to s3://dev-source-example-com/assets/20180101120000.tar.gz
38
+ INFO 2018-01-01 12:00:00.000000 9999 Uploaded /var/tmp/project/build/20180101120000/20180101120000.yml to s3://dev-source-example-com/manifests/20180101120000.yml
39
+ ```
40
+
41
+ And then deploy with stretcher in target server:
42
+
43
+ ```
44
+ $ ssh target-server
45
+ $ echo s3://dev-source-example-com/manifests/20180101120000.yml | stretcher
46
+ ```
26
47
 
27
48
  ## Development
28
49
 
@@ -32,7 +53,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
53
 
33
54
  ## Contributing
34
55
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/app_builder-rails.
56
+ Bug reports and pull requests are welcome on GitHub at https://github.com/i2bskn/app_builder-rails.
36
57
 
37
58
  ## License
38
59
 
data/Rakefile CHANGED
@@ -7,4 +7,4 @@ Rake::TestTask.new(:test) do |t|
7
7
  t.test_files = FileList["test/**/*_test.rb"]
8
8
  end
9
9
 
10
- task :default => :test
10
+ task default: :test
@@ -1,5 +1,4 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "app_builder/rails/version"
5
4
 
@@ -9,8 +8,8 @@ Gem::Specification.new do |spec|
9
8
  spec.authors = ["i2bskn"]
10
9
  spec.email = ["i2bskn@gmail.com"]
11
10
 
12
- spec.summary = %q{AppBuilder for Rails.}
13
- spec.description = %q{AppBuilder for Rails.}
11
+ spec.summary = "Generate application to be deployed and upload to s3 (or deploy server)."
12
+ spec.description = "Generate application to be deployed and upload to s3 (or deploy server)."
14
13
  spec.homepage = "https://github.com/i2bskn/app_builder-rails"
15
14
  spec.license = "MIT"
16
15
 
@@ -21,11 +20,13 @@ Gem::Specification.new do |spec|
21
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
21
  spec.require_paths = ["lib"]
23
22
 
24
- spec.add_dependency "app_builder"
23
+ spec.add_dependency "app_builder", "0.2.9"
25
24
  spec.add_dependency "railties"
25
+ spec.add_dependency "vars", "0.0.4"
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 1.16"
28
- spec.add_development_dependency "rake", "~> 10.0"
29
28
  spec.add_development_dependency "minitest", "~> 5.0"
30
29
  spec.add_development_dependency "pry"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rubocop"
31
32
  end
@@ -1,5 +1,5 @@
1
1
  module AppBuilder
2
2
  module Rails
3
- VERSION = "0.1.4"
3
+ VERSION = "0.2.11".freeze
4
4
  end
5
5
  end
@@ -1,39 +1,36 @@
1
1
  namespace :deploy do
2
- def config
3
- env_name = ENV.fetch("BILD_ENV", "develop")
4
- env = AppBuilder::Environment.new(
5
- env_name,
6
- File.expand_path("../../config/deploy/environment.yml", __dir__)
7
- )
8
- config = AppBuilder::Config.new(
9
- resource_type: env[:resource_type],
10
- upload_id: env[:upload_id],
11
- remote_app_home_base: env[:remote_app_home_base],
12
- resource_host: env[:resource_host],
13
- resource_user: env[:resource_user],
14
- resource_ssh_options: env[:resource_ssh_options].symbolize_keys,
15
- resource_document_root: env[:resource_document_root],
16
- )
2
+ def deploy_params(env)
3
+ {
4
+ resource_type: env.resource_type,
5
+ upload_id: env.upload_id,
6
+ remote_app_home_base: env.remote_app_home_base,
7
+ resource_host: env.resource_host,
8
+ resource_user: env.resource_user,
9
+ resource_ssh_options: env.resource_ssh_options.symbolize_keys,
10
+ resource_document_root: env.resource_document_root
11
+ }
12
+ end
13
+
14
+ def deploy_config
15
+ env = Vars.new(path: "config/deploy/environment.yml", source_type: :git)
16
+ config = AppBuilder::Config.new(**deploy_params(env))
17
17
 
18
- env = AppBuilder::Environment.new(
19
- env_name,
20
- File.join(config.archive_path, "config", "deploy", "environment.yml"),
21
- )
22
18
  config.manifest_template_path = File.join(config.archive_path, "config", "deploy", "templates", "manifest.yml.erb")
23
19
  config.after_archive = [
24
20
  proc {
25
- env.create_file(
26
- File.join(config.archive_path, "config", "deploy", "templates", "database.yml.erb"),
27
- File.join(config.archive_path, "config", "database.yml"),
21
+ env.resolve_templates(
22
+ File.join(config.archive_path, "config", "deploy", "templates"),
23
+ File.join(config.archive_path, "config"),
24
+ excludes: ["manifest.yml"]
28
25
  )
29
- },
26
+ }
30
27
  ]
31
28
 
32
29
  config
33
30
  end
34
31
 
35
32
  desc "Upload builded source and stretcher manifest file."
36
- task :upload do
37
- AppBuilder::Uploader.upload(config)
33
+ task :prepare do
34
+ AppBuilder::Uploader.upload(deploy_config)
38
35
  end
39
36
  end
@@ -1,34 +1,31 @@
1
1
  namespace :deploy do
2
- def build_config
3
- env_name = ENV.fetch("BILD_ENV", "develop")
4
- env = AppBuilder::Environment.new(
5
- env_name,
6
- File.expand_path("../../config/deploy/environment.yml", __dir__)
7
- )
8
- config = AppBuilder::Config.new(
9
- upload_id: env[:upload_id],
10
- remote_app_home_base: env[:remote_app_home_base],
11
- )
2
+ def deploy_params(env)
3
+ {
4
+ upload_id: env.upload_id,
5
+ remote_app_home_base: env.remote_app_home_base
6
+ }
7
+ end
8
+
9
+ def deploy_config
10
+ env = Vars.new(path: "config/deploy/environment.yml", source_type: :git)
11
+ config = AppBuilder::Config.new(**deploy_params(env))
12
12
 
13
- env = AppBuilder::Environment.new(
14
- env_name,
15
- File.join(config.archive_path, "config", "deploy", "environment.yml"),
16
- )
17
13
  config.manifest_template_path = File.join(config.archive_path, "config", "deploy", "templates", "manifest.yml.erb")
18
14
  config.after_archive = [
19
15
  proc {
20
- env.create_file(
21
- File.join(config.archive_path, "config", "deploy", "templates", "database.yml.erb"),
22
- File.join(config.archive_path, "config", "database.yml"),
16
+ env.resolve_templates(
17
+ File.join(config.archive_path, "config", "deploy", "templates"),
18
+ File.join(config.archive_path, "config"),
19
+ excludes: ["manifest.yml"]
23
20
  )
24
- },
21
+ }
25
22
  ]
26
23
 
27
24
  config
28
25
  end
29
26
 
30
27
  desc "Upload builded source and stretcher manifest file."
31
- task :upload do
32
- AppBuilder::Uploader.upload(build_config)
28
+ task :prepare do
29
+ AppBuilder::Uploader.upload(deploy_config)
33
30
  end
34
31
  end
@@ -1,18 +1,18 @@
1
1
  default: &default
2
2
  resource_type: "http"
3
- upload_id: "resource.example.com"
4
- remote_app_home_base: "/srv/www"
5
- resource_host: "resource.example.com"
3
+ upload_id: "source.example.com"
4
+ remote_app_home_base: "/var/www"
5
+ resource_host: "source.example.com"
6
6
  resource_user: "centos"
7
7
  resource_ssh_options:
8
8
  port: 22
9
9
  keys: <%= File.expand_path("~/.ssh/id_rsa") %>
10
- resource_document_root: "/srv/www/resource/public"
10
+ resource_document_root: "/var/www/source/public"
11
11
 
12
12
  develop:
13
13
  <<: *default
14
- upload_id: "dev-resource.exampl.com"
15
- resource_host: "dev-resource.example.com"
14
+ upload_id: "dev-source.exampl.com"
15
+ resource_host: "dev-source.example.com"
16
16
 
17
17
  production:
18
18
  <<: *default
@@ -1,10 +1,10 @@
1
1
  default: &default
2
- upload_id: "resource-example-com"
3
- remote_app_home_base: "/srv/www"
2
+ upload_id: "source-example-com"
3
+ remote_app_home_base: "/var/www"
4
4
 
5
5
  develop:
6
6
  <<: *default
7
- upload_id: "dev-resource-example-com"
7
+ upload_id: "dev-source-example-com"
8
8
 
9
9
  production:
10
10
  <<: *default
@@ -8,12 +8,14 @@ commands:
8
8
  - mkdir -p <%= remote_app_home %>/shared/log
9
9
  - mkdir -p <%= remote_app_home %>/shared/pids
10
10
  - mkdir -p <%= remote_app_home %>/shared/bundle
11
+ - mkdir -p <%= remote_app_home %>/shared/sockets
11
12
  post:
12
13
  - ln -nfs <%= remote_app_home %>/releases/<%= build_id %> <%= remote_app_home %>/current
13
14
  - rm -rf <%= remote_app_home %>/current/log
14
15
  - ln -nfs <%= remote_app_home %>/shared/log <%= remote_app_home %>/current/log
15
16
  - mkdir -p <%= remote_app_home %>/current/tmp
16
17
  - ln -nfs <%= remote_app_home %>/shared/pids <%= remote_app_home %>/current/tmp/pids
18
+ - ln -nfs <%= remote_app_home %>/shared/sockets <%= remote_app_home %>/current/tmp/sockets
17
19
  - cd <%= remote_app_home %>/current && bundle install --deployment --without development test --path <%= remote_app_home %>/shared/bundle
18
20
  - echo 'deploy done'
19
21
  success:
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_builder-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - i2bskn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-15 00:00:00.000000000 Z
11
+ date: 2018-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: app_builder
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.2.9
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.2.9
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: vars
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.0.4
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.4
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -53,35 +67,49 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '1.16'
55
69
  - !ruby/object:Gem::Dependency
56
- name: rake
70
+ name: minitest
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '10.0'
75
+ version: '5.0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '10.0'
82
+ version: '5.0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: minitest
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
101
  - - "~>"
74
102
  - !ruby/object:Gem::Version
75
- version: '5.0'
103
+ version: '10.0'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
108
  - - "~>"
81
109
  - !ruby/object:Gem::Version
82
- version: '5.0'
110
+ version: '10.0'
83
111
  - !ruby/object:Gem::Dependency
84
- name: pry
112
+ name: rubocop
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - ">="
@@ -94,7 +122,7 @@ dependencies:
94
122
  - - ">="
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
- description: AppBuilder for Rails.
125
+ description: Generate application to be deployed and upload to s3 (or deploy server).
98
126
  email:
99
127
  - i2bskn@gmail.com
100
128
  executables: []
@@ -102,6 +130,7 @@ extensions: []
102
130
  extra_rdoc_files: []
103
131
  files:
104
132
  - ".gitignore"
133
+ - ".rubocop.yml"
105
134
  - ".travis.yml"
106
135
  - Gemfile
107
136
  - LICENSE
@@ -141,8 +170,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
170
  version: '0'
142
171
  requirements: []
143
172
  rubyforge_project:
144
- rubygems_version: 2.6.11
173
+ rubygems_version: 2.7.6
145
174
  signing_key:
146
175
  specification_version: 4
147
- summary: AppBuilder for Rails.
176
+ summary: Generate application to be deployed and upload to s3 (or deploy server).
148
177
  test_files: []