cumuli 0.2.1 → 0.3.0
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 +19 -0
- data/cumuli.gemspec +1 -1
- data/lib/cumuli/app/stdout_logger.rb +1 -1
- data/lib/cumuli/cli/cli.rb +1 -1
- data/lib/cumuli/cli/commander.rb +4 -4
- data/lib/cumuli/cli/remote_command.rb +42 -0
- data/lib/cumuli/cli.rb +1 -0
- data/lib/cumuli/tasks/cumuli.rake +10 -2
- data/lib/cumuli/version.rb +1 -1
- data/spec/app/app_spec.rb +1 -1
- data/spec/cli/args_spec.rb +3 -3
- data/spec/cli/commander_spec.rb +4 -4
- data/spec/cli/remote_command_spec.rb +18 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f273b5230330006e3325b4d0e314f98592cd613
|
4
|
+
data.tar.gz: f5888db3dd0621ae18b35f846ff03b1c22274b52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55dbad295e1f5613786f87ae39c454b7b1817ce7325440258c164438f03dd74a1d11aec2f2d7734052d681672b680d525f3b27fc14b92f796f8b0052a6f74306
|
7
|
+
data.tar.gz: 6567664b296c3107bf61297e50d94c0cea1b6edeaf2a7fdcd19bdc000900bc2dc25173c8b85bcecea8d1a04cabf6825138658edf501297d7d8c3f718c6ddf2d2
|
data/README.md
CHANGED
@@ -69,6 +69,25 @@ framework.
|
|
69
69
|
|
70
70
|
app.stop # gracefully kills all the related processes
|
71
71
|
|
72
|
+
### Running command line tools in remote directories
|
73
|
+
|
74
|
+
When working with a whole series of apps and processes, developers will need to run remote tasks that use that app's ruby version.
|
75
|
+
Cumuli has a solution, rake tasks that can be run in those remote locations:
|
76
|
+
|
77
|
+
rake cumuli:remote['rake db:migrate RAILS_ENV=test'] DIR=../../mactivator
|
78
|
+
|
79
|
+
The argument passed into the square brackets is the command that will be run in the directory with its Ruby environment. The DIR environmental
|
80
|
+
variable is where this command will be performed.
|
81
|
+
|
82
|
+
### Other useful rake tasks
|
83
|
+
|
84
|
+
Sometimes things go wrong in the spinning up and spinning down of child processes. There are two rake files for inspecting and killing proceses that
|
85
|
+
are likely related to cumuli.
|
86
|
+
|
87
|
+
rake cumuli:ps # shows a list of all the related processes
|
88
|
+
|
89
|
+
rake cumuli:kill # kills all those processes shown above
|
90
|
+
|
72
91
|
## Known Issues
|
73
92
|
|
74
93
|
If you start the Cumuli app and stop it the first time, it will successfully start and stop all processes. However, if you use the same Cumuli app class to
|
data/cumuli.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'cumuli/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "cumuli"
|
8
8
|
spec.version = Cumuli::VERSION
|
9
|
-
spec.authors = ["SocialChorus", "Kane Baccigalupi", "Fito von Zastrow", "Roy Pfaffman"]
|
9
|
+
spec.authors = ["SocialChorus", "Kane Baccigalupi", "Fito von Zastrow", "Roy Pfaffman", "Sowjanya Mudunuri"]
|
10
10
|
spec.email = ["developers@socialchorus.com"]
|
11
11
|
spec.description = %q{Cumuli runs several foreman processes in different directories}
|
12
12
|
spec.summary = %q{Cumuli makes SOA on Heroku easier by delegating to Foreman in a Procfile}
|
data/lib/cumuli/cli/cli.rb
CHANGED
data/lib/cumuli/cli/commander.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module Cumuli
|
2
2
|
class CLI
|
3
3
|
class Commander
|
4
|
-
attr_reader :
|
4
|
+
attr_reader :command
|
5
5
|
|
6
|
-
def initialize(
|
7
|
-
@
|
6
|
+
def initialize(command)
|
7
|
+
@command = command
|
8
8
|
end
|
9
9
|
|
10
10
|
def build
|
11
|
-
"#{rvm_preface}
|
11
|
+
"#{rvm_preface} #{command}"
|
12
12
|
end
|
13
13
|
|
14
14
|
def rvm_preface
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Cumuli
|
2
|
+
class CLI
|
3
|
+
class RemoteCommand
|
4
|
+
attr_reader :argv
|
5
|
+
|
6
|
+
DIR_ENV = 'DIR='
|
7
|
+
COMMAND_ENV= 'COMMAND='
|
8
|
+
|
9
|
+
def initialize(argv)
|
10
|
+
@argv = argv
|
11
|
+
end
|
12
|
+
|
13
|
+
def extract_env(env_var)
|
14
|
+
found_arg = argv.detect{|arg| arg.include?(env_var)}
|
15
|
+
found_arg && found_arg.gsub(env_var, '')
|
16
|
+
end
|
17
|
+
|
18
|
+
def dir
|
19
|
+
extract_env(DIR_ENV)
|
20
|
+
end
|
21
|
+
|
22
|
+
def raw_command
|
23
|
+
extract_env(COMMAND_ENV) || get_passed_command
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_passed_command
|
27
|
+
matched = argv.first.match(/\[(.*)\]/)
|
28
|
+
matched && matched[1]
|
29
|
+
end
|
30
|
+
|
31
|
+
def command
|
32
|
+
Commander.new(raw_command).build
|
33
|
+
end
|
34
|
+
|
35
|
+
def perform
|
36
|
+
Dir.chdir(dir) do
|
37
|
+
Terminal.new(command).spawn
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/cumuli/cli.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative "../ps"
|
2
|
+
require_relative "../cli/remote_command"
|
3
|
+
require_relative "../cli/commander"
|
4
|
+
require_relative "../cli/terminal"
|
3
5
|
|
6
|
+
namespace :cumuli do
|
4
7
|
desc "kill the processes showing up in the nimbus:ps task"
|
5
8
|
task :kill do
|
6
9
|
Cumuli::PS.new.kill
|
@@ -10,4 +13,9 @@ namespace :cumuli do
|
|
10
13
|
task :ps do
|
11
14
|
puts Cumuli::PS.new.matching
|
12
15
|
end
|
16
|
+
|
17
|
+
desc "run a remote command with the right ruby: rake cumuli:remote ../my_app rake db:migrate"
|
18
|
+
task :remote do |command|
|
19
|
+
Cumuli::CLI::RemoteCommand.new(ARGV).perform
|
20
|
+
end
|
13
21
|
end
|
data/lib/cumuli/version.rb
CHANGED
data/spec/app/app_spec.rb
CHANGED
data/spec/cli/args_spec.rb
CHANGED
@@ -3,15 +3,15 @@ require 'spec_helper'
|
|
3
3
|
describe Cumuli::CLI::Args do
|
4
4
|
let(:argv) { ["../mactivator", "-p", "4000"] }
|
5
5
|
let(:args) { Cumuli::CLI::Args.new(argv) }
|
6
|
-
|
6
|
+
|
7
7
|
it "#dir will return the first element passed in" do
|
8
8
|
args.dir.should == "../mactivator"
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
it "#name is correctly determined from the directory" do
|
12
12
|
args.name.should == 'mactivator'
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
it "#foreman_options should be a string representation of the rest of the arguments" do
|
16
16
|
args.foreman_options.should == '-p 4000'
|
17
17
|
end
|
data/spec/cli/commander_spec.rb
CHANGED
@@ -2,8 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Cumuli::CLI::Commander do
|
4
4
|
describe "#build" do
|
5
|
-
let(:
|
6
|
-
let(:commander) { Cumuli::CLI::Commander.new(
|
5
|
+
let(:command) { 'foreman start -p 3030' }
|
6
|
+
let(:commander) { Cumuli::CLI::Commander.new(command) }
|
7
7
|
|
8
8
|
context "application directory has no .rvmrc" do
|
9
9
|
before do
|
@@ -26,8 +26,8 @@ describe Cumuli::CLI::Commander do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
30
|
-
commander.build.should match(
|
29
|
+
it "concludes with the command" do
|
30
|
+
commander.build.should match(/#{command}$/)
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "reading from the file system" do
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Cumuli::CLI::RemoteCommand do
|
4
|
+
let(:argv) { ["cumuli:remote[rake db:migrate]", "DIR=./mactivator"] }
|
5
|
+
let(:remote_command) { Cumuli::CLI::RemoteCommand.new(argv) }
|
6
|
+
|
7
|
+
it "parses the directory from the arguments" do
|
8
|
+
remote_command.dir.should == "./mactivator"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "constructs a command using the Commander" do
|
12
|
+
commander = double(build: 'yup')
|
13
|
+
Cumuli::CLI::Commander.should_receive(:new)
|
14
|
+
.with("rake db:migrate")
|
15
|
+
.and_return(commander)
|
16
|
+
remote_command.command.should == 'yup'
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cumuli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SocialChorus
|
8
8
|
- Kane Baccigalupi
|
9
9
|
- Fito von Zastrow
|
10
10
|
- Roy Pfaffman
|
11
|
+
- Sowjanya Mudunuri
|
11
12
|
autorequire:
|
12
13
|
bindir: bin
|
13
14
|
cert_chain: []
|
14
|
-
date: 2013-07-
|
15
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
15
16
|
dependencies:
|
16
17
|
- !ruby/object:Gem::Dependency
|
17
18
|
name: foreman
|
@@ -96,6 +97,7 @@ files:
|
|
96
97
|
- lib/cumuli/cli/args.rb
|
97
98
|
- lib/cumuli/cli/cli.rb
|
98
99
|
- lib/cumuli/cli/commander.rb
|
100
|
+
- lib/cumuli/cli/remote_command.rb
|
99
101
|
- lib/cumuli/cli/terminal.rb
|
100
102
|
- lib/cumuli/facade.rb
|
101
103
|
- lib/cumuli/ps.rb
|
@@ -107,6 +109,7 @@ files:
|
|
107
109
|
- spec/app/procs_spec.rb
|
108
110
|
- spec/cli/args_spec.rb
|
109
111
|
- spec/cli/commander_spec.rb
|
112
|
+
- spec/cli/remote_command_spec.rb
|
110
113
|
- spec/cli/terminal_spec.rb
|
111
114
|
- spec/fixtures/app_set/Procfile
|
112
115
|
- spec/fixtures/app_set/loopy/.rvmrc
|
@@ -149,6 +152,7 @@ test_files:
|
|
149
152
|
- spec/app/procs_spec.rb
|
150
153
|
- spec/cli/args_spec.rb
|
151
154
|
- spec/cli/commander_spec.rb
|
155
|
+
- spec/cli/remote_command_spec.rb
|
152
156
|
- spec/cli/terminal_spec.rb
|
153
157
|
- spec/fixtures/app_set/Procfile
|
154
158
|
- spec/fixtures/app_set/loopy/.rvmrc
|