social_snippet 0.0.10 → 0.0.11

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjU4NjgyZmM4MWYyZmRlOWZlNGQ1YmJmNzI0MzExOGI4MmQxODVjOA==
4
+ MGY3ZDIyZTVlYjU3MDA1ZTQxZjJkM2Q1MmVkMDdiNWQwMmMwYzcxOQ==
5
5
  data.tar.gz: !binary |-
6
- NGJlMGFlOGYzMGViMDk0NzU3MjVkN2M3YmIyMDJiYjVmNWQzYTZkYQ==
6
+ NjBlY2E4ZGYyYzU2OTcwNTM4ZmNmMmZkMzU5ZDNiMTNhNDJiNTBkYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2EyZGYwMDhjOTkyOTcyZWM0YzYxMDI2ZjE3YTM3M2NmZWE2N2NjMmE4Nzg2
10
- MThjMjQ4Y2IxOGQ2NjNkNzM5MjMzMDdmYjAwZWJiNGQyMGM5Yjg0MGI1ZGQ2
11
- OTM0Mjc3OThhOWJjMTAwZmE0N2I2OWNhZmFmMjkxOTJkYTcyN2I=
9
+ M2NmNjBkOWEyNjJlYWNmNzdiY2NmOGVhYzdiMGNjNTAyMzA2MDBjOGUwODEz
10
+ ODBkY2I0NjY5ZTIxNDQzZjZiNTk4OTdjMjI4NDI3ODY2MDcxMTM2MDc5OGMy
11
+ NjVmNDNkMGI0MGQ3NjAwMTZhMWVlMDA2MzlmMTcxNjk4ZTQwZTE=
12
12
  data.tar.gz: !binary |-
13
- OTZmNzRhZTI4NmU4N2U1OThkYmNhYzdiNGJmMTA3MWQwZjU3Y2FmMGM4ZmU2
14
- MDZlMGE2OWUwZmI0ODk1OWQ4NWZkNDdlN2VmMWFjNTk2Nzc1NmQxOGEwOWI3
15
- MGI2NTg0MGJmY2Y5Y2M2YjE1YTUyOWY3MWM2ZmJmZWY3ZGRiMDU=
13
+ ZDkxZjIzMjQ3MWFjMGUzMjhkYmNlYmZjMTA4ZDQ5MTJiOTZhMWQ0MzQ4YTBm
14
+ NjRhZTBhOWVjYTA2YTUyNGFhNjc1Y2ZkYTYxYzVhMjg2YTNkMWU0OTZlMDYw
15
+ NmJjMWM0MmEzNzliMzE0ZjJmM2EyMWExOTY3ZmI2NmNhYTg4MGE=
@@ -25,7 +25,7 @@ class SocialSnippet::Core
25
25
  ::SocialSnippet::Repository::Models::Package.core = self
26
26
  ::SocialSnippet::Repository::Models::Repository.core = self
27
27
  @repo_manager = ::SocialSnippet::Repository::RepositoryManager.new(self)
28
- @driver_factory = ::SocialSnippet::Repository::DriverFactory.new(self)
28
+ @driver_factory = ::SocialSnippet::Repository::DriverFactory # TODO
29
29
  @registry_client = ::SocialSnippet::Registry::RegistryClient.new(self)
30
30
  @api = ::SocialSnippet::Api.new(self)
31
31
  end
@@ -1,13 +1,11 @@
1
- module SocialSnippet::Repository
1
+ module SocialSnippet::Repository::DriverFactory
2
2
 
3
- class DriverFactory
3
+ @@drivers = []
4
4
 
5
- @@drivers = [Drivers::GitDriver]
5
+ class << self
6
6
 
7
- attr_reader :core
8
-
9
- def initialize(new_core)
10
- @core = new_core
7
+ def drivers
8
+ @@drivers
11
9
  end
12
10
 
13
11
  def reset_drivers
@@ -15,7 +13,7 @@ module SocialSnippet::Repository
15
13
  end
16
14
 
17
15
  def add_driver(driver_class)
18
- @@drivers.push driver_class
16
+ drivers.push driver_class
19
17
  end
20
18
 
