debox 0.0.1
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.
- data/.gitignore +20 -0
- data/.rspec +1 -0
- data/Gemfile +15 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/bin/debox +15 -0
- data/debox.gemspec +23 -0
- data/lib/debox.rb +9 -0
- data/lib/debox/api.rb +261 -0
- data/lib/debox/cli.rb +111 -0
- data/lib/debox/command.rb +48 -0
- data/lib/debox/command/apps.rb +14 -0
- data/lib/debox/command/auth.rb +29 -0
- data/lib/debox/command/base.rb +57 -0
- data/lib/debox/command/cap.rb +16 -0
- data/lib/debox/command/deploy.rb +18 -0
- data/lib/debox/command/key.rb +20 -0
- data/lib/debox/command/live.rb +14 -0
- data/lib/debox/command/log.rb +17 -0
- data/lib/debox/command/login.rb +18 -0
- data/lib/debox/command/logs.rb +27 -0
- data/lib/debox/command/recipes.rb +65 -0
- data/lib/debox/config.rb +59 -0
- data/lib/debox/utils.rb +77 -0
- data/lib/debox/version.rb +3 -0
- data/spec/integration/api/api_key_spec.rb +20 -0
- data/spec/integration/api/apps_spec.rb +9 -0
- data/spec/integration/api/cap/cap_spec.rb +58 -0
- data/spec/integration/api/live/log_spec.rb +12 -0
- data/spec/integration/api/logs/index_spec.rb +54 -0
- data/spec/integration/api/logs/show_spec.rb +27 -0
- data/spec/integration/api/public_key_spec.rb +15 -0
- data/spec/integration/api/recipes/create_spec.rb +10 -0
- data/spec/integration/api/recipes/destroy_spec.rb +14 -0
- data/spec/integration/api/recipes/index_spec.rb +17 -0
- data/spec/integration/api/recipes/new_spec.rb +10 -0
- data/spec/integration/api/recipes/show_spec.rb +10 -0
- data/spec/integration/api/recipes/update_spec.rb +11 -0
- data/spec/integration/api/users/create_spec.rb +8 -0
- data/spec/integration/api/users/delete_spec.rb +11 -0
- data/spec/integration/api/users/index_spec.rb +10 -0
- data/spec/integration/commands/apps_spec.rb +8 -0
- data/spec/integration/commands/cap_spec.rb +17 -0
- data/spec/integration/commands/key_spec.rb +24 -0
- data/spec/integration/commands/login_spec.rb +11 -0
- data/spec/integration/commands/logs/index_spec.rb +14 -0
- data/spec/integration/commands/logs/show_spec.rb +14 -0
- data/spec/integration/commands/recipes/delete_spec.rb +8 -0
- data/spec/integration/commands/recipes/edit_spec.rb +23 -0
- data/spec/integration/commands/recipes/index_spec.rb +8 -0
- data/spec/integration/commands/recipes/show_spec.rb +8 -0
- data/spec/spec_helper.rb +35 -0
- data/spec/support/herlpers.rb +43 -0
- metadata +209 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
ENV['RACK_ENV'] = 'test'
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
require 'rack'
|
6
|
+
require 'thin'
|
7
|
+
require 'debox_server'
|
8
|
+
|
9
|
+
Bundler.require
|
10
|
+
|
11
|
+
require "debox/cli"
|
12
|
+
require 'rspec/mocks'
|
13
|
+
|
14
|
+
# Setup mocks
|
15
|
+
RSpec::Mocks::setup(Object.new)
|
16
|
+
|
17
|
+
# Load commands
|
18
|
+
Debox::Command.load
|
19
|
+
|
20
|
+
# Requires supporting files with custom matchers and macros, etc,
|
21
|
+
# in ./support/ and its subdirectories.
|
22
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
23
|
+
|
24
|
+
# Start a debox server for tests
|
25
|
+
DEBOX_SERVER_PORT = 9393
|
26
|
+
debox_server_start DEBOX_SERVER_PORT
|
27
|
+
|
28
|
+
RSpec.configure do |config|
|
29
|
+
|
30
|
+
# Cleanup database after each test
|
31
|
+
config.after(:each) do
|
32
|
+
DeboxServer::RedisDB.flush_test_db
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Start a debox server in a new thread
|
2
|
+
def debox_server_start(port)
|
3
|
+
Thread.new do
|
4
|
+
Thin::Server.start('127.0.0.1', port, DeboxServer::DeboxAPI)
|
5
|
+
end
|
6
|
+
sleep 1
|
7
|
+
end
|
8
|
+
|
9
|
+
def server
|
10
|
+
@debox_server ||= DeboxServerCore.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_admin(email='debox@indeos.es')
|
14
|
+
user = server.add_user email, 'secret', admin: true
|
15
|
+
return user
|
16
|
+
end
|
17
|
+
|
18
|
+
# Create a user and stub configuration
|
19
|
+
def configure_admin(user=create_admin)
|
20
|
+
Debox::Config.stub(:config).and_return host: 'localhost', port: DEBOX_SERVER_PORT, user: user.email, api_key: user.api_key
|
21
|
+
return user
|
22
|
+
end
|
23
|
+
|
24
|
+
# Stub configuration for match spec settings
|
25
|
+
def configure
|
26
|
+
Debox::Config.stub(:config).and_return host: 'localhost', port: DEBOX_SERVER_PORT
|
27
|
+
end
|
28
|
+
|
29
|
+
# Build a job with stdout and capistrano methos stubbed
|
30
|
+
def stubbed_job(app, env, task='deploy', out=nil)
|
31
|
+
out = OpenStruct.new time: DateTime.now, success: true unless out
|
32
|
+
job = DeboxServer::Job.new(app, env, task)
|
33
|
+
job.stub(:stdout) { out }
|
34
|
+
job.stub(:capistrano) { { } }
|
35
|
+
return job
|
36
|
+
end
|
37
|
+
|
38
|
+
def run_command(args_str, options={})
|
39
|
+
args = args_str.split
|
40
|
+
given_command = args.shift.strip
|
41
|
+
command = Debox::Command.get_command given_command
|
42
|
+
Debox::Command.run(command, options, args)
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: debox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Eloy Gomez
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: json
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: netrc
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: highline
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: eventmachine
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: em-eventsource
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: CLI for debox
|
95
|
+
email:
|
96
|
+
- eloy@indeos.es
|
97
|
+
executables:
|
98
|
+
- debox
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files: []
|
101
|
+
files:
|
102
|
+
- .gitignore
|
103
|
+
- .rspec
|
104
|
+
- Gemfile
|
105
|
+
- LICENSE
|
106
|
+
- README.md
|
107
|
+
- Rakefile
|
108
|
+
- bin/debox
|
109
|
+
- debox.gemspec
|
110
|
+
- lib/debox.rb
|
111
|
+
- lib/debox/api.rb
|
112
|
+
- lib/debox/cli.rb
|
113
|
+
- lib/debox/command.rb
|
114
|
+
- lib/debox/command/apps.rb
|
115
|
+
- lib/debox/command/auth.rb
|
116
|
+
- lib/debox/command/base.rb
|
117
|
+
- lib/debox/command/cap.rb
|
118
|
+
- lib/debox/command/deploy.rb
|
119
|
+
- lib/debox/command/key.rb
|
120
|
+
- lib/debox/command/live.rb
|
121
|
+
- lib/debox/command/log.rb
|
122
|
+
- lib/debox/command/login.rb
|
123
|
+
- lib/debox/command/logs.rb
|
124
|
+
- lib/debox/command/recipes.rb
|
125
|
+
- lib/debox/config.rb
|
126
|
+
- lib/debox/utils.rb
|
127
|
+
- lib/debox/version.rb
|
128
|
+
- spec/integration/api/api_key_spec.rb
|
129
|
+
- spec/integration/api/apps_spec.rb
|
130
|
+
- spec/integration/api/cap/cap_spec.rb
|
131
|
+
- spec/integration/api/live/log_spec.rb
|
132
|
+
- spec/integration/api/logs/index_spec.rb
|
133
|
+
- spec/integration/api/logs/show_spec.rb
|
134
|
+
- spec/integration/api/public_key_spec.rb
|
135
|
+
- spec/integration/api/recipes/create_spec.rb
|
136
|
+
- spec/integration/api/recipes/destroy_spec.rb
|
137
|
+
- spec/integration/api/recipes/index_spec.rb
|
138
|
+
- spec/integration/api/recipes/new_spec.rb
|
139
|
+
- spec/integration/api/recipes/show_spec.rb
|
140
|
+
- spec/integration/api/recipes/update_spec.rb
|
141
|
+
- spec/integration/api/users/create_spec.rb
|
142
|
+
- spec/integration/api/users/delete_spec.rb
|
143
|
+
- spec/integration/api/users/index_spec.rb
|
144
|
+
- spec/integration/commands/apps_spec.rb
|
145
|
+
- spec/integration/commands/cap_spec.rb
|
146
|
+
- spec/integration/commands/key_spec.rb
|
147
|
+
- spec/integration/commands/login_spec.rb
|
148
|
+
- spec/integration/commands/logs/index_spec.rb
|
149
|
+
- spec/integration/commands/logs/show_spec.rb
|
150
|
+
- spec/integration/commands/recipes/delete_spec.rb
|
151
|
+
- spec/integration/commands/recipes/edit_spec.rb
|
152
|
+
- spec/integration/commands/recipes/index_spec.rb
|
153
|
+
- spec/integration/commands/recipes/show_spec.rb
|
154
|
+
- spec/spec_helper.rb
|
155
|
+
- spec/support/herlpers.rb
|
156
|
+
homepage: https://github.com/harlock/debox
|
157
|
+
licenses: []
|
158
|
+
post_install_message:
|
159
|
+
rdoc_options: []
|
160
|
+
require_paths:
|
161
|
+
- lib
|
162
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
none: false
|
164
|
+
requirements:
|
165
|
+
- - ! '>='
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
requirements: []
|
175
|
+
rubyforge_project:
|
176
|
+
rubygems_version: 1.8.23
|
177
|
+
signing_key:
|
178
|
+
specification_version: 3
|
179
|
+
summary: Debox is a deploy manager
|
180
|
+
test_files:
|
181
|
+
- spec/integration/api/api_key_spec.rb
|
182
|
+
- spec/integration/api/apps_spec.rb
|
183
|
+
- spec/integration/api/cap/cap_spec.rb
|
184
|
+
- spec/integration/api/live/log_spec.rb
|
185
|
+
- spec/integration/api/logs/index_spec.rb
|
186
|
+
- spec/integration/api/logs/show_spec.rb
|
187
|
+
- spec/integration/api/public_key_spec.rb
|
188
|
+
- spec/integration/api/recipes/create_spec.rb
|
189
|
+
- spec/integration/api/recipes/destroy_spec.rb
|
190
|
+
- spec/integration/api/recipes/index_spec.rb
|
191
|
+
- spec/integration/api/recipes/new_spec.rb
|
192
|
+
- spec/integration/api/recipes/show_spec.rb
|
193
|
+
- spec/integration/api/recipes/update_spec.rb
|
194
|
+
- spec/integration/api/users/create_spec.rb
|
195
|
+
- spec/integration/api/users/delete_spec.rb
|
196
|
+
- spec/integration/api/users/index_spec.rb
|
197
|
+
- spec/integration/commands/apps_spec.rb
|
198
|
+
- spec/integration/commands/cap_spec.rb
|
199
|
+
- spec/integration/commands/key_spec.rb
|
200
|
+
- spec/integration/commands/login_spec.rb
|
201
|
+
- spec/integration/commands/logs/index_spec.rb
|
202
|
+
- spec/integration/commands/logs/show_spec.rb
|
203
|
+
- spec/integration/commands/recipes/delete_spec.rb
|
204
|
+
- spec/integration/commands/recipes/edit_spec.rb
|
205
|
+
- spec/integration/commands/recipes/index_spec.rb
|
206
|
+
- spec/integration/commands/recipes/show_spec.rb
|
207
|
+
- spec/spec_helper.rb
|
208
|
+
- spec/support/herlpers.rb
|
209
|
+
has_rdoc:
|