dockrails 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adbe324970fc15fb50b9b9ad644592992c9f1241
4
- data.tar.gz: 0776a2436119808d5471b06910d3535c16889847
3
+ metadata.gz: 8096b68de7a31963de73702571cdc07950838d6e
4
+ data.tar.gz: ff8d5475e2de304a1654229c38ea49961acef3d2
5
5
  SHA512:
6
- metadata.gz: da05bbe63ab3882df34d3b5663268e4c72a907c16c2ecd82bffa4c06167ccb50410bcb420dc7b4a1410291cfae11b178243e671c00fd26bdef999060a04121ff
7
- data.tar.gz: 75d4f9effa54dd0010f5743dad3ccb700198d9227f6b216d338f44c4373932a84be887e84e359567811d4a4962aaa9e4e1d2928312c784d0e2fe37c6d54c2f7e
6
+ metadata.gz: 38232ab9d1ed8fdc66278c64700754117d39a5f71945d2fc8144afd0ab6fdab70fecfbf7fd7fa08d2844606b8d1bf8c33a869bef10832b8ba19c3c57fac463de
7
+ data.tar.gz: c802e14c7650ec7a4f92b9ce8aa3aa7f75ffc188c0b9e9d7f0f7328cbf2a6e0c0437e62fdd2d3d824e8325932614d1abe91623a5cc72e7dc7d06e1c1aab47b25
data/bin/dockrails CHANGED
@@ -7,6 +7,7 @@ require 'dockrails'
7
7
  program :name, 'dockrails'
8
8
  program :version, Dockrails::VERSION
9
9
  program :description, 'CLI to Generate and Run a Rails environment with Docker'
10
+ program :help_formatter, Commander::HelpFormatter::TerminalCompact
10
11
 
11
12
  command :init do |c|
12
13
  c.syntax = 'dockrails init'
@@ -17,15 +18,15 @@ command :init do |c|
17
18
 
18
19
  existing_files = ["Dockerfile", "docker-compose.yml", "docker-sync.yml"].map { |file| File.exist?(file) }
19
20
  if existing_files.include?(true)
20
- say "We detected an existing Docker install in this folder"
21
- answer = agree "Do you want to continue and override it? (yes|no)"
21
+ say "<%= color 'We detected an existing Docker install in this folder', YELLOW %>"
22
+ answer = agree "<%= color 'Do you want to continue and override it? (yes|no)', BOLD %>"
22
23
  exit if !answer
23
24
  end
24
25
 
25
- rails_app = ask "\nType the name of your Rails App folder"
26
+ rails_app = ask "\n<%= color 'Type the name of your Rails App folder', BOLD %>"
26
27
  if !system("find #{rails_app} > /dev/null")
27
- say "\nUnable to find your Rails application folder in the current path, please try again"
28
- say "If you want to create a new Rails app: rails new my_app -B -d postgresql"
28
+ say "\n<%= color 'Unable to find your Rails application folder in the current path, please try again', RED %>"
29
+ say "<%= color 'If you want to create a new Rails app: rails new my_app -B -d postgresql', UNDERLINE %>"
29
30
  exit
30
31
  end
31
32
 
@@ -33,7 +34,7 @@ command :init do |c|
33
34
 
34
35
  (generate.check_system_requirements).each do |k,v|
35
36
  if v == false
36
- say "please install \"#{k}\" in order to continue\n"
37
+ say "\n<%= color 'Please install #{k} in order to continue', RED%>"
37
38
  exit
38
39
  end
39
40
  end
@@ -45,11 +46,11 @@ command :init do |c|
45
46
  generate.create_docker_compose
46
47
  generate.create_docker_sync
47
48
 
48
- say "\nSuccessful dockerization!
49
+ say "\n<%= color 'Successful dockerization!
49
50
  Please take a look at the different files generated:
50
51
  - Dockerfile
51
52
  - docker-compose.yml
52
- - docker-sync.yml"
53
+ - docker-sync.yml', GREEN%>"
53
54
 
54
55
  say "\nStart your dockerized Rails Environement: dockrails start"
55
56
  say "Familiarize yourself with the different commands: dockrails --help"
@@ -83,7 +84,7 @@ command :run do |c|
83
84
  c.example 'description', 'dockrails run [web|job|db|redis] bundle install'
84
85
  c.action do |args, options|
85
86
  if args.size < 2
86
- say "\n Please specify a container and command to run, ex: dockrails run app bundle install"
87
+ say "\n<%= color 'Please specify a container and command to run, ex: dockrails run app bundle install', RED%>"
87
88
  else
88
89
  system("docker-compose run #{args.join(" ")}")
89
90
  end
@@ -93,12 +94,23 @@ end
93
94
  command :attach do |c|
94
95
  c.syntax = 'dockrails attach [container]'