21
19
  # @param url [String] The URL of repository
@@ -27,7 +25,7 @@ module SocialSnippet::Repository
27
25
  end
28
26
 
29
27
  def resolve_driver(url)
30
- driver_class = @@drivers.select do |driver_class|
28
+ driver_class = drivers.select do |driver_class|
31
29
  driver_class.target? url
32
30
  end.first
33
31
  if driver_class.nil?
@@ -40,3 +38,4 @@ module SocialSnippet::Repository
40
38
  end # class << self
41
39
 
42
40
  end # DriverFactory
41
+
@@ -22,28 +22,23 @@ module SocialSnippet::Repository::Drivers
22
22
  rugged_repo.lookup(oid).read_raw.data
23
23
  end
24
24
 
25
- def each_directory(ref)
26
- rugged_ref(ref).target.tree.each do |c|
27
- next unless c[:type] == :tree
28
- yield ::SocialSnippet::Repository::Drivers::Entry.new(c[:name])
25
+ def each_directory(ref, &block)
26
+ rugged_ref(ref).target.tree.walk_trees do |parent, tree|
27
+ yield ::SocialSnippet::Repository::Drivers::Entry.new(join_path(parent, tree[:name]))
29
28
  end
30
29
  end
31
30
 
32
31
  def each_file(ref, &block)
33
- walk_tree rugged_ref(ref).target.tree, ::Array.new, &block
32
+ rugged_ref(ref).target.tree.walk_blobs do |parent, item|
33
+ yield ::SocialSnippet::Repository::Drivers::Entry.new(join_path(parent, item[:name]), read_file(item[:oid]))
34
+ end
34
35
  end
35
36
 
36
- def walk_tree(tree, parents)
37
- tree.each_blob do |c|
38
- path = ::File.join(*parents, c[:name])
39
- yield ::SocialSnippet::Repository::Drivers::Entry.new(path, read_file(c[:oid]))
40
- end
41
- tree.each_tree do |t|
42
- parents.push t[:name]
43
- walk_tree(rugged_repo.lookup(t[:oid]), parents) do |content|
44
- yield content
45
- end
46
- parents.pop
37
+ def join_path(a, b)
38
+ if a.empty?
39
+ b
40
+ else
41
+ ::File.join a, b
47
42
  end
48
43
  end
49
44
 
@@ -97,4 +92,6 @@ module SocialSnippet::Repository::Drivers
97
92
 
98
93
  end # GitDriver
99
94
 
95
+ ::SocialSnippet::Repository::DriverFactory.add_driver GitDriver
96
+
100
97
  end # SocialSnippet
@@ -1,4 +1,3 @@
1
1
  module SocialSnippet::Repository::Drivers; end
2
2
  require_relative "drivers/driver_base"
3
- require_relative "drivers/git_driver"
4
3
  require_relative "drivers/entry"
@@ -8,7 +8,7 @@ module SocialSnippet::Repository::Models
8
8
  field :rev_hash, :type => String # key
9
9
  field :name, :type => String
10
10
  field :paths, :type => Array, :default => ::Array.new
11
- field :dependencies, :type => Hash, :default => ::Hash.new
11
+ field :dependencies_array, :type => Array, :default => ::Array.new
12
12
 
13
13
  def display_name
14
14
  name || "#{repo_name}@#{rev_hash}"
@@ -37,10 +37,19 @@ module SocialSnippet::Repository::Models
37
37
  core.storage.write file_path, data
38
38
  end
39
39
 
40
- def add_dependency(name, ref)
41
- modifier = {}
42
- modifier[name] = ref
43
- push :dependencies => modifier
40
+ def add_dependency(new_name, new_ref)
41
+ add_to_set :dependencies_array => {
42
+ :name => new_name,
43
+ :ref => new_ref,
44
+ }
45
+ @dependencies_cache = nil
46
+ end
47
+
48
+ def dependencies
49
+ @dependencies_cache ||= dependencies_array.inject(::Hash.new) do |dependencies, info|
50
+ dependencies[info[:name]] = info[:ref]
51
+ dependencies
52
+ end
44
53
  end
45
54
 
46
55
  def has_dependencies?
