hobo-inviqa 0.0.4 → 0.0.6

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.
Files changed (55) hide show
  1. data/Gemfile.lock +27 -6
  2. data/README.md +1 -10
  3. data/bin/hobo +20 -0
  4. data/features/hobo/help.feature +5 -1
  5. data/hobo.gemspec +4 -0
  6. data/lib/hobo.rb +17 -14
  7. data/lib/hobo/asset_applicator.rb +16 -0
  8. data/lib/hobo/cli.rb +40 -20
  9. data/lib/hobo/config.rb +5 -0
  10. data/lib/hobo/config/file.rb +3 -1
  11. data/lib/hobo/errors.rb +8 -1
  12. data/lib/hobo/help_formatter.rb +8 -1
  13. data/lib/hobo/helper/file_locator.rb +8 -5
  14. data/lib/hobo/helper/shell.rb +12 -4
  15. data/lib/hobo/helper/vm_command.rb +67 -0
  16. data/lib/hobo/lib/host_check.rb +23 -0
  17. data/lib/hobo/lib/host_check/deps.rb +21 -0
  18. data/lib/hobo/lib/host_check/git.rb +52 -0
  19. data/lib/hobo/lib/host_check/ruby.rb +42 -0
  20. data/lib/hobo/lib/host_check/vagrant.rb +15 -0
  21. data/lib/hobo/lib/s3sync.rb +233 -0
  22. data/lib/hobo/lib/seed/project.rb +12 -0
  23. data/lib/hobo/lib/seed/seed.rb +19 -0
  24. data/lib/hobo/logging.rb +22 -0
  25. data/lib/hobo/metadata.rb +7 -1
  26. data/lib/hobo/null.rb +31 -0
  27. data/lib/hobo/patches/deepstruct.rb +23 -0
  28. data/lib/hobo/patches/rake.rb +14 -1
  29. data/lib/hobo/patches/slop.rb +11 -1
  30. data/lib/hobo/paths.rb +8 -3
  31. data/lib/hobo/tasks/assets.rb +96 -0
  32. data/lib/hobo/tasks/console.rb +18 -0
  33. data/lib/hobo/tasks/debug.rb +2 -2
  34. data/lib/hobo/tasks/deps.rb +1 -1
  35. data/lib/hobo/tasks/host.rb +17 -0
  36. data/lib/hobo/tasks/vm.rb +2 -2
  37. data/lib/hobo/ui.rb +21 -16
  38. data/lib/hobo/version.rb +1 -1
  39. data/spec/hobo/asset_applicator_spec.rb +31 -0
  40. data/spec/hobo/cli_spec.rb +115 -97
  41. data/spec/hobo/config/file_spec.rb +13 -3
  42. data/spec/hobo/help_formatter_spec.rb +50 -18
  43. data/spec/hobo/helpers/file_locator_spec.rb +5 -1
  44. data/spec/hobo/helpers/shell_spec.rb +15 -1
  45. data/spec/hobo/helpers/vm_command_spec.rb +85 -0
  46. data/spec/hobo/lib/s3sync_spec.rb +13 -0
  47. data/spec/hobo/lib/seed/project_spec.rb +7 -8
  48. data/spec/hobo/lib/seed/seed_spec.rb +3 -4
  49. data/spec/hobo/logging_spec.rb +28 -0
  50. data/spec/hobo/metadata_spec.rb +10 -0
  51. data/spec/hobo/null_spec.rb +31 -0
  52. data/spec/hobo/paths_spec.rb +6 -6
  53. data/spec/hobo/ui_spec.rb +4 -0
  54. metadata +93 -6
  55. data/features/vm.feature +0 -0
