containers 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/exe/ctrs +5 -0
  3. data/lib/containers/cli.rb +32 -115
  4. data/lib/containers/commands/attach.rb +11 -0
  5. data/lib/containers/commands/bash.rb +11 -0
  6. data/lib/containers/commands/bin.rb +11 -0
  7. data/lib/containers/commands/down.rb +8 -0
  8. data/lib/containers/commands/exec.rb +14 -0
  9. data/lib/containers/commands/inspect.rb +11 -0
  10. data/lib/containers/commands/list.rb +23 -0
  11. data/lib/containers/commands/rails/rails.rb +11 -0
  12. data/lib/containers/commands/restart.rb +12 -0
  13. data/lib/containers/commands/ruby/bundle.rb +11 -0
  14. data/lib/containers/commands/ruby/rake.rb +11 -0
  15. data/lib/containers/commands/start.rb +12 -0
  16. data/lib/containers/commands/stop.rb +12 -0
  17. data/lib/containers/commands/tail.rb +11 -0
  18. data/lib/containers/commands/up.rb +8 -0
  19. data/lib/containers/commands/yarn/yarn.rb +11 -0
  20. data/lib/containers/concerns/commandable.rb +19 -0
  21. data/lib/containers/concerns/configurable.rb +62 -0
  22. data/lib/containers/generator/cli.rb +43 -0
  23. data/lib/containers/generator/commands/compose.rb +51 -0
  24. data/lib/containers/generator/commands/config.rb +43 -0
  25. data/lib/containers/generator/commands/dockerfile.rb +46 -0
  26. data/lib/containers/generator/templates/containers.yml.erb +15 -0
  27. data/lib/containers/{templates → generator/templates}/docker-compose.yml.erb +21 -38
  28. data/lib/containers/version.rb +1 -1
  29. data/lib/containers.rb +0 -4
  30. metadata +106 -32
  31. data/Gemfile +0 -9
  32. data/Gemfile.lock +0 -106
  33. data/LICENSE.txt +0 -21
  34. data/README.md +0 -24
  35. data/Rakefile +0 -12
  36. data/containers.gemspec +0 -42
  37. data/lib/containers/generator.rb +0 -40
  38. /data/lib/containers/{templates → generator/templates}/Dockerfile.erb +0 -0
  39. /data/lib/containers/{templates/redis-cache.conf → generator/templates/redis/cache.conf} +0 -0
  40. /data/lib/containers/{templates/redis-queue.conf → generator/templates/redis/queue.conf} +0 -0
data/containers.gemspec DELETED
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/containers/version"
4
-
5
- Gem::Specification.new do |gem|
6
- gem.name = "containers"
7
- gem.version = Containers::VERSION
8
- gem.authors = ["Hopsoft"]
9
- gem.email = ["natehop@gmail.com"]
10
-
11
- gem.summary = "Manage local development environments with Docker"
12
- gem.description = "Manage local development environments with Docker"
13
- gem.homepage = "https://github.com/hopsoft/containers"
14
- gem.license = "MIT"
15
- gem.required_ruby_version = ">= 2.6.0"
16
-
17
- # gem.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
-
19
- gem.metadata["homepage_uri"] = gem.homepage
20
- gem.metadata["source_code_uri"] = gem.homepage
21
- gem.metadata["changelog_uri"] = "#{gem.homepage}/CHANGELOG.md"
22
-
23
- # Specify which files should be added to the gem when it is released.
24
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
- gem.files = Dir.chdir(File.expand_path(__dir__)) do
26
- `git ls-files -z`.split("\x0").reject do |f|
27
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
- end
29
- end
30
- gem.bindir = "exe"
31
- gem.executables = gem.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
- gem.require_paths = ["lib"]
33
-
34
- gem.add_dependency "rainbow", "~> 3.1.1"
35
- gem.add_dependency "thor", "~> 1.2.1"
36
-
37
- gem.add_development_dependency "github_changelog_generator", "~> 1.16.4"
38
- gem.add_development_dependency "ruby_jard", "~> 0.3.1"
39
-
40
- # For more information and examples about making a new gem, check out our
41
- # guide at: https://bundler.io/guides/creating_gem.html
42
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "erb"
4
-
5
- class Generator < Thor
6
- desc "dockerfile", "Creates a Dockerfile for the project"
7
- def dockerfile
8
- path = File.expand_path("Dockerfile")
9
-
10
- continue = if File.exist?(path)
11
- ask("#{Rainbow("Dockerfile already exists").red} Overwrite?", default: "Y").to_s.upcase == "Y"
12
- else
13
- true
14
- end
15
-
16
- return unless continue
17
-
18
- ruby_version = ask("What Ruby version does this project use?", default: "3.1.2").to_s
19
- File.write path, render("Dockerfile", ruby_version: ruby_version)
20
- end
21
-
22
- desc "compose", "Creates a docker-compose.yml file for the project"
23
- def compose
24
- end
25
-
26
- private
27
-
28
- def root_path
29
- File.expand_path(File.join(__dir__, "..", ".."))
30
- end
31
-
32
- def template(name)
33
- ERB.new(File.read(File.join(root_path, "lib/containers/templates/#{name}.erb")))
34
- end
35
-
36
- def render(template_name, vars = {})
37
- view = Struct.new(*vars.keys).new(*vars.values).instance_eval { binding }
38
- template(template_name).result view
39
- end
40
- end