@@ -9,21 +9,39 @@ module SocialSnippet::Repository::Models
9
9
  field :current_ref, :type => String
10
10
  field :refs, :type => Array, :default => ::Array.new
11
11
  # rev_hash[ref] => Commit ID
12
- field :rev_hash, :type => Hash, :default => ::Hash.new
12
+ field :rev_hash_array, :type => Array, :default => ::Array.new
13
13
  # package_refs[ref] => rev_hash
14
- field :package_refs, :type => Hash, :default => ::Hash.new
14
+ field :package_refs_array, :type => Array, :default => ::Array.new
15
15
 
16
- def add_package(ref)
17
- modifier = ::Hash.new
18
- modifier[ref] = rev_hash[ref]
19
- push :package_refs => modifier
16
+ def rev_hash
17
+ @rev_hash_cache ||= rev_hash_array.inject(::Hash.new) do |rev_hash, info|
18
+ rev_hash[info[:ref]] = info[:rev_hash]
19
+ rev_hash
20
+ end
20
21
  end
21
22
 
22
- def add_ref(ref, rev_hash)
23
- add_to_set :refs => ref
24
- modifier = ::Hash.new
25
- modifier[ref] = rev_hash
26
- push :rev_hash => modifier
23
+ def package_refs
24
+ @package_refs_cache ||= package_refs_array.inject(::Hash.new) do |package_refs, info|
25
+ package_refs[info[:ref]] = info[:rev_hash]
26
+ package_refs
27
+ end
28
+ end
29
+
30
+ def add_package(new_ref)
31
+ add_to_set :package_refs_array => {
32
+ :ref => new_ref,
33
+ :rev_hash => rev_hash[new_ref],
34
+ }
35
+ @package_refs_cache = nil
36
+ end
37
+
38
+ def add_ref(new_ref, new_rev_hash)
39
+ add_to_set :refs => new_ref
40
+ add_to_set :rev_hash_array => {
41
+ :ref => new_ref,
42
+ :rev_hash => new_rev_hash,
43
+ }
44
+ @rev_hash_cache = nil
27
45
  end
28
46
 
29
47
  def has_ref?(ref)
@@ -16,7 +16,7 @@ module SocialSnippet::Repository
16
16
  # @param context [::SocialSnippet::Context] The context of snippet
17
17
  # @param tag [::SocialSnippet::Tag] The tag of snippet
18
18
  def get_snippet(context, tag)
19
- ::SocialSnippet::Snippet.new(resolve_snippet_path(context, tag))
19
+ ::SocialSnippet::Snippet.new(core, resolve_snippet_path(context, tag))
20
20
  end
21
21
 
22
22
  # Resolve snippet path by context and tag
@@ -1,6 +1,6 @@
1
1
  module SocialSnippet::Repository; end
2
- require_relative "repository/drivers"
3
2
  require_relative "repository/driver_factory"
3
+ require_relative "repository/drivers"
4
4
  require_relative "repository/repository_manager"
5
5
  require_relative "repository/repository_errors"
6
6
  require_relative "repository/models"
@@ -26,7 +26,7 @@ module SocialSnippet
26
26
  def insert(text)
27
27
  raise "must be passed string" unless text.is_a?(String)
28
28
 
29
- snippet = Snippet.new_text(text)
29
+ snippet = Snippet.new_text(core, text)
30
30
  snippet.snippet_tags.each do |tag_info|
31
31
  visit tag_info[:tag]
32
32
  end
@@ -17,6 +17,15 @@ RSpec.configure do
17
17
 
18
18
  before { driver.fetch }
19
19
 
20
+ describe "#snippet_json" do
21
+
22
+ context "driver.snippet_json" do
23
+ subject { driver.snippet_json }
24
+ it { should include "name" => "example-repo" }
25
+ end
26
+
27
+ end
28
+
20
29
  describe "#each_file" do
21
30
  context "get files" do
22
31
  let(:files) { ::Hash.new }
@@ -25,17 +34,35 @@ RSpec.configure do
25
34
  files[file.path] = file.data
26
35
  end
27
36
  end
