docker-build 0.0.6 → 0.0.7

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: 807c1ce85a82370280a671d123e9b61e9ef04f34
4
- data.tar.gz: 3acc8b7565955e45ec8adc76508826b3112f9b8e
3
+ metadata.gz: a2a8b4a4727f5e9dae3dc5030ea7316df91108bd
4
+ data.tar.gz: 6f582433ef23546f12910be27d5e4cbb7798161d
5
5
  SHA512:
6
- metadata.gz: 588b8e95bac52e34a7d8416119f08d4c3d5efd0a14efdab3b64e2e667ee62a0f419ee12f648ca96e708ee07b311277a4903d35bc8b8b3baf64c5742a823cdae7
7
- data.tar.gz: ccd945c562ac80498117cb764b39f02daa2ee73cbf310d0c647f3dc08c6443437714b536f37045a37df5b596e999136e7bc7ac566626650a521ead457225549c
6
+ metadata.gz: 9fbbe0abe9b70209b8bb5e9314e394bde889cb6a38a21a0b0659db21cb5db2309dac17446114bf9f867975ac97ff8a922ac38f630c0deb9640ae9660a6d7a6dd
7
+ data.tar.gz: dd8e4eab7e326353874f89776fc98e8ffc498452028dc1be971fd424d7ee955b9bb44e314a9cc4f33047df976c5465ed11dded8b5ea504bfee2749c1e5adb482
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .idea
2
+ *.gem
data/docker-build.gemspec CHANGED
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'docker-build'
3
- s.version = `git describe --abbrev=0`.strip()
4
- s.date = `date +"%Y-%m-%d"`.strip()
3
+ s.version = `git describe --abbrev=0`.strip
4
+ s.date = `date +"%Y-%m-%d"`.strip
5
5
  s.summary = 'Preset tasks for Rake'
6
- s.description = 'Preset tasks for Rake when building projects'
6
+ s.description = 'Preset tasks for Rake when building projects with Docker'
7
7
  s.authors = ['VJ Patel']
8
8
  s.email = 'meetthevj@gmail.com'
9
9
  s.files = `git ls-files`.split("\n")
10
10
  s.homepage = 'http://rubygems.org/gems/docker-build'
11
- s.license = 'MIT'
11
+ s.license = 'MIT'
12
12
  end
data/lib/composer.rb CHANGED
@@ -1,21 +1,30 @@
1
1
  class Composer
2
2
 
3
- def self.development
4
- puts '---- Running development Composer installation'
5
- fail 'Composer development installation failed' unless
6
- system self.get_docker_command + 'install --verbose --profile'
3
+ def self.development(env)
4
+ puts '-- Installing Composer development dependencies'
5
+ docker_command = self.get_docker_command(env) + 'install --verbose --profile'
6
+ puts '---- Running: ' << docker_command
7
+ fail 'Composer development installation failed' unless system docker_command
7
8
  end
8
9
 
9
- def self.production
10
- puts '---- Running production Composer installation'
11
- fail 'Composer production installation failed' unless
12
- system self.get_docker_command + 'install --no-dev --optimize-autoloader --no-interaction --verbose --profile'
10
+ def self.production(env)
11
+ puts '---- Installing Composer production dependencies'
12
+ docker_command = self.get_docker_command(env) + 'install --no-dev --optimize-autoloader --no-interaction --verbose --profile'
13
+ puts '---- Running: ' << docker_command
14
+ fail 'Composer production installation failed' unless system docker_command
13
15
  end
14
16
 
15
17
  private
16
- def self.get_docker_command
18
+ def self.get_docker_command(env)
17
19
  puts '---- Launching Composer container'
18
- return 'docker run --rm -v `pwd`:/app vjftw/composer '
20
+ docker_env_vars = env.map{|k,v| "#{k}=#{v}"}.join(' --env ')
21
+ docker_command = 'docker run --rm -v `pwd`:/app '
22
+ if docker_env_vars.length > 5
23
+ docker_command << "--env #{docker_env_vars} "
24
+ end
25
+ docker_command << 'vjftw/composer '
26
+
27
+ return docker_command
19
28
  end
20
29
 
21
30
  end
data/lib/docker-build.rb CHANGED
@@ -4,6 +4,11 @@ class DockerBuild
4
4
  Composer
5
5
  end
6
6
 
7
+ def self.symfony
8
+ Symfony
9
+ end
10
+
7
11
  end
8
12
 
9
13
  require 'composer'
14
+ require 'symfony/symfony'
@@ -0,0 +1,28 @@
1
+ class Doctrine
2
+
3
+ def self.create_database(data_container, db_container = nil)
4
+ puts '-- Creating Symfony Doctrine database'
5
+ docker_command = self.get_docker_command(data_container, db_container) << 'doctrine:database:create'
6
+ puts '---- Running: ' << docker_command
7
+ output = `#{docker_command}`
8
+ print output
9
+ fail 'Database creation failed!' unless /(exists|Created)/.match(output)
10
+ end
11
+
12
+ def self.run_migrations(data_container, db_container = nil)
13
+ puts '-- Running Symfony Doctrine migrations'
14
+
15
+ end
16
+
17
+ private
18
+ def self.get_docker_command(data_container, db_container = nil)
19
+ docker_command = "docker run -it --rm --volumes-from #{data_container} "
20
+ if db_container != nil
21
+ docker_command << "--link #{db_container}:#{db_container} "
22
+ end
23
+ docker_command << 'vjftw/php-cli app/console --ansi '
24
+
25
+ return docker_command
26
+ end
27
+
28
+ end
@@ -0,0 +1,8 @@
1
+ class Symfony
2
+
3
+ def self.doctrine
4
+ Doctrine
5
+ end
6
+ end
7
+
8
+ require 'symfony/doctrine'
metadata CHANGED
@@ -1,26 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-build
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - VJ Patel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-24 00:00:00.000000000 Z
11
+ date: 2015-05-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Preset tasks for Rake when building projects
13
+ description: Preset tasks for Rake when building projects with Docker
14
14
  email: meetthevj@gmail.com
15
15
  executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
+ - ".gitignore"
19
20
  - LICENSE
20
21
  - README.md
21
22
  - docker-build.gemspec
22
23
  - lib/composer.rb
23
24
  - lib/docker-build.rb
25
+ - lib/symfony/doctrine.rb
26
+ - lib/symfony/symfony.rb
24
27
  homepage: http://rubygems.org/gems/docker-build
25
28
  licenses:
26
29
  - MIT