bricky 0.0.8 → 0.0.9

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTk2Mjc3MWI3NGNhYTQwOGY5MDMyMjY0YTY0OWQ5YThiYTU3ODc3OQ==
4
+ NjZmNGY2NGQwMzE4NDlhYzcxZmQxMWRiZjM0ZTU4MGNmMjcyYjdlMg==
5
5
  data.tar.gz: !binary |-
6
- YTdlMTFiMjJjNjEzOGY4YTVmZDQzZTQwYTc3ZjI0ZGE1ZGI2ZThkNw==
6
+ OTA0ODM2ZGQwYzZiMWUxOTI2OWZkOTNlYmU3MzkyNTExNzZlY2Q2Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzMwMzRiNjBlNWE2NmU2MTQwNDkzY2VjNzcyNDE5NGM3MjEzYzZiNGIxZDZm
10
- ZmY3MzdhMTQwOWFkNmNjMzFiZTc5OTdmNjg2ZTRhMWFmZTIwNzJhNzQzNmNl
11
- MzliZjUwNjZlMjA4YmZjN2VjMWI2NjZlZjM5MDcxZTExY2M1NzM=
9
+ NjBiYWFiNzM1YTk4NmEyM2M3ZmI1ZDFhY2Q3OTFmM2NmZDU3YjI1ODA4ZmEx
10
+ MTY0N2RlNTQ1ZTMwMjJjOGNlYjAyYzkwOGE0YTUwMjMwNjAxM2VjYjYxYzY1
11
+ ZTkxZDg4NjYyZTEzNWI3OGVmZTYxMTgyMzY4MTE5N2Y2ZDI3MjM=
12
12
  data.tar.gz: !binary |-
13
- NTc2YmYwZWExNjZiNDdmMDlhNWM3NTc4NTk0OGQ3NTJkZTEzODYyYWM2NjVh
14
- ZGY3MWM0MTRhOTQ5N2Q3MjM1YTVkZWU1MzVjOWQ1M2ZkZTg1MTljODdkYmYw
15
- OTZlMzY4MDQ5MWYzYWI0YmY4Nzg4NTQ0YTRmODhlOThmNDQ5Mjk=
13
+ NDcyN2UxYzNjMTNjMTYxOWFlZmE0MTQzZWY0YmQ4Zjk2MWEwMzYwZTQ4OTNj
14
+ MWM0MGYxNDA5ZDA3ZmQ4Nzg1YWNmMGM4OTNmZjNiNjI2YzRjN2E5MzRkMGZl
15
+ MzY0YTM1NTc3MDRiNzEyMjc5NjhlNjQ2MmE0YTY0ODVkNWJhMDM=
@@ -2,29 +2,43 @@ require "thor"
2
2
  require "ostruct"
3
3
  require "colorize"
4
4
 
5
+ require "bricky/requirements"
6
+ require "bricky/commands/base"
5
7
  require "bricky/commands/install"
6
8
  require "bricky/commands/builder"
7
9
  require "bricky/commands/bootstrap"
8
10
 
9
11
  module Bricky
10
12
  class Command < Thor
11
- desc :install, "copy configuration files"
13
+ desc :install, "install configuration files"
12
14
  def install
13
- command = Bricky::Commands::Install.new
14
- command.execute
15
+ dispatch(:install)
15
16
  end
16
17
 
17
- desc :bootstrap, "bootstrap project images"
18
+ desc :bootstrap, "bootstrap builder images"
18
19
  def bootstrap
19
- command = Bricky::Commands::Bootstrap.new
20
- command.execute
20
+ requirements.check_and_execute do
21
+ dispatch(:bootstrap)
22
+ end
21
23
  end
22
24
 
23
25
  desc :builder, "build project"
24
26
  method_option :shell, :type => :boolean, :aliases => "-s"
25
27
  def builder
26
- command = Bricky::Commands::Builder.new(options)
27
- command.execute
28
+ requirements.check_and_execute do
29
+ dispatch(:builder)
30
+ end
28
31
  end
32
+
33
+ private
34
+ def requirements
35
+ Bricky::Requirements.new
36
+ end
37
+
38
+ def dispatch(name)
39
+ clazz = Kernel.const_get("Bricky::Commands::#{name.to_s.capitalize}")
40
+ command = clazz.new(options)
41
+ command.execute
42
+ end
29
43
  end
30
44
  end
@@ -0,0 +1,13 @@
1
+ require "bricky/bricks"
2
+
3
+ module Bricky
4
+ module Commands
5
+ class Base
6
+ attr_accessor :options
7
+
8
+ def initialize(options)
9
+ @options = options
10
+ end
11
+ end
12
+ end
13
+ end
@@ -3,7 +3,7 @@ require "fileutils"
3
3
 
4
4
  module Bricky
5
5
  module Commands
6
- class Bootstrap
6
+ class Bootstrap < Base
7
7
  def execute