28
- context "check files" do
29
- subject { files }
30
- it { should include "README.md" }
31
- it { should include "snippet.json" }
32
- it { should include "src/func.cpp" }
33
- it { should include "src/func/sub_func_1.cpp" }
34
- it { should include "src/func/sub_func_2.cpp" }
35
- it { should include "src/func/sub_func_3.cpp" }
36
- it { expect(files["snippet.json"]).to match "example-repo" }
37
- it { expect(files["src/func/sub_func_1.cpp"]).to match "int sub_func_1()" }
37
+ subject { files }
38
+ it { should include "README.md" }
39
+ it { should include "snippet.json" }
40
+ it { should include "src/func.cpp" }
41
+ it { should include "src/func/sub_func_1.cpp" }
42
+ it { should include "src/func/sub_func_2.cpp" }
43
+ it { should include "src/func/sub_func_3.cpp" }
44
+ it { expect(files["snippet.json"]).to match "example-repo" }
45
+ it { expect(files["src/func/sub_func_1.cpp"]).to match "int sub_func_1()" }
46
+ end
47
+ end
48
+
49
+ describe "#each_directory" do
50
+ context "find directories" do
51
+ let(:directories) { ::Array.new }
52
+ before do
53
+ driver.each_directory("1.0.2") do |dir|
54
+ directories.push dir.path
55
+ end
38
56
  end
57
+ subject { directories }
58
+ it { should include "src" }
59
+ it { should include "src/func" }
60
+ it { should_not include "README.md" }
61
+ it { should_not include "snippet.json" }
62
+ it { should_not include "src/func.cpp" }
63
+ it { should_not include "src/func/sub_func_1.cpp" }
64
+ it { should_not include "src/func/sub_func_2.cpp" }
65
+ it { should_not include "src/func/sub_func_3.cpp" }
39
66
  end
40
67
  end
41
68
 
@@ -2,19 +2,21 @@ module SocialSnippet
2
2
 
3
3
  class Snippet
4
4
 
5
+ attr_reader :core
5
6
  attr_reader :filepath
6
7
  attr_reader :code
7
8
  attr_reader :flag_no_tag
8
9
 
9
10
  # Constructor
10
- def initialize(snippet_path)
11
+ def initialize(new_core, snippet_path)
12
+ @core = new_core
11
13
  @filepath = snippet_path
12
14
  read_file unless filepath.nil?
13
15
  end
14
16
 
15
17
  def read_file
16
18
  begin
17
- @code = ::File.read(filepath).split($/)
19
+ @code = core.storage.read(filepath).split($/)
18
20
  rescue ::Errno::ENOENT => e
19
21
  @code = ["ERROR: #{e.to_s}"]
20
22
  end
@@ -44,9 +46,9 @@ module SocialSnippet
44
46
  class << self
45
47
 
46
48
  # Create instance by text
47
- def new_text(s)
49
+ def new_text(new_core, s)
48
50
  raise "must be passed string" unless s.is_a?(String)
49
- snippet = self.new(nil)
51
+ snippet = self.new(new_core, nil)
50
52
  snippet.read_text s
51
53
  snippet
52
54
  end
@@ -1,6 +1,6 @@
1
1
  module SocialSnippet
2
2
 
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
 
5
5
  module Version
6
6
 
@@ -8,7 +8,6 @@ require "version_sorter"
8
8
  require "rest_client"
9
9
  require "optparse"
10
10
  require "uri"
11
- require "rugged"
12
11
  require "wisper"
13
12
  require "securerandom"
14
13
 
@@ -33,6 +32,9 @@ require_relative "social_snippet/storage"
33
32
  require_relative "social_snippet/document_backend"
34
33
  require_relative "social_snippet/document"
35
34
 
35
+ # supports
36
+ require "social_snippet/supports/git"
37
+
36
38
  # use file system as default storage backend
37
39
  SocialSnippet::StorageBackend::FileSystemStorage.activate!
38
40
  # use yaml as default document backend
@@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
20
20
  spec.required_ruby_version = ">= 1.9.3"
21
21
 
22
22
  spec.add_runtime_dependency "version_sorter", "~> 2.0.0"