@@ -0,0 +1,85 @@
1
+ require 'hobo/config'
2
+ require 'hobo/logging'
3
+ require 'hobo/ui'
4
+ require 'hobo/patches/deepstruct'
5
+ require 'hobo/helper/vm_command'
6
+
7
+
8
+ describe Hobo::Helper do
9
+ before do
10
+ Hobo.project_config = DeepStruct.wrap({
11
+ :hostname => "test_hostname",
12
+ :mysql => {
13
+ :username => "test_user",
14
+ :password => "test_pass"
15
+ }
16
+ })
17
+ end
18
+
19
+ describe "vm_command" do
20
+ it "should create a new vm command wrapper with specified command" do
21
+ vm_command("my_command").to_s.should match /-- my_command/
22
+ end
23
+
24
+ it "should default to using a psuedo tty" do
25
+ vm_command("my_command").to_s.should match /\s-t\s/
26
+ end
27
+
28
+ it "should default to vagrant user" do
29
+ vm_command("my_command").to_s.should match /vagrant@/
30
+ end
31
+
32
+ it "should default to project host name" do
33
+ vm_command("my_command").to_s.should match /@test_hostname/
34
+ end
35
+
36
+ it "should not wrap piped commands with echo by default" do
37
+ c = vm_command("my_command")
38
+ c << "test"
39
+ c.to_s.should_not match /^echo test/
40
+ end
41
+ end
42
+
43
+ describe "vm_mysql" do
44
+ it "should use mysql command by default" do
45
+ vm_mysql.to_s.should match /-- mysql/
46
+ end
47
+
48
+ it "should use project config mysql username & password if set" do
49
+ vm_mysql.to_s.should match /-- mysql.*-utest_user.*-ptest_pass/
50
+ end
51
+
52
+ it "should default to root/root if project config mysql credentials not set" do
53
+ Hobo.project_config = DeepStruct.wrap({})
54
+ vm_mysql.to_s.should match /-- mysql.*-uroot.*-proot/
55
+ end
56
+
57
+ it "should allow specifying the database in options" do
58
+ vm_mysql(:db => "test_db").to_s.should match /-- mysql.*test_db$/
59
+ end
60
+
61
+ it "should enable auto echo of piped commands" do
62
+ c = vm_mysql
63
+ c << "SELECT 1"
64
+ c.to_s.should match /^echo SELECT\\ 1/
65
+ end
66
+ end
67
+
68
+ describe "vm_shell" do
69
+ it "should execute the command using the shell helper" do
70
+ Hobo::Helper.class_eval do
71
+ alias :old_shell :shell
72
+ def shell command
73
+ command.should match /ssh.* -- my_command/
74
+ end
75
+ end
76
+
77
+ vm_shell "my_command"
78
+
79
+ Hobo::Helper.class_eval do
80
+ remove_method :shell
81
+ alias :shell :old_shell
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,13 @@
1
+ require 'hobo/logging'
2
+ require 'hobo/lib/s3sync'
3
+
4
+ describe Hobo::Lib::S3Sync do
5
+ describe "sync" do
6
+ it "should synchronize s3 files to local"
7
+ it "should synchronize local files to s3"
8
+ it "should add files that only exist in source"
9
+ it "should update files that have changed"
10
+ it "should remove files that do not exist in source"
11
+ it "should update progress as files are transferred"
12
+ end
13
+ end
@@ -1,12 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'hobo/paths'
3
- require 'hobo/config/file'
4
- require 'hobo/lib/seed/project'
5
- require 'hobo/lib/seed/seed'
6
- require 'hobo/lib/seed/replacer'
7
- require 'hobo/helper/file_locator'
8
- require 'hobo/helper/shell'
9
- require 'hobo/ui'
2
+ require 'hobo'
10
3
 
11
4
  describe Hobo::Lib::Seed::Project do
12
5
  pwd = nil
@@ -79,5 +72,11 @@ describe Hobo::Lib::Seed::Project do
79
72
  project.setup(seed, { :project_path => "project_path", :seed => {}, :git_url => 'remote_url' })
80
73
  Hobo::Helper.shell("cd project_path && git remote show -n origin", :capture => true).should match /remote_url/
81
74
  end
75
+
76
+ it "should load seed init file if present"
77
+ it "should remove seed init file"
78
+
79
+ it "should set hostname in config"
80
+ it "should set asset bucket in config"
82
81
  end
83
82
  end
@@ -1,8 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'hobo/lib/seed/seed'
3
- require 'hobo/helper/file_locator'
4
- require 'hobo/helper/shell'
5
- require 'hobo/ui'
2
+ require 'hobo'
6
3
 
7
4
  describe Hobo::Lib::Seed::Seed do
8
5
  pwd = nil
@@ -77,6 +74,8 @@ describe Hobo::Lib::Seed::Seed do
77
74
  File.read("exported/test").strip.should eq "exported"
78
75
  File.exists?("exported/.git").should be false
79
76
  end
77
+
78
+ it "should export seed submodules to the specified directory"
80
79
  end
81
80
 
82
81
  describe "version", :integration do
@@ -0,0 +1,28 @@
1
+ require 'hobo/logging'
2
+
3
+ describe Hobo::Logging do
4
+ before do
5
+ Hobo.logger = nil
6
+ end
7
+
8
+ describe "module logger" do
9
+ it "should return global logger instance" do
10
+ Hobo.logger = "TEST"
11
+ class LoggerTest
12
+ include Hobo::Logging
13
+ end
14
+
15
+ LoggerTest.new.logger.should match "TEST"
16
+ end
17
+ end
18
+
19
+ describe "global logger" do
20
+ it "should initialize to STDOUT logger" do
21
+ Hobo::Logging.logger.instance_variable_get('@logdev').dev.should be STDOUT
22
+ end
23
+
24
+ it "should initialize to WARN log level" do
25
+ Hobo::Logging.logger.level.should eq Logger::WARN
26
+ end
27
+ end
28
+ end
@@ -43,4 +43,14 @@ describe Hobo::Metadata do
43
43
  Hobo::Metadata.metadata["key"][:type].should match "default"
44
44
  end
45
45
  end
46
+
47
+ describe "reset" do
48
+ it "should reset all current store values to defaults" do
49
+ Hobo::Metadata.default :type, "default"
50
+ Hobo::Metadata.add "key", :type
51
+ Hobo::Metadata.add "key", :other_type
52
+ Hobo::Metadata.reset_store
53
+ Hobo::Metadata.store.should eq({ :type => "default" })
54
+ end
55
+ end
46
56
  end
@@ -0,0 +1,31 @@
1
+ require 'hobo/null'
2
+
3
+ describe Hobo::Null do
4
+ it "should return itself for any method call" do
5
+ null = Hobo::Null.new
6
+ null["test"].should eq null
7
+ null.test.should eq null
8
+ (null + null).should eq null
9
+ end
10
+
11
+ it "should convert to identity of types" do
12
+ null = Hobo::Null.new
13
+ null.to_s.should match ""
14
+ null.to_i.should eq 0
15
+ null.to_f.should eq 0.0
16
+ null.to_a.should eq []
17
+ end
18
+
19
+ describe "maybe" do
20
+ it "should return nil if nil?" do
21
+ maybe(nil).should eq nil
22
+ maybe(Hobo::Null.new).should eq nil
23
+ end
24
+
25
+ it "should return value for !nil?" do
26
+ maybe(true).should eq true
27
+ maybe("").should eq ""
28
+ maybe(1).should eq 1
29
+ end
30
+ end
31
+ end
@@ -13,8 +13,8 @@ describe Hobo do
13
13
  FakeFS.deactivate!
14
14
  end
15
15
 
16
- it 'should return current directory if not in project' do
17
- Hobo.project_path.should eq Dir.pwd
16
+ it 'should return nil if not in project' do
17
+ Hobo.project_path.should eq nil
18
18
  end
19
19
 
20
20
  it 'should return project directory if tools/hobo exists' do
