app_builder-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +39 -0
- data/Rakefile +10 -0
- data/app_builder-rails.gemspec +31 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/app_builder/rails/railtie.rb +4 -0
- data/lib/app_builder/rails/version.rb +5 -0
- data/lib/app_builder/rails.rb +10 -0
- data/lib/app_builder-rails.rb +1 -0
- data/lib/generators/app_builder/install/USAGE +5 -0
- data/lib/generators/app_builder/install/install_generator.rb +39 -0
- data/lib/generators/app_builder/install/templates/.keep +0 -0
- data/lib/generators/app_builder/install/templates/deploy.rake +25 -0
- data/lib/generators/app_builder/install/templates/deploy_s3.rake +20 -0
- data/lib/generators/app_builder/install/templates/environment.yml +18 -0
- data/lib/generators/app_builder/install/templates/environment_s3.yml +10 -0
- data/lib/generators/app_builder/install/templates/manifest.yml.erb +25 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c189d519bf4d048cd5d6ad41c0326ea92ea32f2d
|
4
|
+
data.tar.gz: 45f08068c0b4655af759c41bf463653acd720170
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a99bd11d7ebadbe556fcf382cb91618f3962adee7bf9824cbcf3ba0fb8fe11bfdc0a3a14b2ee5d51e80c7ef9fbdcc7933ce48936724923aadeccda2ec2ed54c9
|
7
|
+
data.tar.gz: 498d50f10a98ca208462226da8f7125d093d496cd11f6842257c3635cfee8d5c910953405369c787c073095d10652b978217bafe4810ba01fe5bd6c7ce1ec126
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Ken Iiboshi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# AppBuilder::Rails
|
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
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'app_builder-rails'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install app_builder-rails
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/app_builder-rails.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "app_builder/rails/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "app_builder-rails"
|
8
|
+
spec.version = AppBuilder::Rails::VERSION
|
9
|
+
spec.authors = ["i2bskn"]
|
10
|
+
spec.email = ["i2bskn@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{AppBuilder for Rails.}
|
13
|
+
spec.description = %q{AppBuilder for Rails.}
|
14
|
+
spec.homepage = "https://github.com/i2bskn/app_builder-rails"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "app_builder"
|
25
|
+
spec.add_dependency "railties"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
30
|
+
spec.add_development_dependency "pry"
|
31
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "app_builder/rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "app_builder/rails"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module AppBuilder::Generators
|
2
|
+
class InstallGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path("templates", __dir__)
|
4
|
+
|
5
|
+
class_option :resource_type, type: :string, desc: "s3 or http or https"
|
6
|
+
|
7
|
+
def create_environment_yaml
|
8
|
+
src = s3? ? "environment_s3.yml" : "environment.yml"
|
9
|
+
copy_file src, File.join(deploy_path, "environment.yml")
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_manifest_yaml_erb
|
13
|
+
copy_file "manifest.yml.erb", File.join(deploy_path, "templates", "manifest.yml.erb")
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_deploy_tasks
|
17
|
+
src = s3? ? "deploy_s3.rake" : "deploy.rake"
|
18
|
+
template src, File.join(tasks_path, "deploy.rake")
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def tasks_path
|
24
|
+
"lib/tasks"
|
25
|
+
end
|
26
|
+
|
27
|
+
def deploy_path
|
28
|
+
"config/deploy"
|
29
|
+
end
|
30
|
+
|
31
|
+
def s3?
|
32
|
+
resource_type == "s3"
|
33
|
+
end
|
34
|
+
|
35
|
+
def resource_type
|
36
|
+
options[:resource_type] || "s3"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
def build_env
|
3
|
+
@build_env ||= AppBuilder::Environment.new(
|
4
|
+
ENV.fetch("BILD_ENV", "develop"),
|
5
|
+
File.expand_path("../../config/deploy/environment.yml", __dir__),
|
6
|
+
)
|
7
|
+
end
|
8
|
+
|
9
|
+
def build_config
|
10
|
+
@build_config ||= AppBuilder::Config.new(
|
11
|
+
upload_type: build_env[:upload_type],
|
12
|
+
upload_id: build_env[:upload_id],
|
13
|
+
remote_app_home_base: build_env[:remote_app_home_base],
|
14
|
+
resource_host: build_env[:resource_host],
|
15
|
+
resource_user: build_env[:resource_user],
|
16
|
+
resource_ssh_options: build_env[:resource_ssh_options].symbolize_keys,
|
17
|
+
resource_document_root: build_env[:resource_document_root],
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Upload builded source and stretcher manifest file."
|
22
|
+
task :upload do
|
23
|
+
AppBuilder::Uploader.upload(build_config)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
def build_env
|
3
|
+
@build_env ||= AppBuilder::Environment.new(
|
4
|
+
ENV.fetch("BILD_ENV", "develop"),
|
5
|
+
File.expand_path("../../config/deploy/environment.yml", __dir__),
|
6
|
+
)
|
7
|
+
end
|
8
|
+
|
9
|
+
def build_config
|
10
|
+
@build_config ||= AppBuilder::Config.new(
|
11
|
+
upload_id: build_env[:upload_id],
|
12
|
+
remote_app_home_base: build_env[:remote_app_home_base],
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Upload builded source and stretcher manifest file."
|
17
|
+
task :upload do
|
18
|
+
AppBuilder::Uploader.upload(build_config)
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
default: &default
|
2
|
+
upload_type: "http"
|
3
|
+
upload_id: "resource.example.com"
|
4
|
+
remote_app_home_base: "/srv/www"
|
5
|
+
resource_host: "resource.example.com"
|
6
|
+
resource_user: "centos"
|
7
|
+
resource_ssh_options:
|
8
|
+
port: 22
|
9
|
+
keys: <%= File.expand_path("~/.ssh/id_rsa") %>
|
10
|
+
resource_document_root: "/srv/www/resource/public"
|
11
|
+
|
12
|
+
develop:
|
13
|
+
<<: *default
|
14
|
+
upload_id: "dev-resource.exampl.com"
|
15
|
+
resource_host: "dev-resource.example.com"
|
16
|
+
|
17
|
+
production:
|
18
|
+
<<: *default
|
@@ -0,0 +1,25 @@
|
|
1
|
+
src: <%= src_url %>
|
2
|
+
checksum: <%= checksum %>
|
3
|
+
dest: <%= remote_app_home %>/releases/<%= build_id %>
|
4
|
+
commands:
|
5
|
+
pre:
|
6
|
+
- echo 'staring deploy'
|
7
|
+
- mkdir -p <%= remote_app_home %>/releases
|
8
|
+
- mkdir -p <%= remote_app_home %>/shared/log
|
9
|
+
- mkdir -p <%= remote_app_home %>/shared/pids
|
10
|
+
post:
|
11
|
+
- ln -nfs <%= remote_app_home %>/releases/<%= build_id %> <%= remote_app_home %>/current
|
12
|
+
- rm -rf <%= remote_app_home %>/current/log
|
13
|
+
- ln -nfs <%= remote_app_home %>/shared/log <%= remote_app_home %>/current/log
|
14
|
+
- mkdir -p <%= remote_app_home %>/current/tmp
|
15
|
+
- ln -nfs <%= remote_app_home %>/shared/pids <%= remote_app_home %>/current/tmp/pids
|
16
|
+
- cd <%= remote_app_home %>/current && bundle install --deployment --without development test
|
17
|
+
- echo 'deploy done'
|
18
|
+
success:
|
19
|
+
- echo 'deploy success'
|
20
|
+
failure:
|
21
|
+
- echo 'deploy failed!!'
|
22
|
+
- cat >> /tmp/failure.log
|
23
|
+
excludes:
|
24
|
+
- "*.pid"
|
25
|
+
- "*.socket"
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: app_builder-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- i2bskn
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: app_builder
|
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: railties
|
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.16'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.16'
|
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: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
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
|
+
description: AppBuilder for Rails.
|
98
|
+
email:
|
99
|
+
- i2bskn@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- app_builder-rails.gemspec
|
111
|
+
- bin/console
|
112
|
+
- bin/setup
|
113
|
+
- lib/app_builder-rails.rb
|
114
|
+
- lib/app_builder/rails.rb
|
115
|
+
- lib/app_builder/rails/railtie.rb
|
116
|
+
- lib/app_builder/rails/version.rb
|
117
|
+
- lib/generators/app_builder/install/USAGE
|
118
|
+
- lib/generators/app_builder/install/install_generator.rb
|
119
|
+
- lib/generators/app_builder/install/templates/.keep
|
120
|
+
- lib/generators/app_builder/install/templates/deploy.rake
|
121
|
+
- lib/generators/app_builder/install/templates/deploy_s3.rake
|
122
|
+
- lib/generators/app_builder/install/templates/environment.yml
|
123
|
+
- lib/generators/app_builder/install/templates/environment_s3.yml
|
124
|
+
- lib/generators/app_builder/install/templates/manifest.yml.erb
|
125
|
+
homepage: https://github.com/i2bskn/app_builder-rails
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.6.11
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: AppBuilder for Rails.
|
149
|
+
test_files: []
|