23
- spec.add_runtime_dependency "rugged", ["~> 0.21.4", ">= 0.21.4"]
24
23
  spec.add_runtime_dependency "rest-client", "~> 1.7.0"
25
24
  spec.add_runtime_dependency "highline", "~> 1.7.0"
26
25
  spec.add_runtime_dependency "wisper", "~> 1.6.0"
26
+ spec.add_runtime_dependency "social_snippet-supports-git", "~> 0.1.0"
27
27
 
28
28
  spec.add_development_dependency "bundler"
29
29
  spec.add_development_dependency "rake"
@@ -73,7 +73,7 @@ module SocialSnippet::SpecHelpers
73
73
  end
74
74
 
75
75
  def fake_driver_factory
76
- @fake_driver_factory ||= ::SocialSnippet::Repository::DriverFactory.new(fake_core)
76
+ @fake_driver_factory ||= ::SocialSnippet::Repository::DriverFactory
77
77
  end
78
78
 
79
79
  def fake_registry_client
@@ -22,7 +22,7 @@ describe SocialSnippet::Resolvers::InsertResolver do
22
22
  pkg
23
23
  end
24
24
  allow(fake_core.repo_manager).to receive(:get_snippet) do |c, t|
25
- ::SocialSnippet::Snippet.new_text(t.repo)
25
+ ::SocialSnippet::Snippet.new_text(fake_core, t.repo)
26
26
  end
27
27
  end
28
28
 
@@ -32,11 +32,11 @@ describe SocialSnippet::Resolvers::InsertResolver do
32
32
 
33
33
  before do
34
34
  allow(fake_core.repo_manager).to receive(:get_snippet) do |c, t|
35
- ::SocialSnippet::Snippet.new_text([
35
+ ::SocialSnippet::Snippet.new_text(fake_core, [
36
36
  "def foo",
37
37
  " 42",
38
38
  "end",
39
- ].join $/)
39
+ ].join($/))
40
40
  end
41
41
  end # prepare snippet
42
42
 
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  describe ::SocialSnippet::Repository::DriverFactory do
4
4
 
5
- let(:driver_factory) { ::SocialSnippet::Repository::DriverFactory.new fake_core }
5
+ let(:driver_factory) { ::SocialSnippet::Repository::DriverFactory }
6
6
 
7
7
  class FakeGitDriver < ::SocialSnippet::Repository::Drivers::DriverBase
8
8
 
data/test/snippet_test.rb CHANGED
@@ -29,7 +29,7 @@ module SocialSnippet
29
29
  ]
30
30
  end
31
31
 
32
- let(:snippet) { Snippet.new nil }
32
+ let(:snippet) { Snippet.new fake_core, nil }
33
33
  before { snippet.read_text input.join($/) }
34
34
  subject { snippet.lines }
35
35
  it { should eq expected }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_snippet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroyuki Sano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-16 00:00:00.000000000 Z
11
+ date: 2015-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: version_sorter
@@ -25,27 +25,21 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: rugged
28
+ name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.21.4
34
- - - ! '>='
35
- - !ruby/object:Gem::Version
36
- version: 0.21.4
33
+ version: 1.7.0
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - ~>
42
39
  - !ruby/object:Gem::Version
43
- version: 0.21.4
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: 0.21.4
40
+ version: 1.7.0
47
41
  - !ruby/object:Gem::Dependency
48
- name: rest-client
42
+ name: highline
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - ~>
@@ -59,33 +53,33 @@ dependencies:
59
53
  - !ruby/object:Gem::Version
60
54
  version: 1.7.0
61
55
  - !ruby/object:Gem::Dependency
62
- name: highline
56
+ name: wisper
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - ~>
66
60
  - !ruby/object:Gem::Version
67
- version: 1.7.0
61
+ version: 1.6.0
68
62
  type: :runtime
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
66
  - - ~>
73
67
  - !ruby/object:Gem::Version
74
- version: 1.7.0
68
+ version: 1.6.0
75
69
  - !ruby/object:Gem::Dependency
76
- name: wisper
70
+ name: social_snippet-supports-git
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
73
  - - ~>
80
74
  - !ruby/object:Gem::Version