@@ -64,14 +64,14 @@ describe Hobo do
64
64
  end
65
65
 
66
66
  describe 'project_config_file' do
67
- it 'should be project_path + tools/hobo/storage.yaml' do
68
- Hobo.project_config_file.should eq File.join(Hobo.project_path, 'tools', 'hobo', 'storage.yaml')
67
+ it 'should be project_path + tools/hobo/config.yaml' do
68
+ Hobo.project_config_file.should eq File.join(Hobo.project_path, 'tools', 'hobo', 'config.yaml')
69
69
  end
70
70
  end
71
71
 
72
72
  describe 'user_config_file' do
73
- it 'should be ~/.hobo/config.rb' do
74
- Hobo.user_config_file.should eq File.join(Hobo.config_path, 'config.rb')
73
+ it 'should be ~/.hobo/config.yaml' do
74
+ Hobo.user_config_file.should eq File.join(Hobo.config_path, 'config.yaml')
75
75
  end
76
76
  end
77
77
  end
@@ -22,6 +22,10 @@ describe Hobo::Ui do
22
22
  it "should format message with ansi style"
23
23
  end
24
24
 
25
+ describe "use_color" do
26
+ it "should set the use of color"
27
+ end
28
+
25
29
  describe "color_scheme" do
26
30
  it "should set the global color scheme if argument provided"
27
31
  it "should return the global color scheme"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobo-inviqa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-10 00:00:00.000000000 Z
12
+ date: 2014-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: slop
@@ -91,6 +91,70 @@ dependencies:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
93
  version: 1.5.2
94
+ - !ruby/object:Gem::Dependency
95
+ name: deepstruct
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 0.0.5
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 0.0.5
110
+ - !ruby/object:Gem::Dependency
111
+ name: semantic
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 1.3.0
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.3.0
126
+ - !ruby/object:Gem::Dependency
127
+ name: aws-sdk
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: 1.34.0
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 1.34.0
142
+ - !ruby/object:Gem::Dependency
143
+ name: ruby-progressbar
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: 1.4.1
150
+ type: :runtime
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: 1.4.1
94
158
  - !ruby/object:Gem::Dependency
95
159
  name: aruba
96
160
  requirement: !ruby/object:Gem::Requirement
@@ -225,10 +289,11 @@ files:
225
289
  - features/seed/plant.feature
226
290
  - features/step_definitions/seed.rb
227
291
  - features/support/env.rb
228
- - features/vm.feature
229
292
  - hobo.gemspec
230
293
  - lib/hobo.rb
294
+ - lib/hobo/asset_applicator.rb
231
295
  - lib/hobo/cli.rb
296
+ - lib/hobo/config.rb
232
297
  - lib/hobo/config/file.rb
233
298
  - lib/hobo/error_handlers/debug.rb
234
299
  - lib/hobo/error_handlers/friendly.rb
@@ -236,21 +301,35 @@ files:
236
301
  - lib/hobo/help_formatter.rb
237
302
  - lib/hobo/helper/file_locator.rb
238
303
  - lib/hobo/helper/shell.rb
304
+ - lib/hobo/helper/vm_command.rb
305
+ - lib/hobo/lib/host_check.rb
306
+ - lib/hobo/lib/host_check/deps.rb
307
+ - lib/hobo/lib/host_check/git.rb
308
+ - lib/hobo/lib/host_check/ruby.rb
309
+ - lib/hobo/lib/host_check/vagrant.rb
310
+ - lib/hobo/lib/s3sync.rb
239
311
  - lib/hobo/lib/seed/project.rb
240
312
  - lib/hobo/lib/seed/replacer.rb
241
313
  - lib/hobo/lib/seed/seed.rb
314
+ - lib/hobo/logging.rb
242
315
  - lib/hobo/metadata.rb
316
+ - lib/hobo/null.rb
317
+ - lib/hobo/patches/deepstruct.rb
243
318
  - lib/hobo/patches/rake.rb
