braid 1.1.4 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/exe/braid +11 -0
  3. data/lib/braid/check_gem.rb +58 -0
  4. data/lib/braid/command.rb +13 -0
  5. data/lib/braid/commands/diff.rb +1 -1
  6. data/lib/braid/config.rb +28 -4
  7. data/{bin/braid → lib/braid/main.rb} +1 -16
  8. data/lib/braid/mirror.rb +110 -23
  9. data/lib/braid/operations.rb +9 -6
  10. data/lib/braid/operations_lite.rb +19 -1
  11. data/lib/braid/sorbet/fake_runtime.rb +68 -0
  12. data/lib/braid/sorbet/setup.rb +18 -0
  13. data/lib/braid/version.rb +1 -1
  14. data/lib/braid.rb +21 -0
  15. metadata +12 -75
  16. data/.gitignore +0 -16
  17. data/.travis.yml +0 -15
  18. data/CONTRIBUTING.md +0 -24
  19. data/Gemfile +0 -3
  20. data/README.md +0 -234
  21. data/Rakefile +0 -12
  22. data/_config.yml +0 -1
  23. data/braid.gemspec +0 -35
  24. data/braids-json.schema.json +0 -91
  25. data/config_versions.md +0 -58
  26. data/spec/config_spec.rb +0 -59
  27. data/spec/fixtures/shiny/README +0 -3
  28. data/spec/fixtures/shiny/other-skit/layout.liquid +0 -219
  29. data/spec/fixtures/shiny/skit-layout.liquid.test +0 -2
  30. data/spec/fixtures/shiny/skit1.test +0 -2
  31. data/spec/fixtures/shiny-conf-1.0.9-lock/.braids.json +0 -10
  32. data/spec/fixtures/shiny-conf-1.0.9-lock/expected.braids.json +0 -9
  33. data/spec/fixtures/shiny-conf-1.0.9-lock/skit1/layouts/layout.liquid +0 -219
  34. data/spec/fixtures/shiny-conf-1.0.9-lock/skit1/preview.png +0 -0
  35. data/spec/fixtures/shiny-conf-breaking-changes/.braids +0 -14
  36. data/spec/fixtures/shiny-conf-breaking-changes/Spoon-Knife/README.md +0 -9
  37. data/spec/fixtures/shiny-conf-breaking-changes/Spoon-Knife/index.html +0 -20
  38. data/spec/fixtures/shiny-conf-breaking-changes/Spoon-Knife/styles.css +0 -17
  39. data/spec/fixtures/shiny-conf-breaking-changes/expected.braids.json +0 -10
  40. data/spec/fixtures/shiny-conf-breaking-changes/skit1/layouts/layout.liquid +0 -219
  41. data/spec/fixtures/shiny-conf-breaking-changes/skit1/preview.png +0 -0
  42. data/spec/fixtures/shiny-conf-future/.braids.json +0 -10
  43. data/spec/fixtures/shiny-conf-future/skit1/layouts/layout.liquid +0 -219
  44. data/spec/fixtures/shiny-conf-future/skit1/preview.png +0 -0
  45. data/spec/fixtures/shiny-conf-json-old-name/.braids +0 -9
  46. data/spec/fixtures/shiny-conf-json-old-name/expected.braids.json +0 -10
  47. data/spec/fixtures/shiny-conf-json-old-name/skit1/layouts/layout.liquid +0 -219
  48. data/spec/fixtures/shiny-conf-json-old-name/skit1/preview.png +0 -0
  49. data/spec/fixtures/shiny-conf-yaml/.braids +0 -8
  50. data/spec/fixtures/shiny-conf-yaml/expected.braids.json +0 -10
  51. data/spec/fixtures/shiny-conf-yaml/skit1/layouts/layout.liquid +0 -219
  52. data/spec/fixtures/shiny-conf-yaml/skit1/preview.png +0 -0
  53. data/spec/fixtures/shiny_skit1.2_merged/layouts/layout.liquid +0 -223
  54. data/spec/fixtures/shiny_skit1.2_merged/preview.png +0 -0
  55. data/spec/fixtures/shiny_skit1_conflicting/layouts/layout.liquid +0 -221
  56. data/spec/fixtures/shiny_skit1_conflicting/preview.png +0 -0
  57. data/spec/fixtures/shiny_skit1_mergeable/layouts/layout.liquid +0 -221
  58. data/spec/fixtures/shiny_skit1_mergeable/preview.png +0 -0
  59. data/spec/fixtures/skit1/layouts/layout.liquid +0 -219
  60. data/spec/fixtures/skit1/preview.png +0 -0
  61. data/spec/fixtures/skit1.1/layouts/layout.liquid +0 -219
  62. data/spec/fixtures/skit1.1_with_filter/.gitattributes +0 -1
  63. data/spec/fixtures/skit1.1_with_filter/layouts/layout.liquid +0 -219
  64. data/spec/fixtures/skit1.1_with_filter/preview.png +0 -0
  65. data/spec/fixtures/skit1.1x/layouts/layout.liquid +0 -219
  66. data/spec/fixtures/skit1.2/layouts/layout.liquid +0 -221
  67. data/spec/fixtures/skit1.3/layouts/README.md +0 -1
  68. data/spec/fixtures/skit1.3/layouts/layout.liquid +0 -221
  69. data/spec/fixtures/skit1_with_filter/.gitattributes +0 -1
  70. data/spec/fixtures/skit1_with_filter/layouts/layout.liquid +0 -219
  71. data/spec/fixtures/skit1_with_filter/preview.png +0 -0
  72. data/spec/integration/adding_spec.rb +0 -230
  73. data/spec/integration/config_versioning_spec.rb +0 -222
  74. data/spec/integration/diff_spec.rb +0 -597
  75. data/spec/integration/integration_helper.rb +0 -126
  76. data/spec/integration/push_spec.rb +0 -402
  77. data/spec/integration/remove_spec.rb +0 -81
  78. data/spec/integration/status_spec.rb +0 -165
  79. data/spec/integration/updating_spec.rb +0 -487
  80. data/spec/mirror_spec.rb +0 -119
  81. data/spec/operations_spec.rb +0 -66
  82. data/spec/test_helper.rb +0 -19
