picobox 0.3.2 → 0.3.4
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 +4 -4
- data/README.md +51 -25
- data/lib/picobox/box.rb +2 -8
- data/lib/picobox/cli.rb +0 -7
- data/lib/picobox/commands/start.rb +2 -1
- data/lib/picobox/commands/stop.rb +1 -1
- data/lib/picobox/commands/update_packages.rb +20 -4
- data/lib/picobox/constants.rb +1 -1
- data/lib/picobox/errors/picobox_error.rb +1 -0
- data/lib/picobox/project.rb +1 -4
- data/lib/picobox/service.rb +4 -22
- data/lib/picobox/shell/startup_script.rb +3 -3
- data/lib/picobox/system.rb +6 -30
- data/lib/picobox/utils/output.rb +30 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ded8cb446fb955057bf0fccbe10101bc727513e4
|
4
|
+
data.tar.gz: aa79bcdb1461b5591d9ed9cc7261096cca0ca213
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d467ece912eaac8bec1dbde2db545d007eee5af20311221dedba388f907839c149a7e52fc170a32b07bfec59fbb6375aeb90d9cec87b24d30404ecaf405c7fe
|
7
|
+
data.tar.gz: 5abd04e59a4a2e0c41d76ca327920d82880c9f232ada5d5633831a90a8e89341d3e871e308a563650e81c39b4a2bc5d84fd944169919cbb227f66b436bbe8bbd
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# Picobox
|
2
2
|
|
3
|
-
Docker development environment for humans.
|
3
|
+
Docker development environment for humans.
|
4
4
|
|
5
5
|
Don't want to learn a whole -bunch --of -commands_with_flags/just -to run_rails || other_things?
|
6
6
|
|
7
7
|
Start picobox and continue with the way you have always done things, except now, isolated inside containers
|
8
8
|
|
9
|
-
*Early release, caution, there be dragons...*
|
10
9
|
|
11
|
-
##
|
10
|
+
## Install CLI
|
11
|
+
|
12
12
|
|
13
13
|
```bash
|
14
14
|
$ gem install picobox
|
@@ -17,14 +17,13 @@ $ picobox install
|
|
17
17
|
|
18
18
|
That's it your done
|
19
19
|
|
20
|
+
**Available boxes**
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Now you are really done
|
22
|
+
elixir
|
23
|
+
nodejs
|
24
|
+
python
|
25
|
+
rails
|
26
|
+
ruby
|
28
27
|
|
29
28
|
|
30
29
|
## Usage
|
@@ -32,14 +31,12 @@ Now you are really done
|
|
32
31
|

|
33
32
|
(may take a sec to load)
|
34
33
|
|
35
|
-
**Create box**
|
34
|
+
**Create rails box**
|
36
35
|
|
37
36
|
```bash
|
38
37
|
$ mkdir -p Code/rails
|
39
38
|
$ cd Code/rails
|
40
39
|
$ picobox init rails
|
41
|
-
$ picobox build
|
42
|
-
$ picobox start
|
43
40
|
```
|
44
41
|
|
45
42
|
Your box is up and running, use your container-ized rails as you would normally
|
@@ -53,7 +50,7 @@ $ rake -T
|
|
53
50
|
$ rails s
|
54
51
|
```
|
55
52
|
|
56
|
-
**
|
53
|
+
**Install gems, irb, bundler and more**
|
57
54
|
```bash
|
58
55
|
$ gem install rails --no-ri --no-rdoc
|
59
56
|
$ irb
|
@@ -63,13 +60,45 @@ $ ruby
|
|
63
60
|
|
64
61
|
Everything is running inside your box transparently !
|
65
62
|
|
66
|
-
## Dependencies
|
67
63
|
|
68
|
-
|
64
|
+
## Detailed Usage
|
65
|
+
|
66
|
+
```bash
|
67
|
+
Commands:
|
68
|
+
picobox boxes # list of available boxes
|
69
|
+
picobox help [COMMAND] # Describe available commands or one specific command
|
70
|
+
picobox init [BOX] # initialize directory for use with picobox
|
71
|
+
picobox install # installs picobox
|
72
|
+
picobox reset # reset picobox containers
|
73
|
+
picobox restart # restart picobox
|
74
|
+
picobox service SUBCOMMAND # do things with the SERVICES
|
75
|
+
picobox ssh [SERVICE] # open shell to service
|
76
|
+
picobox start # start picobox
|
77
|
+
picobox status # current status of containers
|
78
|
+
picobox stop # stop picobox
|
79
|
+
picobox uninstall # removes picobox
|
80
|
+
picobox update # udpates picobox
|
81
|
+
picobox version # displays current version
|
82
|
+
|
83
|
+
Commands:
|
84
|
+
picobox service add [SERVICE] # adds a service to your box
|
85
|
+
picobox service build [SERVICE] optional # builds the picobox
|
86
|
+
picobox service help [COMMAND] # Describe subcommands or one specific subcommand
|
87
|
+
picobox service list # list available services
|
88
|
+
picobox service remove [SERVICE] # removes a service from your box
|
89
|
+
|
90
|
+
Options:
|
91
|
+
[--verbose], [--no-verbose] # Verbose debugging output
|
92
|
+
```
|
93
|
+
|
94
|
+
### Dependencies
|
95
|
+
**Linux**
|
96
|
+
|
69
97
|
* build-essential
|
70
98
|
* ruby
|
71
99
|
* ruby-dev
|
72
100
|
|
101
|
+
|
73
102
|
## Development
|
74
103
|
|
75
104
|
To run the tests you'll need ruby 2.3 since we are using the <<~EOS operator (un-indented multiline strings)
|
@@ -79,7 +108,7 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
79
108
|
To use without installing, use:
|
80
109
|
|
81
110
|
```bash
|
82
|
-
$ bin/
|
111
|
+
$ bin/picobox_dev version
|
83
112
|
```
|
84
113
|
|
85
114
|
To run tests:
|
@@ -98,9 +127,10 @@ $ rake build
|
|
98
127
|
$ gem install pkg/picobox-x.x.x.gem
|
99
128
|
```
|
100
129
|
|
101
|
-
|
130
|
+
### Helpful stuff
|
102
131
|
|
103
132
|
**debug during an aruba test run**
|
133
|
+
|
104
134
|
spec/support/aruba.rb
|
105
135
|
```ruby
|
106
136
|
require 'byebug/core'
|
@@ -117,19 +147,15 @@ $ bundle exec byebug -R localhost:8989
|
|
117
147
|
(byebug) last_command_started
|
118
148
|
```
|
119
149
|
|
120
|
-
|
121
|
-
|
122
|
-
## TODO
|
150
|
+
### TODO
|
151
|
+
- [ ] Install runtime dependecies on linux during setup
|
123
152
|
- [ ] Documentation (both in code and wiki)
|
124
153
|
- [ ] Include aliases specific to the box when unpacking (maybe)
|
125
|
-
- [ ] Add more boxes
|
126
154
|
- [ ] Add destroy command
|
127
|
-
- [ ]
|
155
|
+
- [ ] Explore Habitus API web server to add ssh keys to containers**
|
128
156
|
- [ ] Use traefik.io for dns
|
129
157
|
- [ ] Uninstall should stop and remove all instances that are running
|
130
|
-
- [ ] Block most commands if picobox not installed
|
131
158
|
- [ ] Some services should install thier own volumes
|
132
|
-
- [ ] Box update function
|
133
159
|
- [ ] Remove TTY::File, TTY::Prompt dependency (needs native extensions)
|
134
160
|
|
135
161
|
**http://blog.cloud66.com/using-ssh-private-keys-securely-in-docker-build/
|
data/lib/picobox/box.rb
CHANGED
@@ -15,22 +15,16 @@ module Picobox
|
|
15
15
|
rescue Errors::BoxNotImplemented
|
16
16
|
display_box_not_available type
|
17
17
|
list # called like for exception handling
|
18
|
-
rescue Errors::ProjectNotInitialized
|
19
|
-
display_project_not_initialized
|
20
|
-
exit 1
|
21
18
|
rescue StandardError => e
|
22
|
-
|
19
|
+
display_error e
|
23
20
|
exit 1
|
24
21
|
end
|
25
22
|
|
26
23
|
def list()
|
27
24
|
accept(Commands::UpdatePackages.new)
|
28
25
|
accept(Commands::ListBoxes.new)
|
29
|
-
rescue Errors::PicoboxNotInstalled
|
30
|
-
display_picobox_not_installed
|
31
|
-
exit 1
|
32
26
|
rescue StandardError => e
|
33
|
-
|
27
|
+
display_error e
|
34
28
|
exit 1
|
35
29
|
end
|
36
30
|
end
|
data/lib/picobox/cli.rb
CHANGED
@@ -77,7 +77,6 @@ module Picobox
|
|
77
77
|
def version
|
78
78
|
say "Picobox: #{Picobox::VERSION}"
|
79
79
|
say "Packages: #{Picobox::Utils::Packages.new(Os::CurrentOs.get).installed_version[1..-1]}"
|
80
|
-
|
81
80
|
rescue SignalException
|
82
81
|
exit 1
|
83
82
|
end
|
@@ -88,7 +87,6 @@ module Picobox
|
|
88
87
|
LONGDESC
|
89
88
|
def install
|
90
89
|
Picobox.set_verbosity options[:verbose]
|
91
|
-
|
92
90
|
System.new(Os::CurrentOs.get).install
|
93
91
|
rescue SignalException
|
94
92
|
exit 1
|
@@ -100,7 +98,6 @@ module Picobox
|
|
100
98
|
LONGDESC
|
101
99
|
def update
|
102
100
|
Picobox.set_verbosity options[:verbose]
|
103
|
-
|
104
101
|
System.new(Os::CurrentOs.get).install
|
105
102
|
rescue SignalException
|
106
103
|
exit 1
|
@@ -112,7 +109,6 @@ module Picobox
|
|
112
109
|
LONGDESC
|
113
110
|
def uninstall
|
114
111
|
Picobox.set_verbosity options[:verbose]
|
115
|
-
|
116
112
|
System.new(Os::CurrentOs.get).uninstall
|
117
113
|
rescue SignalException
|
118
114
|
exit 1
|
@@ -141,7 +137,6 @@ module Picobox
|
|
141
137
|
LONGDESC
|
142
138
|
def start()
|
143
139
|
Picobox.set_verbosity options[:verbose]
|
144
|
-
|
145
140
|
System.new(Os::CurrentOs.get).start
|
146
141
|
rescue SignalException
|
147
142
|
exit 1
|
@@ -153,7 +148,6 @@ module Picobox
|
|
153
148
|
LONGDESC
|
154
149
|
def stop()
|
155
150
|
Picobox.set_verbosity options[:verbose]
|
156
|
-
|
157
151
|
System.new(Os::CurrentOs.get).stop
|
158
152
|
rescue SignalException
|
159
153
|
exit 1
|
@@ -165,7 +159,6 @@ module Picobox
|
|
165
159
|
LONGDESC
|
166
160
|
def restart()
|
167
161
|
Picobox.set_verbosity options[:verbose]
|
168
|
-
|
169
162
|
System.new(Os::CurrentOs.get).restart
|
170
163
|
rescue SignalException
|
171
164
|
exit 1
|
@@ -11,9 +11,9 @@ module Picobox
|
|
11
11
|
|
12
12
|
filename = packages.download
|
13
13
|
|
14
|
-
system("
|
15
|
-
system("
|
16
|
-
system("
|
14
|
+
system("rm -rf #{Picobox.packages_dir}")
|
15
|
+
system("mkdir #{Picobox.packages_dir}")
|
16
|
+
system("tar xvf #{filename} -C #{Picobox.packages_dir} --strip-components=1 #{Picobox.output}")
|
17
17
|
|
18
18
|
Shell::IniFile.get(os)[:packages] = { version: packages.current_version, last_update: Time.now.to_i }
|
19
19
|
|
@@ -23,7 +23,23 @@ module Picobox
|
|
23
23
|
|
24
24
|
|
25
25
|
def visit_linux subject
|
26
|
-
|
26
|
+
raise Errors::PicoboxNotInstalled unless os.picobox_installed?
|
27
|
+
|
28
|
+
packages = Utils::Packages.new(os)
|
29
|
+
|
30
|
+
if packages.update?
|
31
|
+
publish_event :update_packages_start
|
32
|
+
|
33
|
+
filename = packages.download
|
34
|
+
|
35
|
+
system("sudo rm -rf #{Picobox.packages_dir}")
|
36
|
+
system("sudo mkdir #{Picobox.packages_dir}")
|
37
|
+
system("sudo tar xvf #{filename} -C #{Picobox.packages_dir} --strip-components=1 #{Picobox.output}")
|
38
|
+
|
39
|
+
Shell::IniFile.get(os)[:packages] = { version: packages.current_version, last_update: Time.now.to_i }
|
40
|
+
|
41
|
+
publish_event :update_packages_stop
|
42
|
+
end
|
27
43
|
end
|
28
44
|
end
|
29
45
|
end
|
data/lib/picobox/constants.rb
CHANGED
data/lib/picobox/project.rb
CHANGED
@@ -11,11 +11,8 @@ module Picobox
|
|
11
11
|
|
12
12
|
def init
|
13
13
|
accept(Commands::InitializeProject.new)
|
14
|
-
rescue Errors::PicoboxNotInstalled
|
15
|
-
display_picobox_not_installed
|
16
|
-
exit 1
|
17
14
|
rescue StandardError => e
|
18
|
-
|
15
|
+
display_error e
|
19
16
|
exit 1
|
20
17
|
end
|
21
18
|
end
|
data/lib/picobox/service.rb
CHANGED
@@ -12,24 +12,15 @@ module Picobox
|
|
12
12
|
def build(service=nil)
|
13
13
|
accept(Commands::BuildService.new(service))
|
14
14
|
rescue StandardError => e
|
15
|
-
|
15
|
+
display_error e
|
16
16
|
exit 1
|
17
17
|
end
|
18
18
|
|
19
19
|
def add(services)
|
20
20
|
services.each { |service| accept(Commands::AddService.new(service)) }
|
21
21
|
accept(Commands::Restart.new)
|
22
|
-
rescue Errors::ServiceNotImplemented => e
|
23
|
-
display_service_not_available e.message
|
24
|
-
exit 1
|
25
|
-
rescue Errors::ProjectNotInitialized
|
26
|
-
display_project_not_initialized
|
27
|
-
exit 1
|
28
|
-
rescue Picobox::Errors::FileNotFoundError => e
|
29
|
-
display_file_not_found e.message
|
30
|
-
exit 1
|
31
22
|
rescue StandardError => e
|
32
|
-
|
23
|
+
display_error e
|
33
24
|
exit 1
|
34
25
|
end
|
35
26
|
|
@@ -42,14 +33,8 @@ module Picobox
|
|
42
33
|
display_service_not_installed type
|
43
34
|
rescue Errors::ServiceNotImplemented
|
44
35
|
display_service_not_available type
|
45
|
-
rescue Errors::ProjectNotInitialized
|
46
|
-
display_project_not_initialized
|
47
|
-
exit 1
|
48
|
-
rescue Picobox::Errors::FileNotFoundError => e
|
49
|
-
display_file_not_found e.message
|
50
|
-
exit
|
51
36
|
rescue StandardError => e
|
52
|
-
|
37
|
+
display_error e
|
53
38
|
exit 1
|
54
39
|
end
|
55
40
|
|
@@ -57,11 +42,8 @@ module Picobox
|
|
57
42
|
def list()
|
58
43
|
accept(Commands::UpdatePackages.new)
|
59
44
|
accept(Commands::ListServices.new)
|
60
|
-
rescue Errors::PicoboxNotInstalled
|
61
|
-
display_picobox_not_installed
|
62
|
-
exit 1
|
63
45
|
rescue StandardError => e
|
64
|
-
|
46
|
+
display_error e
|
65
47
|
exit 1
|
66
48
|
end
|
67
49
|
end
|
@@ -4,11 +4,11 @@ module Picobox
|
|
4
4
|
class << self
|
5
5
|
def get(os)
|
6
6
|
case "#{os.user_shell}:#{os.to_s}"
|
7
|
-
when
|
7
|
+
when /\/bin\/bash:darwin/
|
8
8
|
Shell::DotProfile.new(os)
|
9
|
-
when
|
9
|
+
when /\/bin\/zsh:darwin/, /\/bin\/zsh:linux/
|
10
10
|
Shell::DotZshRC.new(os)
|
11
|
-
when
|
11
|
+
when /\/bin\/bash:linux/
|
12
12
|
Shell::DotBashRC.new(os)
|
13
13
|
else
|
14
14
|
raise Errors::ShellNotSupported, "#{os.user_shell}:#{os.to_s}"
|
data/lib/picobox/system.rb
CHANGED
@@ -19,14 +19,8 @@ module Picobox
|
|
19
19
|
accept(Commands::SetupShell.new)
|
20
20
|
accept(Commands::FinishInstall.new)
|
21
21
|
accept(Commands::ReloadShell.new)
|
22
|
-
rescue Errors::ShellNotSupported => e
|
23
|
-
display_shell_not_supported e.message
|
24
|
-
exit 1
|
25
|
-
rescue Errors::DistroNotSupported => e
|
26
|
-
display_distro_not_supported
|
27
|
-
exit 1
|
28
22
|
rescue StandardError => e
|
29
|
-
|
23
|
+
display_error e
|
30
24
|
exit 1
|
31
25
|
end
|
32
26
|
|
@@ -35,58 +29,40 @@ module Picobox
|
|
35
29
|
accept(Commands::StartUninstall.new)
|
36
30
|
accept(Commands::RemoveSetupShell.new)
|
37
31
|
accept(Commands::FinishUninstall.new)
|
38
|
-
rescue Errors::PicoboxNotInstalled
|
39
|
-
display_picobox_not_installed
|
40
|
-
exit 1
|
41
32
|
rescue StandardError => e
|
42
|
-
|
33
|
+
display_error e
|
43
34
|
exit 1
|
44
35
|
end
|
45
36
|
|
46
37
|
|
47
38
|
def start
|
48
39
|
accept(Commands::Start.new)
|
49
|
-
rescue Errors::ProjectNotInitialized
|
50
|
-
display_project_not_initialized
|
51
|
-
exit 1
|
52
40
|
rescue StandardError => e
|
53
|
-
|
41
|
+
display_error e
|
54
42
|
exit 1
|
55
43
|
end
|
56
44
|
|
57
45
|
|
58
46
|
def stop
|
59
47
|
accept(Commands::Stop.new)
|
60
|
-
rescue Errors::ProjectNotInitialized
|
61
|
-
display_project_not_initialized
|
62
|
-
exit 1
|
63
48
|
rescue StandardError => e
|
64
|
-
|
49
|
+
display_error e
|
65
50
|
exit 1
|
66
51
|
end
|
67
52
|
|
68
53
|
|
69
54
|
def restart
|
70
55
|
accept(Commands::Restart.new)
|
71
|
-
rescue Errors::ProjectNotInitialized
|
72
|
-
display_project_not_initialized
|
73
|
-
exit 1
|
74
56
|
rescue StandardError => e
|
75
|
-
|
57
|
+
display_error e
|
76
58
|
exit 1
|
77
59
|
end
|
78
60
|
|
79
61
|
|
80
62
|
def ssh(service)
|
81
63
|
accept(Commands::SshInstance.new(service))
|
82
|
-
rescue Errors::SystemDownError
|
83
|
-
display_system_down
|
84
|
-
exit 1
|
85
|
-
rescue Errors::ProjectNotInitialized
|
86
|
-
display_project_not_initialized
|
87
|
-
exit 1
|
88
64
|
rescue StandardError => e
|
89
|
-
|
65
|
+
display_error e
|
90
66
|
exit 1
|
91
67
|
end
|
92
68
|
end
|
data/lib/picobox/utils/output.rb
CHANGED
@@ -17,6 +17,30 @@ module Picobox
|
|
17
17
|
end
|
18
18
|
|
19
19
|
|
20
|
+
def display_error(e)
|
21
|
+
case e
|
22
|
+
when Errors::ProjectNotInitialized
|
23
|
+
display_project_not_initialized
|
24
|
+
when Errors::DockerError
|
25
|
+
display_docker_error
|
26
|
+
when Errors::SystemDownError
|
27
|
+
display_system_down
|
28
|
+
when Errors::ShellNotSupported
|
29
|
+
display_shell_not_supported e.message
|
30
|
+
when Errors::DistroNotSupported
|
31
|
+
display_distro_not_supported
|
32
|
+
when Errors::PicoboxNotInstalled
|
33
|
+
display_picobox_not_installed
|
34
|
+
when Errors::ServiceNotImplemented
|
35
|
+
display_service_not_available e.message
|
36
|
+
when Picobox::Errors::FileNotFoundError
|
37
|
+
display_file_not_found e.message
|
38
|
+
else
|
39
|
+
display_info(e, :red)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
20
44
|
def display_project_not_initialized
|
21
45
|
display_status('error', 'no project found', :red)
|
22
46
|
display_info("Run 'picobox init [BOX]'", :yellow)
|
@@ -66,6 +90,12 @@ module Picobox
|
|
66
90
|
display_info('distro is not yet supported :(', :red)
|
67
91
|
end
|
68
92
|
|
93
|
+
def display_docker_error
|
94
|
+
display_info "Docker gave an error", :red
|
95
|
+
display_info "Check to see if docker is running", :red
|
96
|
+
display_info("Try running 'docker ps'", :yellow)
|
97
|
+
end
|
98
|
+
|
69
99
|
private
|
70
100
|
def thor
|
71
101
|
@thor ||= Thor::Shell::Color.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picobox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Surzycki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|