244
319
  - lib/hobo/patches/slop.rb
245
320
  - lib/hobo/paths.rb
321
+ - lib/hobo/tasks/assets.rb
322
+ - lib/hobo/tasks/console.rb
246
323
  - lib/hobo/tasks/debug.rb
247
324
  - lib/hobo/tasks/deps.rb
325
+ - lib/hobo/tasks/host.rb
248
326
  - lib/hobo/tasks/seed.rb
249
327
  - lib/hobo/tasks/tools.rb
250
328
  - lib/hobo/tasks/vm.rb
251
329
  - lib/hobo/ui.rb
252
330
  - lib/hobo/util.rb
253
331
  - lib/hobo/version.rb
332
+ - spec/hobo/asset_applicator_spec.rb
254
333
  - spec/hobo/cli_spec.rb
255
334
  - spec/hobo/config/file_spec.rb
256
335
  - spec/hobo/error_handlers/debug_spec.rb
@@ -259,10 +338,14 @@ files:
259
338
  - spec/hobo/help_formatter_spec.rb
260
339
  - spec/hobo/helpers/file_locator_spec.rb
261
340
  - spec/hobo/helpers/shell_spec.rb
341
+ - spec/hobo/helpers/vm_command_spec.rb
342
+ - spec/hobo/lib/s3sync_spec.rb
262
343
  - spec/hobo/lib/seed/project_spec.rb
263
344
  - spec/hobo/lib/seed/replacer_spec.rb
264
345
  - spec/hobo/lib/seed/seed_spec.rb
346
+ - spec/hobo/logging_spec.rb
265
347
  - spec/hobo/metadata_spec.rb
348
+ - spec/hobo/null_spec.rb
266
349
  - spec/hobo/patches/rake_spec.rb
267
350
  - spec/hobo/paths_spec.rb
268
351
  - spec/hobo/ui_spec.rb
@@ -281,7 +364,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
281
364
  version: '0'
282
365
  segments:
283
366
  - 0
284
- hash: 3320212073893158574
367
+ hash: -610283183360514634
285
368
  required_rubygems_version: !ruby/object:Gem::Requirement
286
369
  none: false
287
370
  requirements:
@@ -290,7 +373,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
373
  version: '0'
291
374
  segments:
292
375
  - 0
293
- hash: 3320212073893158574
376
+ hash: -610283183360514634
294
377
  requirements: []
295
378
  rubyforge_project:
296
379
  rubygems_version: 1.8.23
@@ -305,7 +388,7 @@ test_files:
305
388
  - features/seed/plant.feature
306
389
  - features/step_definitions/seed.rb
307
390
  - features/support/env.rb
308
- - features/vm.feature
391
+ - spec/hobo/asset_applicator_spec.rb
309
392
  - spec/hobo/cli_spec.rb
310
393
  - spec/hobo/config/file_spec.rb
311
394
  - spec/hobo/error_handlers/debug_spec.rb
@@ -314,10 +397,14 @@ test_files:
314
397
  - spec/hobo/help_formatter_spec.rb
315
398
  - spec/hobo/helpers/file_locator_spec.rb
316
399
  - spec/hobo/helpers/shell_spec.rb
400
+ - spec/hobo/helpers/vm_command_spec.rb
401
+ - spec/hobo/lib/s3sync_spec.rb
317
402
  - spec/hobo/lib/seed/project_spec.rb
318
403
  - spec/hobo/lib/seed/replacer_spec.rb
319
404
  - spec/hobo/lib/seed/seed_spec.rb
405
+ - spec/hobo/logging_spec.rb
320
406
  - spec/hobo/metadata_spec.rb
407
+ - spec/hobo/null_spec.rb
321
408
  - spec/hobo/patches/rake_spec.rb
322
409
  - spec/hobo/paths_spec.rb
323
410
  - spec/hobo/ui_spec.rb