data/spec/mirror_spec.rb DELETED
@@ -1,119 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
-
3
- describe 'Braid::Mirror.new_from_options' do
4
- it 'should default branch to master' do
5
- new_from_options('git://path')
6
- expect(@mirror.branch).to eq('master')
7
- end
8
-
9
- it 'should default mirror to last path part, ignoring trailing .git' do
10
- new_from_options('http://path.git')
11
- expect(@mirror.path).to eq('path')
12
- end
13
-
14
- it 'should strip trailing slash from specified path' do
15
- new_from_options('http://path.git', 'path' => 'vendor/tools/mytool/')
16
- expect(@mirror.path).to eq('vendor/tools/mytool')
17
- end
18
-
19
- it 'should define local_ref correctly when default branch specified' do
20
- new_from_options('http://mytool.git')
21
- expect(@mirror.local_ref).to eq('master/braid/mytool/master')
22
- end
23
-
24
- it 'should define local_ref correctly when explicit branch specified' do
25
- new_from_options('http://mytool.git', 'branch' => 'mybranch')
26
- expect(@mirror.local_ref).to eq('mybranch/braid/mytool/mybranch')
27
- end
28
-
29
- it 'should define local_ref correctly when explicit tag specified' do
30
- new_from_options('http://mytool.git', 'tag' => 'v1')
31
- expect(@mirror.local_ref).to eq('tags/v1')
32
- end
33
-
34
- it 'should raise an exception if both tag and branch specified' do
35
- expect {
36
- new_from_options('http://mytool.git', 'tag' => 'v1', 'branch' => 'mybranch')
37
- }.to raise_error(Braid::Mirror::NoTagAndBranch)
38
- end
39
-
40
- it 'should define remote_ref correctly when default branch specified' do
41
- new_from_options('http://mytool.git')
42
- expect(@mirror.remote_ref).to eq('+refs/heads/master')
43
- end
44
-
45
- it 'should define remote_ref correctly when explicit branch specified' do
46
- new_from_options('http://mytool.git', 'branch' => 'mybranch')
47
- expect(@mirror.remote_ref).to eq('+refs/heads/mybranch')
48
- end
49
-
50
- it 'should define remote_ref correctly when explicit tag specified' do
51
- new_from_options('http://mytool.git', 'tag' => 'v1')
52
- expect(@mirror.remote_ref).to eq('+refs/tags/v1')
53
- end
54
-
55
- it 'should define remote correctly when default branch specified' do
56
- new_from_options('http://mytool.git')
57
- expect(@mirror.remote).to eq('master/braid/mytool')
58
- end
59
-
60
- it 'should define remote correctly when explicit branch specified' do
61
- new_from_options('http://mytool.git', 'branch' => 'mybranch')
62
- expect(@mirror.remote).to eq('mybranch/braid/mytool')
63
- end
64
-
65
- it 'should define remote correctly when explicit tag specified' do
66
- new_from_options('http://mytool.git', 'tag' => 'v1')
67
- expect(@mirror.remote).to eq('v1/braid/mytool')
68
- end
69
-
70
- it 'should strip first dot from remote path for dot files and folders' do
71
- new_from_options('http://path.git', 'path' => '.dotfolder/.dotfile.ext')
72
- expect(@mirror.path).to eq('.dotfolder/.dotfile.ext')
73
- expect(@mirror.remote).to eq('master/braid/_dotfolder/_dotfile.ext')
74
- end
75
-
76
- end
77
-
78
- describe 'Braid::Mirror#base_revision' do
79
- it 'should be inferred when no revision is set' do
80
- @mirror = build_mirror
81
- expect(@mirror.revision).to be_nil
82
- @mirror.expects(:inferred_revision).returns('b' * 40)
83
- expect(@mirror.base_revision).to eq('b' * 40)
84
- end
85
-
86
- it 'should be the parsed hash for git mirrors' do
87
- @mirror = build_mirror('revision' => 'a' * 7)
88
- git.expects(:rev_parse).with('a' * 7).returns('a' * 40)
89
- expect(@mirror.base_revision).to eq('a' * 40)
90
- end
91
- end
92
-
93
- describe 'Braid::Mirror#inferred_revision' do
94
- it 'should return the last commit before the most recent update' do
95
- @mirror = new_from_options('git://path')
96
- git.expects(:rev_list).times(2).returns(
97
- "#{'a' * 40}\n",
98
- "commit #{'b' * 40}\n#{'t' * 40}\n"
99
- )
100
- git.expects(:tree_hash).with(@mirror.path, 'a' * 40).returns('t' * 40)
101
- expect(@mirror.send(:inferred_revision)).to eq('b' * 40)
102
- end
103
- end
104
-
105
- describe 'Braid::Mirror#cached?' do
106
- before(:each) do
107
- @mirror = new_from_options('git://path')
108
- end
109
-
110
- it 'should be true when the remote path matches the cache path' do
111
- git.expects(:remote_url).with(@mirror.remote).returns(git_cache.path(@mirror.url))
112
- expect(@mirror).to be_cached
113
- end
114
-
115
- it 'should be false if the remote does not point to the cache' do
116
- git.expects(:remote_url).with(@mirror.remote).returns(@mirror.url)
117
- expect(@mirror).not_to be_cached
118
- end
119
- end
@@ -1,66 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
-
3
- describe 'Braid::Operations::Git#remote_url' do
4
- it 'should use git config' do
5
- # FIXME weak test
6
- git.stubs(:invoke).with(:config, 'remote.braid/git/one.url').returns('git://path')
7
- expect(git.remote_url('braid/git/one')).to eq('git://path')
8
- end
9
- end
10
-
11
- describe 'Braid::Operations::Git#rev_parse' do
12
- it 'should return the full hash when a hash is found' do
13
- full_revision = 'a' * 40
14
- git.expects(:exec).returns([0, full_revision, ''])
15
- expect(git.rev_parse('a' * 7)).to eq(full_revision)
16
- end
17
-
18
- it 'should raise a revision error when the hash is not found' do
19
- ambiguous_revision = 'b' * 7
20
- git.expects(:exec).returns([1, ambiguous_revision, 'fatal: ...'])
21
- expect { git.rev_parse(ambiguous_revision) }.to raise_error(Braid::Operations::UnknownRevision)
22
- end
23
- end
24
-
25
- describe 'Braid::Operations::Git#version' do
26
- ACTUAL_VERSION = '1.5.5.1.98.gf0ec4'
27
-
28
- before(:each) do
29
- git.expects(:exec).returns([0, "git version #{ACTUAL_VERSION}\n", ''])
30
- end
31
-
32
- it 'should extract from git --version output' do
33
- expect(git.version).to eq(ACTUAL_VERSION)
34
- end
35
- end
36
-
37
- describe 'Braid::Operations::Git#require_version' do
38
- REQUIRED_VERSION = '1.5.4.5'
39
- PASS_VERSIONS = %w(1.5.4.6 1.5.5 1.6 1.5.4.5.2 1.5.5.1.98.gf0ec4)
40
- FAIL_VERSIONS = %w(1.5.4.4 1.5.4 1.5.3 1.4.5.6)
41
-
42
- def set_version(str)
43
- git.expects(:exec).returns([0, "git version #{str}\n", ''])
44
- end
45
-
46
- it 'should return true for higher revisions' do
47
- PASS_VERSIONS.each do |version|
48
- set_version(version)
49
- expect(git.require_version(REQUIRED_VERSION)).to eq(true)
50
- end
51
- end
52
-
53
- it 'should return false for lower revisions' do
54
- FAIL_VERSIONS.each do |version|
55
- set_version(version)
56
- expect(git.require_version(REQUIRED_VERSION)).to eq(false)
57
- end
58
- end
59
- end
60
-
61
- describe 'Braid::Operations::GitCache#path' do
62
- it 'should use the local cache directory and strip characters' do
63
- expect(git_cache.path('git://path')).to eq(File.join(Braid.local_cache_dir, 'git___path'))
64
- expect(git_cache.path('git@domain:repository.git')).to eq(File.join(Braid.local_cache_dir, 'git_domain_repository.git'))
65
- end
66
- end
data/spec/test_helper.rb DELETED
@@ -1,19 +0,0 @@
1
- require 'rubygems'
2
- require 'rspec'
3
- require 'mocha/api'
4
-
5
- require File.dirname(__FILE__) + '/../lib/braid'
6
-
7
- def new_from_options(url, options = {})
8
- @mirror = Braid::Mirror.new_from_options(url, options)
9
- end
10
-
11
- def build_mirror(options = {})
12
- Braid::Mirror.new('path', options)
13
- end
14
-
15
- include Braid::Operations::VersionControl
16
-
17
- RSpec.configure do |config|
18
- config.mock_with :mocha
19
- end