chloe 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +38 -0
- data/Rakefile +7 -0
- data/chloe.gemspec +30 -0
- data/lib/chloe.rb +16 -6
- data/lib/chloe/modules.rb +6 -0
- data/lib/chloe/modules/service.rb +21 -0
- data/lib/chloe/modules/vagrant.rb +62 -0
- data/lib/chloe/task.rb +1 -1
- data/lib/chloe/version.rb +1 -1
- data/spec/chloe/cli_spec.rb +14 -0
- data/spec/chloe/task_spec.rb +7 -0
- data/spec/chloe/tasks/initialize_spec.rb +50 -0
- data/spec/spec_helper.rb +9 -0
- metadata +70 -64
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Ryan Moran
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Chloe
|
2
|
+
|
3
|
+
Chloe is a tool used to manage an application's development environment.
|
4
|
+
We all have projects that use a multitude of tools to bootstrap, run, and
|
5
|
+
test our applications while they are in development. We have to learn
|
6
|
+
bundler, rake, rails, vagrant, librarian, and many other tools so that we
|
7
|
+
can just get something up to hack on it. Chloe tries to solve this by
|
8
|
+
acting as a simple CLI for your application in development. It enables
|
9
|
+
you to wrap up common tasks into a singular interface, keeping tests,
|
10
|
+
vms, and dependency management all under one roof.
|
11
|
+
|
12
|
+
<!---
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
gem 'chloe'
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install chloe
|
26
|
+
-->
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
More on this to come...
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
1. Fork it
|
35
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
36
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
37
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
38
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/chloe.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/chloe/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Ryan Moran"]
|
6
|
+
gem.email = ["ryan.moran@gmail.com"]
|
7
|
+
gem.description = <<-DESCRIPTION
|
8
|
+
Chloe is a tool used to manage an application's development environment.
|
9
|
+
We all have projects that use a multitude of tools to bootstrap, run, and
|
10
|
+
test our applications while they are in development. We have to learn
|
11
|
+
bundler, rake, rails, vagrant, librarian, and many other tools so that we
|
12
|
+
can just get something up to hack on it. Chloe tries to solve this by
|
13
|
+
acting as a simple CLI for your application in development. It enables
|
14
|
+
you to wrap up common tasks into a singular interface, keeping tests,
|
15
|
+
vms, and dependency management all under one roof.
|
16
|
+
DESCRIPTION
|
17
|
+
gem.summary = %q{Chloe helps keep your application development environment under control.}
|
18
|
+
gem.homepage = "https://github.com/ryanmoran/chloe"
|
19
|
+
|
20
|
+
gem.files = `git ls-files`.split("\n")
|
21
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
22
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
23
|
+
gem.name = "chloe"
|
24
|
+
gem.require_paths = ["lib"]
|
25
|
+
gem.version = Chloe::VERSION
|
26
|
+
|
27
|
+
gem.add_dependency('thor', '>= 0.14.0')
|
28
|
+
|
29
|
+
gem.add_development_dependency('rspec', '~> 2.11.0')
|
30
|
+
end
|
data/lib/chloe.rb
CHANGED
@@ -3,11 +3,10 @@ require 'thor/group'
|
|
3
3
|
|
4
4
|
require 'core_ext/string'
|
5
5
|
|
6
|
-
require 'chloe/cli'
|
7
|
-
|
8
6
|
module Chloe
|
9
7
|
autoload :CLI, 'chloe/cli'
|
10
8
|
autoload :Executable, 'chloe/executable'
|
9
|
+
autoload :Modules, 'chloe/modules'
|
11
10
|
autoload :Task, 'chloe/task'
|
12
11
|
autoload :Tasks, 'chloe/tasks'
|
13
12
|
autoload :Version, 'chloe/version'
|
@@ -16,23 +15,34 @@ module Chloe
|
|
16
15
|
|
17
16
|
def bootstrap(name)
|
18
17
|
executable = define_executable(name)
|
19
|
-
require_tasks
|
18
|
+
require_tasks(executable)
|
20
19
|
executable.start
|
21
20
|
end
|
22
21
|
|
22
|
+
def include(task)
|
23
|
+
modules << task
|
24
|
+
end
|
25
|
+
|
26
|
+
def modules
|
27
|
+
@modules ||= []
|
28
|
+
end
|
29
|
+
|
23
30
|
def define_executable(name)
|
24
31
|
module_eval <<-EVAL
|
25
32
|
module ::#{name}
|
26
33
|
module CLI
|
27
|
-
class Executable < Chloe::Executable
|
34
|
+
class Executable < ::Chloe::Executable
|
28
35
|
end
|
29
36
|
end
|
30
37
|
end
|
31
38
|
EVAL
|
32
|
-
"
|
39
|
+
"::#{name}::CLI::Executable".constantize
|
33
40
|
end
|
34
41
|
|
35
|
-
def require_tasks
|
42
|
+
def require_tasks(executable)
|
43
|
+
modules.each do |mod|
|
44
|
+
"::Chloe::Modules::#{mod}".constantize.bootstrap(executable)
|
45
|
+
end
|
36
46
|
Dir.glob('./.chloe/**/*.rb') do |file|
|
37
47
|
require file
|
38
48
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Chloe
|
2
|
+
module Modules
|
3
|
+
module Service
|
4
|
+
def self.bootstrap(executable)
|
5
|
+
define(executable)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.define(executable)
|
9
|
+
executable.class_eval do
|
10
|
+
desc :service, 'Runs the service command on the given service'
|
11
|
+
def service(provider, action)
|
12
|
+
command = "vagrant ssh -c \"source ~/.bashrc && cd /vagrant && sudo /sbin/service #{provider} #{action}\""
|
13
|
+
Kernel.exec command
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Chloe
|
2
|
+
module Modules
|
3
|
+
module Vagrant
|
4
|
+
def self.bootstrap(executable)
|
5
|
+
executable.tag_for_registry(Task, :vm, "vm <command>")
|
6
|
+
end
|
7
|
+
|
8
|
+
class Task < Thor
|
9
|
+
def self.summary
|
10
|
+
'Controls the VM, proxying tasks to Vagrant'
|
11
|
+
end
|
12
|
+
|
13
|
+
desc :up, 'Starts up the VM'
|
14
|
+
def up
|
15
|
+
exec 'vagrant', 'up'
|
16
|
+
end
|
17
|
+
|
18
|
+
desc :status, 'Returns the status of the VM'
|
19
|
+
def status
|
20
|
+
exec 'vagrant', 'status'
|
21
|
+
end
|
22
|
+
|
23
|
+
desc :destroy, 'Destroys the VM'
|
24
|
+
def destroy
|
25
|
+
exec 'vagrant', 'destroy'
|
26
|
+
end
|
27
|
+
|
28
|
+
desc :halt, 'Shuts the VM down'
|
29
|
+
def halt
|
30
|
+
exec 'vagrant', 'halt'
|
31
|
+
end
|
32
|
+
|
33
|
+
desc :reload, 'Restarts the VM'
|
34
|
+
def reload
|
35
|
+
exec 'vagrant', 'reload'
|
36
|
+
end
|
37
|
+
|
38
|
+
desc :resume, 'Wakes the VM from a suspended state'
|
39
|
+
def resume
|
40
|
+
exec 'vagrant', 'resume'
|
41
|
+
end
|
42
|
+
|
43
|
+
desc :suspend, 'Puts the VM into a suspended state'
|
44
|
+
def suspend
|
45
|
+
exec 'vagrant', 'suspend'
|
46
|
+
end
|
47
|
+
|
48
|
+
desc :ssh, "SSH's into the VM"
|
49
|
+
def ssh
|
50
|
+
exec 'vagrant', 'ssh'
|
51
|
+
end
|
52
|
+
|
53
|
+
desc :provision, 'Provisions the VM'
|
54
|
+
def provision
|
55
|
+
system 'librarian-chef update --verbose | grep Installing'
|
56
|
+
exec 'vagrant', 'provision'
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/chloe/task.rb
CHANGED
@@ -8,7 +8,7 @@ module Chloe
|
|
8
8
|
snakename = Thor::Util.snake_case(basename)
|
9
9
|
executable = (namespace << 'Executable').join('::').constantize
|
10
10
|
|
11
|
-
executable.tag_for_registry subclass, snakename.to_sym,
|
11
|
+
executable.tag_for_registry subclass, snakename.to_sym, snakename
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.summary(summary = nil)
|
data/lib/chloe/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Chloe::CLI do
|
4
|
+
|
5
|
+
describe '#init' do
|
6
|
+
let(:instance) { Chloe::CLI.new }
|
7
|
+
|
8
|
+
it 'delegates to the Chloe::Tasks::Initialize task' do
|
9
|
+
instance.should_receive(:invoke).with(Chloe::Tasks::Initialize, ['test'])
|
10
|
+
instance.install('test')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Chloe::Tasks::Initialize do
|
4
|
+
let(:script) { Chloe::Tasks::Initialize }
|
5
|
+
let(:pwd) { Pathname.new(Dir.pwd) }
|
6
|
+
let(:sandbox) { Pathname.new(File.join(pwd, 'sandbox')) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
FileUtils.mkdir(sandbox)
|
10
|
+
Dir.chdir(sandbox)
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
Dir.chdir(pwd)
|
15
|
+
FileUtils.rm_rf(sandbox)
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '.run!' do
|
19
|
+
let(:executable) { Pathname.new(File.join(sandbox, 'test')) }
|
20
|
+
let(:scripts) { Pathname.new(File.join(sandbox, '.chloe')) }
|
21
|
+
let(:example_script) { Pathname.new(File.join(sandbox, '.chloe', 'example.rb')) }
|
22
|
+
let(:shell) { Thor::Base.shell.new }
|
23
|
+
|
24
|
+
it 'writes an executable script to the current directory bootstrapping the environment' do
|
25
|
+
executable.should_not exist
|
26
|
+
shell.mute do
|
27
|
+
script.start('test', :shell => shell)
|
28
|
+
end
|
29
|
+
executable.should exist
|
30
|
+
executable.should be_executable
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'creates a directory for scripts' do
|
34
|
+
scripts.should_not exist
|
35
|
+
shell.mute do
|
36
|
+
script.start('test', :shell => shell)
|
37
|
+
end
|
38
|
+
scripts.should exist
|
39
|
+
scripts.should be_directory
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'creates an example script in the directory for scripts' do
|
43
|
+
example_script.should_not exist
|
44
|
+
shell.mute do
|
45
|
+
script.start('test', :shell => shell)
|
46
|
+
end
|
47
|
+
example_script.should exist
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'chloe'
|
2
|
+
|
3
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
4
|
+
RSpec.configure do |config|
|
5
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
6
|
+
config.run_all_when_everything_filtered = true
|
7
|
+
config.filter_run :focus
|
8
|
+
config.order = 'random'
|
9
|
+
end
|
metadata
CHANGED
@@ -1,68 +1,76 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: chloe
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Ryan Moran
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-10-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: thor
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 39
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 14
|
32
|
-
- 0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 0.14.0
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rspec
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.14.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
40
33
|
none: false
|
41
|
-
requirements:
|
34
|
+
requirements:
|
42
35
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 35
|
45
|
-
segments:
|
46
|
-
- 2
|
47
|
-
- 11
|
48
|
-
- 0
|
36
|
+
- !ruby/object:Gem::Version
|
49
37
|
version: 2.11.0
|
50
38
|
type: :development
|
51
|
-
|
52
|
-
|
53
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.11.0
|
46
|
+
description: ! " Chloe is a tool used to manage an application's development environment.\n
|
47
|
+
\ We all have projects that use a multitude of tools to bootstrap, run, and\n
|
48
|
+
\ test our applications while they are in development. We have to learn\n bundler,
|
49
|
+
rake, rails, vagrant, librarian, and many other tools so that we\n can just get
|
50
|
+
something up to hack on it. Chloe tries to solve this by\n acting as a simple
|
51
|
+
CLI for your application in development. It enables\n you to wrap up common tasks
|
52
|
+
into a singular interface, keeping tests,\n vms, and dependency management all
|
53
|
+
under one roof.\n"
|
54
|
+
email:
|
54
55
|
- ryan.moran@gmail.com
|
55
|
-
executables:
|
56
|
+
executables:
|
56
57
|
- chloe
|
57
58
|
extensions: []
|
58
|
-
|
59
59
|
extra_rdoc_files: []
|
60
|
-
|
61
|
-
|
60
|
+
files:
|
61
|
+
- .gitignore
|
62
|
+
- Gemfile
|
63
|
+
- LICENSE
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
62
66
|
- bin/chloe
|
67
|
+
- chloe.gemspec
|
63
68
|
- lib/chloe.rb
|
64
69
|
- lib/chloe/cli.rb
|
65
70
|
- lib/chloe/executable.rb
|
71
|
+
- lib/chloe/modules.rb
|
72
|
+
- lib/chloe/modules/service.rb
|
73
|
+
- lib/chloe/modules/vagrant.rb
|
66
74
|
- lib/chloe/task.rb
|
67
75
|
- lib/chloe/tasks.rb
|
68
76
|
- lib/chloe/tasks/initialize.rb
|
@@ -70,38 +78,36 @@ files:
|
|
70
78
|
- lib/chloe/templates/executable
|
71
79
|
- lib/chloe/version.rb
|
72
80
|
- lib/core_ext/string.rb
|
81
|
+
- spec/chloe/cli_spec.rb
|
82
|
+
- spec/chloe/task_spec.rb
|
83
|
+
- spec/chloe/tasks/initialize_spec.rb
|
84
|
+
- spec/spec_helper.rb
|
73
85
|
homepage: https://github.com/ryanmoran/chloe
|
74
86
|
licenses: []
|
75
|
-
|
76
87
|
post_install_message:
|
77
88
|
rdoc_options: []
|
78
|
-
|
79
|
-
require_paths:
|
89
|
+
require_paths:
|
80
90
|
- lib
|
81
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
92
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
|
88
|
-
- 0
|
89
|
-
version: "0"
|
90
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
98
|
none: false
|
92
|
-
requirements:
|
93
|
-
- -
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
|
96
|
-
segments:
|
97
|
-
- 0
|
98
|
-
version: "0"
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
99
103
|
requirements: []
|
100
|
-
|
101
104
|
rubyforge_project:
|
102
|
-
rubygems_version: 1.8.
|
105
|
+
rubygems_version: 1.8.23
|
103
106
|
signing_key:
|
104
107
|
specification_version: 3
|
105
108
|
summary: Chloe helps keep your application development environment under control.
|
106
|
-
test_files:
|
107
|
-
|
109
|
+
test_files:
|
110
|
+
- spec/chloe/cli_spec.rb
|
111
|
+
- spec/chloe/task_spec.rb
|
112
|
+
- spec/chloe/tasks/initialize_spec.rb
|
113
|
+
- spec/spec_helper.rb
|