8
8
  puts "Boostraping images".colorize(:light_blue)
9
9
  images.each {|image| build(image)}
@@ -2,13 +2,7 @@ require "bricky/bricks"
2
2
 
3
3
  module Bricky
4
4
  module Commands
5
- class Builder
6
- attr_accessor :options
7
-
8
- def initialize(options)
9
- @options = options
10
- end
11
-
5
+ class Builder < Base
12
6
  def execute
13
7
  puts "Building Project".colorize(:light_blue)
14
8
  build(Bricky::Image.new("builder"))
@@ -1,16 +1,24 @@
1
1
  module Bricky
2
2
  module Commands
3
- class Install < Thor::Group
4
- include Thor::Actions
5
-
3
+ class Install < Base
6
4
  def execute
7
- puts "Setup bricky configuration files".colorize(:light_blue)
8
- directory "bricky"
9
- copy_file "Brickyfile"
10
- end
5
+ installer = InstallThor.new
6
+ installer.execute
7
+ end
8
+
9
+ # Inner class :( just to work with thor
10
+ class InstallThor < Thor::Group
11
+ include Thor::Actions
12
+
13
+ def execute
14
+ puts "Setup bricky configuration files".colorize(:light_blue)
15
+ directory "bricky"
16
+ copy_file "Brickyfile"
17
+ end
11
18
 
12
- def self.source_root
13
- File.expand_path("../../../../etc/templates", __FILE__)
19
+ def self.source_root
20
+ File.expand_path("../../../../etc/templates", __FILE__)
21
+ end
14
22
  end
15
23
  end
16
24
  end
@@ -0,0 +1,23 @@
1
+ module Bricky
2
+ class Requirements
3
+ def check_and_execute
4
+ if pending_requirements
5
+ print "Make sure you have the following requirements: "
6
+ puts requirements.join(',').colorize(:red)
7
+ else
8
+ yield
9
+ end
10
+ end
11
+
12
+ private
13
+ def requirements
14
+ ["docker"]
15
+ end
16
+
17
+ def pending_requirements
18
+ requirements.detect do |command|
19
+ not system("which #{command} > /dev/null 2>&1")
20
+ end
21
+ end
22
+ end
23
+ end
data/lib/bricky/setup.rb CHANGED
@@ -9,10 +9,13 @@ module Bricky
9
9
 
10
10
  private
11
11
  def self.from_brickyfile
12
- configuration = "#{Dir.pwd}/Brickyfile"
13
12
  if File.exists?(configuration)
14
13
  eval(open("#{Dir.pwd}/Brickyfile").read)
15
14
  end
16
15
  end
16
+
17
+ def self.configuration
18
+ "#{Dir.pwd}/Brickyfile"
19
+ end
17
20
  end
18
21
  end
@@ -1,3 +1,3 @@
1
1
  module Bricky
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bricky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - andrerocker
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.7.7
83
- description: lets rocks
83
+ description: a smart way to build software packages
84
84
  email:
85
85
  - andre.souza@gmail.com
86
86
  executables:
@@ -108,15 +108,16 @@ files:
108
108
  - lib/bricky/bricks/mounts.rb
109
109
  - lib/bricky/bricks/ruby.rb
110
110
  - lib/bricky/command.rb
111
+ - lib/bricky/commands/base.rb
111
112
  - lib/bricky/commands/bootstrap.rb
112
113
  - lib/bricky/commands/builder.rb
113
114
  - lib/bricky/commands/install.rb
114
115
  - lib/bricky/config.rb
115
116
  - lib/bricky/image.rb
116
- - lib/bricky/package.rb
117
+ - lib/bricky/requirements.rb
117
118
  - lib/bricky/setup.rb
118
119
  - lib/bricky/version.rb
119
- homepage: http://bricky.deploy42.com
120
+ homepage: http://github.com/andrerocker/bricky
120
121
  licenses:
121
122
  - MIT
122
123
  metadata: {}
@@ -139,5 +140,5 @@ rubyforge_project:
139
140
  rubygems_version: 2.4.4
140
141
  signing_key:
141
142
  specification_version: 4
142
- summary: a new way to build and package applications
143
+ summary: a smart way to build software packages
143
144
  test_files: []
@@ -1,21 +0,0 @@
1
- module Bricky
2
- class Package
3
- attr_accessor :image
4
-
5
- def initialize(image)
6
- self.image = image
7
- end
8
-
9
- project_path = File.expand_path(".")
10
- builded_path = File.expand_path(Bricky.config.package.build)
11
- cachedz_path = File.expand_path(Bricky.config.package.cache)
12
-
13
- def script
14
- "#{script_path}/#{image.name}"
15
- end
16
-
17
- def script_path
18
- "#{Bricky.config.full_scripts_path}/#{Bricky.config.package.output}"
19
- end
20
- end
21
- end