95
96
  c.summary = 'Attach TTY to a specific container (usefull for ByeBug or Pry)'
96
- c.description = 'toto'
97
+ c.description = ''
98
+ c.example 'description', 'dockrails attach web'
97
99
  c.action do |args, options|
98
100
  if args.size < 1
99
- say "\n Please specify a container, ex: dockrails attach app"
101
+ say "\n<%= color 'Please specify a container, ex: dockrails attach web', RED%>"
100
102
  else
101
103
  system("docker attach $(docker-compose ps -q #{args[0]})")
102
104
  end
103
105
  end
104
106
  end
107
+
108
+ command :update do |c|
109
+ c.syntax = 'dockrails update'
110
+ c.summary = 'Update to latest Dockrails version'
111
+ c.description = ''
112
+ c.example 'description', 'dockrails update'
113
+ c.action do |args, options|
114
+ system("gem update dockrails")
115
+ end
116
+ end
@@ -21,23 +21,24 @@ module Dockrails
21
21
  end
22
22
 
23
23
  def configure
24
- @config[:"ruby-version"] = choose("\nChoose a ruby version?", "latest", "2.4", "2.3", "2.2")
25
- @config[:db] = choose("\nChoose a DB Engine", :pgsql, :mysql)
26
- @config[:db_name] = ask "\nChoose a database name"
27
- @config[:db_user] = ask "\nChoose a database username"
28
- @config[:db_password] = ask "\nChoose a database password"
29
- @config[:redis] = agree("\nDo you need a Redis DB? (yes|no)")
30
- @config[:sidekiq] = agree("\nDo you need a SideKiq Container? (yes|no)") if @config[:redis]
31
-
32
- user_agree = agree "\nSummary:
33
- - Ruby version: #{@config[:"ruby-version"]}
24
+ @config[:ruby] = choose("\n<%= color 'Choose a ruby version?', BOLD%>", "latest", "2.4", "2.3", "2.2")
25
+ @config[:db] = choose("\n<%= color 'Choose a DB Engine', BOLD%>", :pgsql, :mysql)
26
+ @config[:db_name] = ask "\n<%= color 'Choose a database name', BOLD%>"
27
+ @config[:db_user] = ask "\n<%= color 'Choose a database username', BOLD%>"
28
+ @config[:db_password] = ask "\n<%= color 'Choose a database password', BOLD%>"
29
+ @config[:redis] = agree("\n<%= color 'Do you need a Redis DB? (yes|no)', BOLD%>")
30
+ @config[:sidekiq] = agree("\n<%= color 'Do you need a SideKiq Container? (yes|no)', BOLD%>") if @config[:redis]
31
+
32
+ say "\nSummary:
33
+ - Ruby version: #{@config[:ruby]}
34
34
  - DB Engine: #{@config[:db]}
35
35
  - DB Name: #{@config[:db_name]}
36
36
  - DB Username: #{@config[:db_user]}
37
37
  - DB Password: #{@config[:db_password]}
38
38
  - Redis? #{@config[:redis]}
39
- - Job Container? #{@config[:sidekiq] ||= false}\n
40
- Is this correct? (yes|no)"
39
+ - Job Container? #{@config[:sidekiq] ||= false}"
40
+
41
+ user_agree = agree("\n<%= color 'Is this correct? (yes|no)', BOLD%>")
41
42
 
42
43
  unless user_agree
43
44
  configure
@@ -54,7 +55,7 @@ module Dockrails
54
55
 
55
56
  def create_dockerfile
56
57
  File.open("Dockerfile", 'w') do |f|
57
- f.write("FROM ruby:#{@config[:"ruby-version"]}
58
+ f.write("FROM ruby:#{@config[:ruby]}
58
59
  RUN apt-get update && apt-get install -y \
59
60
  build-essential \
60
61
  wget \
@@ -1,3 +1,3 @@
1
1
  module Dockrails
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -56,7 +56,7 @@ describe Dockrails::Generate do
56
56
  @app_path = "rails_app"
57
57
 
58
58
  @config_with_redis = {
59
- "ruby-version": "latest",
59
+ ruby: "latest",
60
60
  db: :pgsql,
61
61
  db_name: "rails",
62
62
  db_user: "rails",
@@ -66,7 +66,7 @@ describe Dockrails::Generate do
66
66
  }
67
67
 
68
68
  @config_without_redis = {
69
- "ruby-version": "latest",
69
+ ruby: "latest",
70
70
  db: :pgsql,
71
71
  db_name: "rails",
72
72
  db_user: "rails",
@@ -76,7 +76,7 @@ describe Dockrails::Generate do
76
76
  }
77
77
 
78
78
  @config_with_mysql = {
79
- "ruby-version": "latest",
79
+ ruby: "latest",
80
80
  db: :mysql,
81
81
  db_name: "rails",
82
82
  db_user: "rails",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockrails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Montard