monolith 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad09131b0f9bc68e0986cacd61f36d1fd9a29bfa
4
- data.tar.gz: e172518f8110ab6233cbb8d99745a4b237d4d411
3
+ metadata.gz: db6c09688ad0019814c3b23ff10869891f07e1d4
4
+ data.tar.gz: 62ab5dc0c6a694f3c9b80ff3e9ed8956122b19a1
5
5
  SHA512:
6
- metadata.gz: 11e96707a34b01ba60979f4b853e0b0114a73567c6d23cca673107d538c58957a27e195aca4123f0456aea6b27bc45f27ece0372c8f3b2bdeb0d45decf8daa84
7
- data.tar.gz: 6485e4a571247b3c0abf27df3490042c7110f3ecf99dffcd117a686f45f9bc1ba82a37c4626c6af37fcc1f9f693c8627981d40708b4fa2bbfb5fdbb392e47a48
6
+ metadata.gz: d7838b0e76bfc57b9fcd4285fd895187bb510e3fe91de0f6bbae8f19d9614d26bd4cbb0e1e2f2d61e45724ef77115c285e736a3eda3a9fe38c4b8bb7c598699e
7
+ data.tar.gz: 285a7eeef38b1385ee8dc917e3cf470162238f0aff7196380de0673ceeebf57cca6e17201f1ab3b3719b6880b27405fd94d8c3c2c403b4c196cdea3355490cb6
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # [![Sean Huber](https://cloud.githubusercontent.com/assets/2419/6550752/832d9a64-c5ea-11e4-9717-6f9aa6e023b5.png)](https://github.com/shuber) monolith
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/monolith.svg)](http://badge.fury.io/rb/monolith)
3
+ [![Code Climate](https://codeclimate.com/github/shuber/monolith/badges/gpa.svg)](https://codeclimate.com/github/shuber/monolith) [![Gem Version](https://badge.fury.io/rb/monolith.svg)](http://badge.fury.io/rb/monolith)
4
4
 
5
5
  Generates a single monolithic repository from a list of other git repositories
6
6
 
@@ -33,8 +33,27 @@ repositories:
33
33
  auth: git@github.com:some-org/your-auth-gem.git
34
34
  users: git@github.com:some-org/users.git
35
35
 
36
- branches: # optional whitelist
36
+ # Optional whitelist of branches to clone. By default,
37
+ # ALL branches are imported into the monolith.
38
+ branches:
37
39
  - master
40
+
41
+ # Optional list of commands to run right after
42
+ # all of the repositories above have been cloned.
43
+ #
44
+ # These are handy for things like rewriting history
45
+ # to remove large unused files or sensitive information.
46
+ after_clone:
47
+ - ./remove_all_unused_large_files
48
+
49
+ # Optional list of commands to run after the monolith
50
+ # has been generated.
51
+ #
52
+ # These hooks are handy for things like introducing new top-level
53
+ # config files for services like Heroku, CodeClimate, CircleCI, etc.
54
+ after_generate:
55
+ - ./add_global_gitignore
56
+ - ./add_global_slugignore
38
57
  ```
39
58
 
40
59
  Use the `monolith` command to generate a repository at `/path/to/your/new/monolith`
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/monolith'
4
+
5
+ Monolith::CLI.start(ARGV)
@@ -4,6 +4,14 @@ module Monolith
4
4
  @yaml = yaml
5
5
  end
6
6
 
7
+ def after_clone_hooks
8
+ config.fetch("after_clone", [])
9
+ end
10
+
11
+ def after_generate_hooks
12
+ config.fetch("after_generate", [])
13
+ end
14
+
7
15
  def branches
8
16
  config.fetch("branches", [])
9
17
  end
@@ -18,17 +18,36 @@ module Monolith
18
18
 
19
19
  def generate
20
20
  clone
21
- create_monolith
22
21
  fetch_all_remotes
22
+ run_after_clone_hooks
23
+ create_monolith
23
24
  add_remotes_to_monolith
24
25
  prepare_branches_for_merge
25
26
  merge_branches_into_monolith
26
27
  remove_remotes_from_monolith
27
28
  checkout_master_on_monolith
29
+ run_after_generate_hooks
28
30
  end
29
31
 
30
32
  private
31
33
 
34
+ def run_after_clone_hooks
35
+ @monolith.config.after_clone_hooks.each do |hook|
36
+ run_hook(hook)
37
+ end
38
+ end
39
+
40
+ def run_after_generate_hooks
41
+ @monolith.config.after_generate_hooks.each do |hook|
42
+ run_hook(hook)
43
+ end
44
+ end
45
+
46
+ def run_hook(hook)
47
+ log("Running hook #{hook.inspect}")
48
+ system(hook, @monolith.config.path, *branches)
49
+ end
50
+
32
51
  def create_monolith
33
52
  log("Generating monolith #{name.red}")
34
53
  @monolith.create
@@ -83,7 +102,7 @@ module Monolith
83
102
  end
84
103
 
85
104
  def branches
86
- filtered_branches.sort
105
+ @branches ||= filtered_branches.sort
87
106
  end
88
107
 
89
108
  def filtered_branches
@@ -1,3 +1,3 @@
1
1
  module Monolith
2
- VERSION = "0.0.0"
2
+ VERSION = "0.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monolith
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Huber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-29 00:00:00.000000000 Z
11
+ date: 2015-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocaine
@@ -92,6 +92,7 @@ files:
92
92
  - Gemfile.lock
93
93
  - LICENSE
94
94
  - README.md
95
+ - bin/monolith
95
96
  - lib/monolith.rb
96
97
  - lib/monolith/application.rb
97
98
  - lib/monolith/branch.rb
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  version: '0'
141
142
  requirements: []
142
143
  rubyforge_project:
143
- rubygems_version: 2.4.5.1
144
+ rubygems_version: 2.2.5
144
145
  signing_key:
145
146
  specification_version: 4
146
147
  summary: Monolithic git repository generator