81
- version: 1.6.0
75
+ version: 0.1.0
82
76
  type: :runtime
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
80
  - - ~>
87
81
  - !ruby/object:Gem::Version
88
- version: 1.6.0
82
+ version: 0.1.0
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: bundler
91
85
  requirement: !ruby/object:Gem::Requirement
@@ -319,9 +313,8 @@ files:
319
313
  - spec/lib/inserter_spec.rb
320
314
  - spec/lib/registry_client_spec.rb
321
315
  - spec/lib/repository/driver_base_spec.rb
322
- - spec/lib/repository/git_driver_spec.rb
316
+ - spec/lib/repository/driver_factory_spec.rb
323
317
  - spec/lib/repository/package_spec.rb
324
- - spec/lib/repository/repository_factory_spec.rb
325
318
  - spec/lib/repository/repository_manager_spec.rb
326
319
  - spec/lib/repository/repository_spec.rb
327
320
  - spec/lib/tag_parser_spec.rb
@@ -332,7 +325,6 @@ files:
332
325
  - test/config_test.rb
333
326
  - test/context_test.rb
334
327
  - test/driver_base_test.rb
335
- - test/git_driver_test.rb
336
328
  - test/insert_snippet_test.rb
337
329
  - test/install_command_test.rb
338
330
  - test/repository_manager_test.rb
@@ -387,9 +379,8 @@ test_files:
387
379
  - spec/lib/inserter_spec.rb
388
380
  - spec/lib/registry_client_spec.rb
389
381
  - spec/lib/repository/driver_base_spec.rb
390
- - spec/lib/repository/git_driver_spec.rb
382
+ - spec/lib/repository/driver_factory_spec.rb
391
383
  - spec/lib/repository/package_spec.rb
392
- - spec/lib/repository/repository_factory_spec.rb
393
384
  - spec/lib/repository/repository_manager_spec.rb
394
385
  - spec/lib/repository/repository_spec.rb
395
386
  - spec/lib/tag_parser_spec.rb
@@ -400,7 +391,6 @@ test_files:
400
391
  - test/config_test.rb
401
392
  - test/context_test.rb
402
393
  - test/driver_base_test.rb
403
- - test/git_driver_test.rb
404
394
  - test/insert_snippet_test.rb
405
395
  - test/install_command_test.rb
406
396
  - test/repository_manager_test.rb
@@ -1,10 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe ::SocialSnippet::Repository::Drivers::GitDriver do
4
-
5
- let(:driver_class) { ::SocialSnippet::Repository::Drivers::GitDriver }
6
-
7
- include_context :TestDriver
8
-
9
- end # GitDriver
10
-
@@ -1,51 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe ::SocialSnippet::Repository::Drivers::GitDriver, :without_fakefs => true do
4
-
5
- let(:driver) do
6
- url = "git://github.com/social-snippet/example-repo"
7
- ::SocialSnippet::Repository::Drivers::GitDriver.new url
8
- end
9
-
10
- context "fetch" do
11
-
12
- before { driver.fetch }
13
-
14
- context "has versions" do
15
- subject { driver.has_versions? }
16
- it { should be_truthy }
17
- end # has versions
18
-
19
- context "versions" do
20
- subject { driver.versions }
21
- it { should_not include "master" }
22
- it { should include "1.0.0" }
23
- it { should include "1.0.1" }
24
- it { should include "1.0.2" }
25
- end
26
-
27
- context "tags" do
28
- subject { driver.tags }
29
- it { should_not include "master" }
30
- it { should include "1.0.0" }
31
- it { should include "1.0.1" }
32
- it { should include "1.0.2" }
33
- end
34
-
35
- context "refs" do
36
- subject { driver.refs }
37
- it { should include "master" }
38
- it { should include "1.0.0" }
39
- it { should include "1.0.1" }
40
- it { should include "1.0.2" }
41
- end
42
-
43
- context "snippet_json" do
44
- subject { driver.snippet_json }
45
- it { expect(driver.snippet_json["name"]).to eq "example-repo" }
46
- end
47
-
48
- end # fetch
49
-
50
- end # ::SocialSnippet::Repository::Drivers::GitDriver
51
-