git_compound 0.0.10 → 0.1.0

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: 9364d9375f8d63441e365cf7ddcdbd841de74be3
4
- data.tar.gz: 1f7d07c9aabc1626404e73dc6995749c952d48bc
3
+ metadata.gz: e127d67e2392d65dea06cf967be3770cba4144bc
4
+ data.tar.gz: 46dd79cde5f328dd213e7a072cf27b7b69b95fc6
5
5
  SHA512:
6
- metadata.gz: f9455c25a7672dd3cff14035bddef0c697695a1378ce6e8f72bc40b4f6582113e9407a815b750d72bd09904bf18578191a39ffede8adeac79903ee84972980f3
7
- data.tar.gz: 0911ffa0e74ec12bd5a1d97215eed5936d1e18a1ec3630fb9850ce171fba690a6cc101b7d869db146e6afbe85680b601528669811c8f9b8d751ebda1de5d6321
6
+ metadata.gz: 16e0fdc430743a2812def344af9efdae345886414853e0fe4f4566a51f3ff92828403d1c1921ee9d7413a1f6a106a6f3edd7adff96872f1dedad8054581569d8
7
+ data.tar.gz: d17fba0fdfc018cebfd5fe0c7fcad60e5d9a42c334c3e58f9b345cc45b32ab2e3a32e0bb69740305aec26519308d3d994e5a410ec00921c432e7c9d53edda598
data/README.md CHANGED
@@ -4,10 +4,6 @@ Compose your project using git repositories and Ruby tasks.
4
4
 
5
5
  GitCompound combines features of Git submodules and common dependency managers like Bundler or Composer.
6
6
 
7
- ## Status
8
-
9
- This project is in alpha phase
10
-
11
7
  ## Overview
12
8
 
13
9
  Create `Compoundfile` or `.gitcompound` manifest:
@@ -15,26 +11,26 @@ Create `Compoundfile` or `.gitcompound` manifest:
15
11
  ```ruby
16
12
  name :base_component
17
13
 
18
- component :component_1 do
14
+ component :vendor_1 do
19
15
  version '~>1.1'
20
16
  source 'git@github.com:/user/repository'
21
17
  destination 'src/component_1'
22
18
  end
23
19
 
24
- component :component_2 do
20
+ component :second_component do
25
21
  version '>=2.0'
26
22
  source 'git@github.com:/user/repository_2'
27
23
  destination 'src/component_2'
28
24
  end
29
25
 
30
- component :component_3 do
26
+ component :my_component do
31
27
  branch 'feature/new-feature'
32
28
  source '/my/component_3/repository'
33
29
  destination 'src/component_3'
34
30
  end
35
31
 
36
- task 'add components to gitignore', :each do |component_dir|
37
- File.open('.gitignore', 'a') { |f| f.write "#{component_dir}\n" }
32
+ task 'print details', :each do |_path, component|
33
+ puts "Component `#{component.name}` installed in #{component.path}"
38
34
  end
39
35
  ```
40
36
 
@@ -138,6 +134,10 @@ and name constraints
138
134
 
139
135
  * `sha` -- use explicitly set commit **SHA**
140
136
 
137
+ If SHA points to HEAD of some existing branch, this branch will be checked out instead of SHA.
138
+ This will prevent going into detached state. If SHA does not point to any HEAD of existing branch,
139
+ component destination repository will be left in detached state.
140
+
141
141
  4. Provide path to **source** repository using `source` method of manifest domain specific language.
142
142
 
143
143
  It will be used as source to clone repository into destination directory.
@@ -6,7 +6,7 @@ module GitCompound
6
6
  #
7
7
  class Component < Node
8
8
  extend Forwardable
9
- delegate [:sha, :ref, :origin, :repository, :version] => :@source
9
+ delegate [:sha, :ref, :origin, :version] => :@source
10
10
  delegate [:path, :exists?, :repository] => :@destination
11
11
 
12
12
  attr_reader :name
@@ -44,7 +44,7 @@ module GitCompound
44
44
  @destination.repository do |repo|
45
45
  repo.fetch
46
46
  repo.checkout(@source.ref)
47
- repo.merge
47
+ repo.merge if repo.branches.include?(@source.ref)
48
48
  end
49
49
  end
50
50
 
@@ -9,8 +9,13 @@ module GitCompound
9
9
  @sha = sha
10
10
  end
11
11
 
12
+ # If @sha matches ref in remote repository then
13
+ # this ref should be returned
14
+ # else return @sha.
15
+ #
12
16
  def ref
13
- @sha
17
+ ref = @repository.refs.find { |refs_a| refs_a.include?(@sha) }
18
+ ref ? ref.last : @sha
14
19
  end
15
20
 
16
21
  def sha # rubocop:disable Style/TrivialAccessors
@@ -1,3 +1,5 @@
1
+ require 'pathname'
2
+
1
3
  module GitCompound
2
4
  module Repository
3
5
  # Local git repository implementation
@@ -5,8 +7,9 @@ module GitCompound
5
7
  class RepositoryLocal < GitRepository
6
8
  def initialize(source)
7
9
  super
10
+ @source = Pathname.new(@source).expand_path.to_s
8
11
  raise RepositoryUnreachableError unless
9
- File.directory?("#{@source}/.git")
12
+ File.directory?("#{@source}/.git")
10
13
  end
11
14
 
12
15
  def clone(destination, options = nil)
@@ -1,5 +1,5 @@
1
1
  # GitCompound
2
2
  #
3
3
  module GitCompound
4
- VERSION = '0.0.10'
4
+ VERSION = '0.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_compound
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grzegorz Bizon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-21 00:00:00.000000000 Z
11
+ date: 2015-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler