pixiebox 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +4 -0
- data/DOCKER_INFO.md +3 -0
- data/Gemfile +4 -0
- data/Guardfile +47 -0
- data/LICENSE.txt +21 -0
- data/README.md +146 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/pixiebox +5 -0
- data/bin/pixiebox_dev +10 -0
- data/bin/rake +17 -0
- data/bin/setup +8 -0
- data/lib/pixiebox.rb +88 -0
- data/lib/pixiebox/box.rb +31 -0
- data/lib/pixiebox/boxes/installer.rb +55 -0
- data/lib/pixiebox/boxes/manifest.rb +59 -0
- data/lib/pixiebox/cli.rb +214 -0
- data/lib/pixiebox/commands/add_box.rb +25 -0
- data/lib/pixiebox/commands/add_service.rb +27 -0
- data/lib/pixiebox/commands/build_service.rb +23 -0
- data/lib/pixiebox/commands/download_docker.rb +35 -0
- data/lib/pixiebox/commands/finish_install.rb +16 -0
- data/lib/pixiebox/commands/finish_uninstall.rb +14 -0
- data/lib/pixiebox/commands/get_root_permission.rb +14 -0
- data/lib/pixiebox/commands/initialize_project.rb +32 -0
- data/lib/pixiebox/commands/install_config.rb +17 -0
- data/lib/pixiebox/commands/install_docker.rb +55 -0
- data/lib/pixiebox/commands/list_boxes.rb +16 -0
- data/lib/pixiebox/commands/list_services.rb +16 -0
- data/lib/pixiebox/commands/reload_shell.rb +15 -0
- data/lib/pixiebox/commands/remove_service.rb +27 -0
- data/lib/pixiebox/commands/remove_setup_shell.rb +19 -0
- data/lib/pixiebox/commands/restart.rb +21 -0
- data/lib/pixiebox/commands/setup_shell.rb +18 -0
- data/lib/pixiebox/commands/ssh_instance.rb +27 -0
- data/lib/pixiebox/commands/start.rb +20 -0
- data/lib/pixiebox/commands/start_install.rb +14 -0
- data/lib/pixiebox/commands/start_uninstall.rb +16 -0
- data/lib/pixiebox/commands/stop.rb +20 -0
- data/lib/pixiebox/commands/update_packages.rb +46 -0
- data/lib/pixiebox/constants.rb +26 -0
- data/lib/pixiebox/dns.rb +8 -0
- data/lib/pixiebox/docker_compose/config.rb +59 -0
- data/lib/pixiebox/errors/pixiebox_error.rb +17 -0
- data/lib/pixiebox/handlers/stdout_handler.rb +179 -0
- data/lib/pixiebox/os/abstract.rb +40 -0
- data/lib/pixiebox/os/current_os.rb +15 -0
- data/lib/pixiebox/os/darwin.rb +20 -0
- data/lib/pixiebox/os/distro.rb +45 -0
- data/lib/pixiebox/os/linux.rb +21 -0
- data/lib/pixiebox/os/unsupported_os.rb +9 -0
- data/lib/pixiebox/project.rb +19 -0
- data/lib/pixiebox/service.rb +50 -0
- data/lib/pixiebox/services/installer.rb +41 -0
- data/lib/pixiebox/services/manifest.rb +50 -0
- data/lib/pixiebox/shell/bash.rb +18 -0
- data/lib/pixiebox/shell/ini_file.rb +38 -0
- data/lib/pixiebox/shell/startup_script.rb +53 -0
- data/lib/pixiebox/shell/zsh.rb +9 -0
- data/lib/pixiebox/system.rb +69 -0
- data/lib/pixiebox/utils/domain_event_publisher.rb +11 -0
- data/lib/pixiebox/utils/output.rb +105 -0
- data/lib/pixiebox/utils/packages.rb +35 -0
- data/lib/pixiebox/utils/progress_bar.rb +31 -0
- data/lib/pixiebox/utils/project.rb +55 -0
- data/lib/pixiebox/utils/shell.rb +18 -0
- data/lib/pixiebox/utils/spinner.rb +27 -0
- data/lib/pixiebox/utils/visitable.rb +9 -0
- data/lib/pixiebox/utils/visitor_by_os.rb +32 -0
- data/lib/runner.rb +51 -0
- data/pixiebox.gemspec +52 -0
- metadata +424 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c8ec2cf4f639eef7b57cbc64156e9e2310a29171b44890a2e5f16cffb5e4b6c5
|
4
|
+
data.tar.gz: e229f862f47036b0b56d3721f6a22ae33aa7604eae4394fe91472a95dcfdec60
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 76403ef14f5ac7b32b20d734dba25076919f7824f0288389770dcb4b888d2fe82b0c544a60b6d6b0425792ca6eebaac86bc38e8558989a17299f54472dfbdcfd
|
7
|
+
data.tar.gz: eddf35adaa7daf840fe1bda896c3e3f8e46dbdc6a21e8e13e489fa488e9f1c5a066316897eb8b97a76a24f6a9b4e3fc789cab18cfb28bd227591675cb0b8e101
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/DOCKER_INFO.md
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
group :acceptance do
|
2
|
+
guard :rspec, cmd: 'bundle exec rspec --tag "acceptance"' do
|
3
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
4
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
5
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
group :wip do
|
12
|
+
guard :rspec, cmd: 'bundle exec rspec --tag "wip"' do
|
13
|
+
#watch(%r{^spec/acceptance/(.+)\.feature$})
|
14
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
15
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
group :rspec do
|
21
|
+
guard :rspec, cmd: 'bundle exec rspec --tag ~"acceptance"' do
|
22
|
+
require "guard/rspec/dsl"
|
23
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
24
|
+
|
25
|
+
# Feel free to open issues for suggestions and improvements
|
26
|
+
|
27
|
+
# RSpec files
|
28
|
+
rspec = dsl.rspec
|
29
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
30
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
31
|
+
watch(rspec.spec_files)
|
32
|
+
|
33
|
+
# Ruby files
|
34
|
+
ruby = dsl.ruby
|
35
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
36
|
+
|
37
|
+
|
38
|
+
watch(%r{^lib/(.+).rb$}) do |m|
|
39
|
+
"spec/#{m[1]}_spec.rb"
|
40
|
+
end
|
41
|
+
|
42
|
+
watch(%r{^spec/(.+).rb$}) do |m|
|
43
|
+
"spec/#{m[1]}.rb"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
# Pixiebox
|
2
|
+
|
3
|
+
Docker development simplified.
|
4
|
+
|
5
|
+
Start pixiebox and continue with the way you have always done things, except
|
6
|
+
now, isolated inside containers
|
7
|
+
|
8
|
+
|
9
|
+
## Install CLI
|
10
|
+
|
11
|
+
|
12
|
+
```bash
|
13
|
+
$ gem install pixiebox
|
14
|
+
$ pixiebox install
|
15
|
+
```
|
16
|
+
|
17
|
+
That's it your done
|
18
|
+
|
19
|
+
**Available boxes**
|
20
|
+
|
21
|
+
elixir
|
22
|
+
nodejs
|
23
|
+
python
|
24
|
+
rails
|
25
|
+
ruby
|
26
|
+
|
27
|
+
**Create rails box**
|
28
|
+
|
29
|
+
```bash
|
30
|
+
$ mkdir -p Code/rails
|
31
|
+
$ cd Code/rails
|
32
|
+
$ pixiebox init rails
|
33
|
+
```
|
34
|
+
|
35
|
+
Your box is up and running, use your container-ized rails as you would normally
|
36
|
+
|
37
|
+
**Create a rails project**
|
38
|
+
```bash
|
39
|
+
$ pb-gem install rails --no-ri --no-rdoc
|
40
|
+
$ pb-rails new .
|
41
|
+
$ pb-rails c
|
42
|
+
$ pb-rake -T
|
43
|
+
$ pb-rails s
|
44
|
+
```
|
45
|
+
|
46
|
+
**Install gems, irb, bundler and more**
|
47
|
+
```bash
|
48
|
+
$ pb-gem install rails --no-ri --no-rdoc
|
49
|
+
$ pb-irb
|
50
|
+
$ pb-bundle install
|
51
|
+
$ pb-ruby
|
52
|
+
```
|
53
|
+
|
54
|
+
Everything is running inside your box !
|
55
|
+
Commands are namespaced to avoid conflict with already existing tools in your
|
56
|
+
environment.
|
57
|
+
|
58
|
+
## Detailed Usage
|
59
|
+
|
60
|
+
```bash
|
61
|
+
Commands:
|
62
|
+
pixiebox boxes # list of available boxes
|
63
|
+
pixiebox help [COMMAND] # Describe available commands or one specific command
|
64
|
+
pixiebox init [BOX] # initialize directory for use with pixiebox
|
65
|
+
pixiebox install # installs pixiebox
|
66
|
+
pixiebox reset # reset pixiebox containers
|
67
|
+
pixiebox restart # restart pixiebox
|
68
|
+
pixiebox service SUBCOMMAND # do things with the SERVICES
|
69
|
+
pixiebox ssh [SERVICE] # open shell to service
|
70
|
+
pixiebox start # start pixiebox
|
71
|
+
pixiebox status # current status of containers
|
72
|
+
pixiebox stop # stop pixiebox
|
73
|
+
pixiebox uninstall # removes pixiebox
|
74
|
+
pixiebox update # udpates pixiebox
|
75
|
+
pixiebox version # displays current version
|
76
|
+
|
77
|
+
Commands:
|
78
|
+
pixiebox service add [SERVICE] # adds a service to your box
|
79
|
+
pixiebox service build [SERVICE] optional # builds the pixiebox
|
80
|
+
pixiebox service help [COMMAND] # Describe subcommands or one specific subcommand
|
81
|
+
pixiebox service list # list available services
|
82
|
+
pixiebox service remove [SERVICE] # removes a service from your box
|
83
|
+
|
84
|
+
Options:
|
85
|
+
[--verbose], [--no-verbose] # Verbose debugging output
|
86
|
+
```
|
87
|
+
|
88
|
+
### Dependencies
|
89
|
+
**Linux**
|
90
|
+
|
91
|
+
* build-essential
|
92
|
+
* ruby
|
93
|
+
* ruby-dev
|
94
|
+
|
95
|
+
|
96
|
+
## Development
|
97
|
+
|
98
|
+
To run the tests you'll need ruby ^2.3 since we are using the <<~EOS operator (un-indented multiline strings)
|
99
|
+
|
100
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
101
|
+
|
102
|
+
To use without installing, use:
|
103
|
+
|
104
|
+
```bash
|
105
|
+
$ bin/pixiebox_dev version
|
106
|
+
```
|
107
|
+
|
108
|
+
To run tests:
|
109
|
+
|
110
|
+
```bash
|
111
|
+
$ bundle exec guard -g rspec
|
112
|
+
$ bundle exec guard -g acceptance
|
113
|
+
$ bundle exec guard -g wip
|
114
|
+
```
|
115
|
+
|
116
|
+
|
117
|
+
To install locally:
|
118
|
+
|
119
|
+
```bash
|
120
|
+
$ rake build
|
121
|
+
$ gem install pkg/pixiebox-x.x.x.gem
|
122
|
+
```
|
123
|
+
|
124
|
+
### Helpful stuff
|
125
|
+
|
126
|
+
**debug during an aruba test run**
|
127
|
+
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
export REMOTE_DEBUG=true
|
131
|
+
guard -g wip
|
132
|
+
```
|
133
|
+
then connect using:
|
134
|
+
```bash
|
135
|
+
$ bundle exec byebug -R localhost:8989
|
136
|
+
```
|
137
|
+
|
138
|
+
**will show that last command aruba executed**
|
139
|
+
```ruby
|
140
|
+
(byebug) last_command_started
|
141
|
+
```
|
142
|
+
|
143
|
+
## License
|
144
|
+
|
145
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
146
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "pixiebox"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/pixiebox
ADDED
data/bin/pixiebox_dev
ADDED
data/bin/rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby2.4
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rake' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/setup
ADDED
data/lib/pixiebox.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'ruby-progressbar'
|
3
|
+
require 'wisper'
|
4
|
+
require 'open-uri'
|
5
|
+
require 'uri'
|
6
|
+
require 'tty-file'
|
7
|
+
require 'tty-command'
|
8
|
+
require 'tty-platform'
|
9
|
+
require 'tty-which'
|
10
|
+
require 'tty-spinner'
|
11
|
+
require 'ostruct'
|
12
|
+
require 'yaml'
|
13
|
+
require 'inifile'
|
14
|
+
require 'pathname'
|
15
|
+
require 'json'
|
16
|
+
|
17
|
+
require 'pixiebox/utils/progress_bar'
|
18
|
+
require 'pixiebox/utils/spinner'
|
19
|
+
require 'pixiebox/utils/project'
|
20
|
+
require 'pixiebox/utils/visitable'
|
21
|
+
require 'pixiebox/utils/domain_event_publisher'
|
22
|
+
require 'pixiebox/utils/visitor_by_os'
|
23
|
+
require 'pixiebox/utils/output'
|
24
|
+
require 'pixiebox/utils/shell'
|
25
|
+
require 'pixiebox/utils/packages'
|
26
|
+
|
27
|
+
require 'pixiebox/docker_compose/config'
|
28
|
+
|
29
|
+
require 'pixiebox/errors/pixiebox_error'
|
30
|
+
|
31
|
+
require 'pixiebox/handlers/stdout_handler'
|
32
|
+
|
33
|
+
require 'pixiebox/commands/download_docker'
|
34
|
+
require 'pixiebox/commands/install_docker'
|
35
|
+
require 'pixiebox/commands/setup_shell'
|
36
|
+
require 'pixiebox/commands/remove_setup_shell'
|
37
|
+
require 'pixiebox/commands/start_install'
|
38
|
+
require 'pixiebox/commands/build_service'
|
39
|
+
require 'pixiebox/commands/start_uninstall'
|
40
|
+
require 'pixiebox/commands/finish_install'
|
41
|
+
require 'pixiebox/commands/finish_uninstall'
|
42
|
+
require 'pixiebox/commands/initialize_project'
|
43
|
+
require 'pixiebox/commands/add_box'
|
44
|
+
require 'pixiebox/commands/list_boxes'
|
45
|
+
require 'pixiebox/commands/list_services'
|
46
|
+
require 'pixiebox/commands/add_service'
|
47
|
+
require 'pixiebox/commands/remove_service'
|
48
|
+
require 'pixiebox/commands/start'
|
49
|
+
require 'pixiebox/commands/stop'
|
50
|
+
require 'pixiebox/commands/restart'
|
51
|
+
require 'pixiebox/commands/ssh_instance'
|
52
|
+
require 'pixiebox/commands/reload_shell'
|
53
|
+
require 'pixiebox/commands/get_root_permission'
|
54
|
+
require 'pixiebox/commands/update_packages'
|
55
|
+
require 'pixiebox/commands/install_config'
|
56
|
+
|
57
|
+
require 'pixiebox/boxes/manifest'
|
58
|
+
require 'pixiebox/boxes/installer'
|
59
|
+
|
60
|
+
require 'pixiebox/services/manifest'
|
61
|
+
require 'pixiebox/services/installer'
|
62
|
+
|
63
|
+
require 'pixiebox/os/abstract'
|
64
|
+
require 'pixiebox/os/darwin'
|
65
|
+
require 'pixiebox/os/linux'
|
66
|
+
require 'pixiebox/os/unsupported_os'
|
67
|
+
require 'pixiebox/os/current_os'
|
68
|
+
require 'pixiebox/os/distro'
|
69
|
+
|
70
|
+
require 'pixiebox/shell/startup_script'
|
71
|
+
require 'pixiebox/shell/zsh'
|
72
|
+
require 'pixiebox/shell/bash'
|
73
|
+
require 'pixiebox/shell/ini_file'
|
74
|
+
|
75
|
+
require 'pixiebox/constants'
|
76
|
+
require 'pixiebox/cli'
|
77
|
+
require 'pixiebox/system'
|
78
|
+
require 'pixiebox/project'
|
79
|
+
require 'pixiebox/box'
|
80
|
+
require 'pixiebox/service'
|
81
|
+
|
82
|
+
Wisper.subscribe(
|
83
|
+
Pixiebox::Handlers::StdoutHandler.new,
|
84
|
+
scope: Pixiebox::Utils::DomainEventPublisher
|
85
|
+
)
|
86
|
+
|
87
|
+
Pixiebox.set_verbosity(true)
|
88
|
+
|
data/lib/pixiebox/box.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
module Pixiebox
|
2
|
+
class Box
|
3
|
+
include Utils::Visitable
|
4
|
+
include Utils::Output
|
5
|
+
|
6
|
+
attr_reader :os
|
7
|
+
|
8
|
+
def initialize(os)
|
9
|
+
@os = os
|
10
|
+
end
|
11
|
+
|
12
|
+
def install(type = nil)
|
13
|
+
return if type.nil?
|
14
|
+
accept(Commands::AddBox.new(type))
|
15
|
+
rescue Errors::BoxNotImplemented
|
16
|
+
display_box_not_available type
|
17
|
+
list # called like for exception handling
|
18
|
+
rescue StandardError => e
|
19
|
+
display_error e
|
20
|
+
exit 1
|
21
|
+
end
|
22
|
+
|
23
|
+
def list()
|
24
|
+
accept(Commands::UpdatePackages.new)
|
25
|
+
accept(Commands::ListBoxes.new)
|
26
|
+
rescue StandardError => e
|
27
|
+
display_error e
|
28
|
+
exit 1
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|