borg-rb 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +4 -0
- data/CHANGELOG.md +3 -2
- data/Capfile +1 -1
- data/README.md +2 -3
- data/bin/borg +1 -0
- data/bin/borgify +7 -1
- data/lib/borg/cli/assimilator.rb +17 -0
- data/lib/borg/configuration/assimilator.rb +11 -4
- data/lib/borg/version.rb +1 -1
- data/lib/borg-rb.rb +10 -0
- data/skeleton/Capfile +2 -3
- data/skeleton/cap/{recipies → recipes}/.gitkeep +0 -0
- data/spec/acceptance/borgify_plugin_spec.rb +17 -0
- data/spec/acceptance/borgify_spec.rb +11 -26
- data/spec/lib/borg/configuration/assimilator_spec.rb +15 -3
- data/spec/spec_helper.rb +15 -0
- data/spec/support/shared_contexts/acceptance.rb +0 -1
- metadata +7 -6
- data/lib/borg.rb +0 -8
- data/spec/acceptance_spec_helper.rb +0 -16
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjdkOGNhMjJlZGQwOTc2NTVhZjMzYTkwODdlMDVjZWM1M2ExYjRlZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWEzNzg2OGIxNDE2YjdlNTM5NjE3Zjc5ZmFiMjZmNGFhZDlmOGZlOQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Nzg3Y2QyMzhjYWZjZDQ1Zjc2ZWYyYzg1OGUxZmE2YmIwYzRiY2I5NWE4ZjJl
|
10
|
+
YjVkNTdkZTBiMWRkNDc2YmIxZTMzZTJlNTdjOTY4M2U2MWNhNzU1ZjQ5Yzgz
|
11
|
+
MTA4YmZmNDUwNTdjZWJjNjllYzMzMzUxMzVhMDk3MDQ4MDVjNGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NmRlNWFlMGI5MGUwYjQ5MTJhM2I1YjQ3MGU3MDdlMDVmMDU5ZjAxODM5NjBk
|
14
|
+
NzRhNWViNzQ5NWRlNWIyNmMxYmU5NTA4NDE4MzExOWRlODhmNGJjMDYyODUy
|
15
|
+
ZjMxMDVkZjFjMjZjMjRlODQ5NzNlYTYzZDdjN2I1ZmE2NjU3NmI=
|
data/.gitignore
CHANGED
@@ -6,6 +6,7 @@ Gemfile.lock
|
|
6
6
|
InstalledFiles
|
7
7
|
coverage
|
8
8
|
lib/bundler/man
|
9
|
+
vender/bundle
|
9
10
|
pkg
|
10
11
|
rdoc
|
11
12
|
spec/reports
|
@@ -14,7 +15,10 @@ test/version_tmp
|
|
14
15
|
tmp
|
15
16
|
|
16
17
|
# Local Ruby Dev Configs
|
18
|
+
# Why? We aren't tied to a specific ruby version, should work on 1.9, 2.0, jruby, etc...
|
19
|
+
# Let our travis config dictate what ruby to run our gem in.
|
17
20
|
.rvmrc
|
21
|
+
.ruby-version
|
18
22
|
|
19
23
|
# YARD artifacts
|
20
24
|
.yardoc
|
data/CHANGELOG.md
CHANGED
data/Capfile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
require 'borg-rb'
|
data/README.md
CHANGED
@@ -36,9 +36,8 @@ my-deployer-package
|
|
36
36
|
# runs on :exit events when ctrl-c is hit
|
37
37
|
# set :borg_sigint_triggers_exit, true
|
38
38
|
|
39
|
-
|
40
|
-
#
|
41
|
-
# NOTE: require ends up causing the initializers to be called every time a config is loaded.
|
39
|
+
require 'borg-rb'
|
40
|
+
# require any other borg gems here.
|
42
41
|
|
43
42
|
```
|
44
43
|
|
data/bin/borg
CHANGED
data/bin/borgify
CHANGED
@@ -10,7 +10,13 @@ if ARGV.empty? or plugin
|
|
10
10
|
FileUtils.cp_r("#{skeleton_dir}/.", ".")
|
11
11
|
|
12
12
|
puts "Creating lib/#{gem_name}.rb"
|
13
|
-
File.open("lib/#{gem_name}.rb", 'w')
|
13
|
+
File.open("lib/#{gem_name}.rb", 'w') do |file|
|
14
|
+
file.write(<<-GEMRB)
|
15
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
16
|
+
assimilate "#{gem_name}"
|
17
|
+
end
|
18
|
+
GEMRB
|
19
|
+
end
|
14
20
|
|
15
21
|
puts "Removing unnecessary files and folders"
|
16
22
|
if plugin
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Borg
|
2
|
+
module CLI
|
3
|
+
module Assimilator
|
4
|
+
def self.included(base) #:nodoc:
|
5
|
+
base.send :alias_method, :execute_requested_actions_without_assimilator, :execute_requested_actions
|
6
|
+
base.send :alias_method, :execute_requested_actions, :execute_requested_actions_with_assimilator
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute_requested_actions_with_assimilator(config)
|
10
|
+
config.assimilate!
|
11
|
+
execute_requested_actions_without_assimilator config
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Capistrano::CLI.send :include, Borg::CLI::Assimilator
|
@@ -2,11 +2,18 @@ module Borg
|
|
2
2
|
module Configuration
|
3
3
|
module Assimilator
|
4
4
|
def assimilate gem_name
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
@to_assimilate ||= {}
|
6
|
+
@to_assimilate[gem_name] = Gem::Specification.find_by_name(gem_name).gem_dir
|
7
|
+
end
|
8
|
+
|
9
|
+
def assimilate!
|
10
|
+
@to_assimilate ||= {}
|
11
|
+
@to_assimilate.each do |gem_name, gem_home|
|
12
|
+
Dir["#{gem_home}/cap/initializers/**/*.rb"].each do |file|
|
13
|
+
load file
|
14
|
+
end
|
15
|
+
@load_paths << "#{gem_home}/cap"
|
8
16
|
end
|
9
|
-
@load_paths << "#{gem_home}/cap"
|
10
17
|
end
|
11
18
|
end
|
12
19
|
end
|
data/lib/borg/version.rb
CHANGED
data/lib/borg-rb.rb
ADDED
data/skeleton/Capfile
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
# runs on :exit events when ctrl-c is hit
|
5
5
|
# set :borg_sigint_triggers_exit, true
|
6
6
|
|
7
|
-
|
7
|
+
require "borg-rb"
|
8
8
|
|
9
|
-
#
|
10
|
-
# NOTE: require ends up causing the initializers to be called every time a config is loaded.
|
9
|
+
# require any other borg gems here.
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "borgify plugin" do
|
4
|
+
include_context "acceptance"
|
5
|
+
|
6
|
+
before do
|
7
|
+
assert_execute("borgify", "plugin")
|
8
|
+
@workdir = environment.workdir_path
|
9
|
+
end
|
10
|
+
|
11
|
+
it "creates the right files and directories" do
|
12
|
+
# the gemspec
|
13
|
+
directory_name = File.basename(@workdir = environment.workdir_path)
|
14
|
+
gemspec = @workdir = environment.workdir_path.join("#{directory_name}.gemspec")
|
15
|
+
expect(gemspec.file?).to be_true
|
16
|
+
end
|
17
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "borgify" do
|
4
4
|
include_context "acceptance"
|
@@ -11,39 +11,24 @@ describe "borgify" do
|
|
11
11
|
it "creates the right files and directories" do
|
12
12
|
# Gemfile
|
13
13
|
gemfile = @workdir.join("Gemfile")
|
14
|
-
expect(gemfile.
|
15
|
-
|
16
|
-
expect(
|
14
|
+
expect(gemfile.file?).to be_true
|
15
|
+
gemfile_contents = gemfile.read
|
16
|
+
expect(gemfile_contents).to match(/^source "https:\/\/rubygems.org"$/)
|
17
|
+
expect(gemfile_contents).to match(/borg-rb/)
|
17
18
|
|
18
19
|
# Capfile
|
19
20
|
capfile = @workdir.join("Capfile")
|
20
|
-
expect(capfile.
|
21
|
+
expect(capfile.file?).to be_true
|
21
22
|
|
22
23
|
# lib directory
|
23
24
|
capfile = @workdir.join("lib")
|
24
|
-
expect(capfile.
|
25
|
+
expect(capfile.directory?).to be_true
|
25
26
|
|
26
27
|
# cap directory with the subdirectories: applications, initializers, recipes
|
27
28
|
cap_dir = @workdir.join("cap")
|
28
|
-
expect(cap_dir.
|
29
|
-
expect(cap_dir.join("applications")).to be_true
|
30
|
-
expect(cap_dir.join("initializers")).to be_true
|
31
|
-
expect(cap_dir.join("recipes")).to be_true
|
29
|
+
expect(cap_dir.directory?).to be_true
|
30
|
+
expect(cap_dir.join("applications").directory?).to be_true
|
31
|
+
expect(cap_dir.join("initializers").directory?).to be_true
|
32
|
+
expect(cap_dir.join("recipes").directory?).to be_true
|
32
33
|
end
|
33
34
|
end
|
34
|
-
|
35
|
-
describe "borgify plugin" do
|
36
|
-
include_context "acceptance"
|
37
|
-
|
38
|
-
before do
|
39
|
-
assert_execute("borgify", "plugin")
|
40
|
-
@workdir = environment.workdir_path
|
41
|
-
end
|
42
|
-
|
43
|
-
it "creates the right files and directories" do
|
44
|
-
# the gemspec
|
45
|
-
directory_name = File.basename(@workdir = environment.workdir_path)
|
46
|
-
gemspec = @workdir = environment.workdir_path.join("#{directory_name}.gemspec")
|
47
|
-
expect(gemspec.exist?).to be_true
|
48
|
-
end
|
49
|
-
end
|
@@ -6,18 +6,30 @@ describe Borg::Configuration::Assimilator do
|
|
6
6
|
Capistrano::Configuration.new.should respond_to :assimilate
|
7
7
|
end
|
8
8
|
|
9
|
-
context "when assimilate('borg') is called" do
|
9
|
+
context "when #assimilate('borg-rb') is called" do
|
10
10
|
subject { Capistrano::Configuration.new }
|
11
|
+
it "should add to the to_assimilate list" do
|
12
|
+
lambda {subject.assimilate('borg-rb')}.should change {subject.instance_eval("@to_assimilate")}.from(nil).to({'borg-rb' => Gem::Specification.find_by_name('borg-rb').gem_dir})
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "when #assimilate! is called" do
|
17
|
+
before do
|
18
|
+
@config = Capistrano::Configuration.new
|
19
|
+
@config.assimilate('borg-rb')
|
20
|
+
end
|
21
|
+
|
22
|
+
subject { @config }
|
11
23
|
it "should loads all the initializers" do
|
12
24
|
Dir["cap/initializers/**/*.rb"].each do |file|
|
13
25
|
subject.should_receive(:load).with(File.expand_path(file))
|
14
26
|
end
|
15
|
-
subject.assimilate
|
27
|
+
subject.assimilate!
|
16
28
|
end
|
17
29
|
|
18
30
|
it "should add the cap directory to teh load path" do
|
19
31
|
Dir.stub("[]").and_return([])
|
20
|
-
lambda { subject.assimilate
|
32
|
+
lambda { subject.assimilate! }.should change(subject.load_paths, :count).by 1
|
21
33
|
end
|
22
34
|
end
|
23
35
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,2 +1,17 @@
|
|
1
1
|
require 'capistrano/cli'
|
2
2
|
require 'yaml'
|
3
|
+
|
4
|
+
Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
8
|
+
config.run_all_when_everything_filtered = true
|
9
|
+
config.filter_run :focus
|
10
|
+
|
11
|
+
# Run specs in random order to surface order dependencies. If you find an
|
12
|
+
# order dependency and want to debug it, you can fix the order by providing
|
13
|
+
# the seed, which is printed after each run.
|
14
|
+
# --seed 1234
|
15
|
+
config.order = 'random'
|
16
|
+
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: borg-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Identified
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -118,8 +118,9 @@ files:
|
|
118
118
|
- cap/initializers/performance.rb
|
119
119
|
- cap/initializers/role_reset.rb
|
120
120
|
- cap/initializers/sigint.rb
|
121
|
-
- lib/borg.rb
|
121
|
+
- lib/borg-rb.rb
|
122
122
|
- lib/borg/cli/applications.rb
|
123
|
+
- lib/borg/cli/assimilator.rb
|
123
124
|
- lib/borg/configuration/applications.rb
|
124
125
|
- lib/borg/configuration/assimilator.rb
|
125
126
|
- lib/borg/configuration/stages.rb
|
@@ -131,11 +132,11 @@ files:
|
|
131
132
|
- skeleton/Gemfile
|
132
133
|
- skeleton/cap/applications/.gitkeep
|
133
134
|
- skeleton/cap/initializers/.gitkeep
|
134
|
-
- skeleton/cap/
|
135
|
+
- skeleton/cap/recipes/.gitkeep
|
135
136
|
- skeleton/lib/.gitkeep
|
136
137
|
- skeleton/mygem.gemspec.skeleton
|
138
|
+
- spec/acceptance/borgify_plugin_spec.rb
|
137
139
|
- spec/acceptance/borgify_spec.rb
|
138
|
-
- spec/acceptance_spec_helper.rb
|
139
140
|
- spec/lib/borg/cli/applications_spec.rb
|
140
141
|
- spec/lib/borg/configuration/applications_spec.rb
|
141
142
|
- spec/lib/borg/configuration/assimilator_spec.rb
|
@@ -172,8 +173,8 @@ signing_key:
|
|
172
173
|
specification_version: 4
|
173
174
|
summary: Ruby-based software provisioning and deployment framework
|
174
175
|
test_files:
|
176
|
+
- spec/acceptance/borgify_plugin_spec.rb
|
175
177
|
- spec/acceptance/borgify_spec.rb
|
176
|
-
- spec/acceptance_spec_helper.rb
|
177
178
|
- spec/lib/borg/cli/applications_spec.rb
|
178
179
|
- spec/lib/borg/configuration/applications_spec.rb
|
179
180
|
- spec/lib/borg/configuration/assimilator_spec.rb
|
data/lib/borg.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
|
4
|
-
|
5
|
-
RSpec.configure do |config|
|
6
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
7
|
-
config.run_all_when_everything_filtered = true
|
8
|
-
config.filter_run :focus
|
9
|
-
|
10
|
-
# Run specs in random order to surface order dependencies. If you find an
|
11
|
-
# order dependency and want to debug it, you can fix the order by providing
|
12
|
-
# the seed, which is printed after each run.
|
13
|
-
# --seed 1234
|
14
|
-
config.order = 'random'
|
15
|
-
|
16
|
-
end
|