plastic_rails 0.1.5 → 0.1.6
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/plastic_rails.rb +22 -25
- data/lib/plastic_rails/version.rb +1 -1
- data/lib/tmpl/build.sh +1 -1
- metadata +2 -3
- data/lib/plastic_rails/fileutils.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f8a081cd7e8a090c7748843f22728bcd725a994e4c41b88ae5cb57c09a51a4a
|
4
|
+
data.tar.gz: b4d444d97a87883ccbe4ecfe4d51f902de0d8f896c1ebb1572b52a6cb5f3eb37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 168ee64f3cc86a4d6be86e1f876a20b5522b9e4bfcc5c3c7b73084bec3eaea3f010e12517481628b02f236cddd8fd9d0c8e6c163547589fa828dd89e300f16a8
|
7
|
+
data.tar.gz: 3a1df9fc486f4c73d90ac7456595207cabadac703812e6b7cbc268a1f5e83beedf9300e2cb31526ee6ae1e49a715080ab8162a79ec08403955c12209fbeb55aa
|
data/Gemfile.lock
CHANGED
data/lib/plastic_rails.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
require "thor"
|
2
2
|
require "plastic_rails/version"
|
3
|
-
|
4
|
-
THOR_SILENCE_DEPRECATION = true
|
3
|
+
THOR_SILENCE_DEPRECATION = true
|
5
4
|
|
6
5
|
module PlasticRails
|
7
6
|
class Error < StandardError; end
|
8
7
|
|
9
8
|
class PlaRails < Thor
|
9
|
+
include Thor::Actions
|
10
10
|
DEFAULT_TEMPLATE_DIR = File.join(File.dirname(__FILE__) , "tmpl")
|
11
11
|
|
12
|
+
def self.source_root
|
13
|
+
Dir.pwd
|
14
|
+
end
|
15
|
+
|
12
16
|
def self.exit_on_failure?
|
13
17
|
# コマンドが失敗したときに終了ステータス1を返すようにする設定
|
14
18
|
true
|
@@ -18,52 +22,45 @@ module PlasticRails
|
|
18
22
|
option :db_path, :default => "./db/mysql/volumes"
|
19
23
|
option :template, :default => DEFAULT_TEMPLATE_DIR
|
20
24
|
def new(appname)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
FileUtils.sed("docker-compose.yml",/%DB_PATH%/,options[:db_path])
|
25
|
+
directory(options[:template], appname, :mode => :preserve)
|
26
|
+
inside(appname) do
|
27
|
+
# DBのファイルパスを設定する
|
28
|
+
gsub_file("docker-compose.yml", /%DB_PATH%/, options[:db_path])
|
26
29
|
|
27
|
-
|
28
|
-
|
30
|
+
# Dockerイメージビルド&rails new (working_dirは `/apps`)
|
31
|
+
run("./build.sh #{appname}")
|
29
32
|
|
30
|
-
|
31
|
-
|
33
|
+
# working_dirをrailsアプリのディレクトリに変更する
|
34
|
+
gsub_file("docker-compose.yml", /(working_dir: \/apps\/)/, '\1' + appname)
|
32
35
|
|
33
|
-
|
34
|
-
|
36
|
+
# Railsアプリの設定(`bundle install`, `rails db:setup` など)
|
37
|
+
run("./setup.sh")
|
38
|
+
end
|
35
39
|
end
|
36
40
|
|
37
41
|
desc "login", "Log in Rails container related to current directory."
|
38
42
|
def login
|
39
|
-
|
43
|
+
run("docker-compose exec web bash")
|
40
44
|
end
|
41
45
|
|
42
46
|
desc "up", "Start up Rails container related to current directory."
|
43
47
|
def up
|
44
|
-
|
48
|
+
run("docker-compose up -d")
|
45
49
|
end
|
46
50
|
|
47
51
|
desc "stop", "Stop Rails container related to current directory."
|
48
52
|
def stop
|
49
|
-
|
53
|
+
run("docker-compose stop")
|
50
54
|
end
|
51
55
|
|
52
56
|
desc "down", "Stop and remove Rails container related to current directory."
|
53
57
|
def down
|
54
|
-
|
58
|
+
run("docker-compose down")
|
55
59
|
end
|
56
60
|
|
57
61
|
desc "copy_template [DEST_DIR]", "Copy the default template to any dir. (To use in `new` command with `--template` option.)"
|
58
62
|
def copy_template(dest_dir)
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
private
|
63
|
-
|
64
|
-
def execute(cmd)
|
65
|
-
puts cmd
|
66
|
-
system(cmd)
|
63
|
+
directory(DEFAULT_TEMPLATE_DIR, dest_dir, :mode => :preserve)
|
67
64
|
end
|
68
65
|
end
|
69
66
|
end
|
data/lib/tmpl/build.sh
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plastic_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koki Hashimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -71,7 +71,6 @@ files:
|
|
71
71
|
- bin/setup
|
72
72
|
- exe/plastic_rails
|
73
73
|
- lib/plastic_rails.rb
|
74
|
-
- lib/plastic_rails/fileutils.rb
|
75
74
|
- lib/plastic_rails/version.rb
|
76
75
|
- lib/tmpl/Dockerfile
|
77
76
|
- lib/tmpl/apps/.keep
|