social_snippet 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +8 -8
  2. data/.travis.yml +1 -2
  3. data/Rakefile +12 -0
  4. data/lib/social_snippet/api.rb +4 -4
  5. data/lib/social_snippet/api/completion_api.rb +1 -1
  6. data/lib/social_snippet/api/config_api.rb +3 -3
  7. data/lib/social_snippet/api/insert_snippet_api.rb +1 -1
  8. data/lib/social_snippet/api/install_repository_api.rb +5 -5
  9. data/lib/social_snippet/api/manifest_api.rb +5 -5
  10. data/lib/social_snippet/api/registry_api.rb +1 -1
  11. data/lib/social_snippet/api/search_api.rb +2 -2
  12. data/lib/social_snippet/api/show_api.rb +1 -1
  13. data/lib/social_snippet/api/update_repository_api.rb +9 -9
  14. data/lib/social_snippet/command_line/command.rb +2 -2
  15. data/lib/social_snippet/command_line/ssnip/main_command.rb +1 -1
  16. data/lib/social_snippet/command_line/sspm/sub_commands/complete_command.rb +1 -1
  17. data/lib/social_snippet/command_line/sspm/sub_commands/config_command.rb +3 -3
  18. data/lib/social_snippet/command_line/sspm/sub_commands/info_command.rb +1 -1
  19. data/lib/social_snippet/command_line/sspm/sub_commands/init_command.rb +1 -1
  20. data/lib/social_snippet/command_line/sspm/sub_commands/install_command.rb +4 -4
  21. data/lib/social_snippet/command_line/sspm/sub_commands/publish_command.rb +2 -2
  22. data/lib/social_snippet/command_line/sspm/sub_commands/search_command.rb +1 -1
  23. data/lib/social_snippet/command_line/sspm/sub_commands/update_command.rb +2 -2
  24. data/lib/social_snippet/config.rb +3 -3
  25. data/lib/social_snippet/context.rb +32 -11
  26. data/lib/social_snippet/registry/registry_client.rb +4 -4
  27. data/lib/social_snippet/registry/registry_resources/base.rb +13 -13
  28. data/lib/social_snippet/repository/repository_installer.rb +6 -6
  29. data/lib/social_snippet/repository/repository_manager.rb +11 -12
  30. data/lib/social_snippet/resolvers/base_resolver.rb +25 -11
  31. data/lib/social_snippet/resolvers/dep_resolver.rb +4 -4
  32. data/lib/social_snippet/resolvers/insert_resolver.rb +14 -13
  33. data/lib/social_snippet/snippet.rb +76 -55
  34. data/lib/social_snippet/tag.rb +28 -7
  35. data/lib/social_snippet/tag_parser.rb +47 -38
  36. data/lib/social_snippet/version.rb +1 -1
  37. data/spec/lib/api_spec.rb +4 -4
  38. data/spec/lib/command_line/sspm_config_spec.rb +3 -3
  39. data/spec/lib/command_line/sspm_init_spec.rb +1 -1
  40. data/spec/lib/command_line/sspm_install_spec.rb +5 -5
  41. data/spec/lib/command_line/sspm_search_spec.rb +1 -1
  42. data/spec/lib/context_spec.rb +29 -22
  43. data/spec/lib/core_spec.rb +12 -12
  44. data/spec/lib/insert_resolver_spec.rb +7 -7
  45. data/spec/lib/repository/repository_manager_spec.rb +1 -0
  46. data/spec/spec_helper.rb +15 -15
  47. data/test/core_test.rb +1062 -428
  48. metadata +2 -2
@@ -60,6 +60,7 @@ module SocialSnippet::Repository
60
60
  context "@snip <./subdir/file3.cpp>" do
61
61
 
62
62
  let(:tag) { ::SocialSnippet::Tag.new("// @snip <./subdir/file3.cpp>") }
63
+ before { context.move tag.path }
63
64
 
64
65
  context "result" do
65
66
  subject { repo_manager.resolve_snippet_path(context, tag) }
data/spec/spec_helper.rb CHANGED
@@ -44,7 +44,7 @@ module SocialSnippet::SpecHelpers
44
44
 
45
45
  def global_config
46
46
  $social_snippet_config ||= ::SocialSnippet::Config.new(
47
- fake_social_snippet,
47
+ fake_core,
48
48
  {
49
49
  :home => fake_home,
50
50
  :sspm_host => "api.server",
@@ -58,7 +58,7 @@ module SocialSnippet::SpecHelpers
58
58
 
59
59
  def fake_config
60
60
  @config ||= ::SocialSnippet::Config.new(
61
- fake_social_snippet,
61
+ fake_core,
62
62
  {
63
63
  :home => fake_home,
64
64
  :sspm_host => "api.server",
@@ -67,22 +67,22 @@ module SocialSnippet::SpecHelpers
67
67
  end
68
68
 
69
69
  def fake_api
70
- @fake_api ||= ::SocialSnippet::Api.new(fake_social_snippet)
70
+ @fake_api ||= ::SocialSnippet::Api.new(fake_core)
71
71
  end
72
72
 
73
- def fake_social_snippet
74
- reset_fake_social_snippet unless @fake_social_snippet
75
- @fake_social_snippet
73
+ def fake_core
74
+ reset_fake_core unless @fake_core
75
+ @fake_core
76
76
  end
77
77
 
78
- def reset_fake_social_snippet
79
- @fake_social_snippet = Fake.new
80
- allow(fake_social_snippet).to receive(:logger).and_return fake_logger
81
- allow(fake_social_snippet).to receive(:config).and_return fake_config
82
- allow(fake_social_snippet).to receive(:api).and_return fake_api
83
- allow(fake_social_snippet).to receive(:repo_manager).and_return ::SocialSnippet::Repository::RepositoryManager.new(fake_social_snippet)
84
- allow(fake_social_snippet).to receive(:registry_client).and_return ::SocialSnippet::Registry::RegistryClient.new(fake_social_snippet)
85
- allow_any_instance_of(::SocialSnippet::CommandLine::Command).to receive(:social_snippet).and_return fake_social_snippet
78
+ def reset_fake_core
79
+ @fake_core = Fake.new
80
+ allow(fake_core).to receive(:logger).and_return fake_logger
81
+ allow(fake_core).to receive(:config).and_return fake_config
82
+ allow(fake_core).to receive(:api).and_return fake_api
83
+ allow(fake_core).to receive(:repo_manager).and_return ::SocialSnippet::Repository::RepositoryManager.new(fake_core)
84
+ allow(fake_core).to receive(:registry_client).and_return ::SocialSnippet::Registry::RegistryClient.new(fake_core)
85
+ allow_any_instance_of(::SocialSnippet::CommandLine::Command).to receive(:core).and_return fake_core
86
86
  end
87
87
 
88
88
  end
@@ -94,7 +94,7 @@ module SocialSnippet
94
94
  config.after { disable_fakefs }
95
95
 
96
96
  config.include SpecHelpers
97
- config.before { reset_fake_social_snippet }
97
+ config.before { reset_fake_core }
98
98
 
99
99
  config.before(:example, :without_fakefs => true) do
100
100
  disable_fakefs
data/test/core_test.rb CHANGED
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe SocialSnippet::Core do
4
4
 
5
5
  before do
6
- allow_any_instance_of(::SocialSnippet::CommandLine::Command).to receive(:social_snippet).and_return fake_social_snippet
6
+ allow_any_instance_of(::SocialSnippet::CommandLine::Command).to receive(:social_snippet).and_return fake_core
7
7
  end
8
8
 
9
9
  let(:repo_path) { fake_config.install_path }
@@ -22,7 +22,7 @@ describe SocialSnippet::Core do
22
22
 
23
23
  repos_no_ver = Dir.glob("#{tmp_repo_path_no_ver}/*").map {|path| Pathname.new(path).basename.to_s }
24
24
 
25
- allow(fake_social_snippet.repo_manager).to receive(:find_repository).with(any_args) do |repo_name, ref|
25
+ allow(fake_core.repo_manager).to receive(:find_repository).with(any_args) do |repo_name, ref|
26
26
  repo_refs[repo_name] ||= []
27
27
  versions = repo_refs[repo_name].select {|ver| SocialSnippet::Version.is_matched_version_pattern(ref, ver) }
28
28
  latest_version = VersionSorter.rsort(versions).first
@@ -62,17 +62,17 @@ describe SocialSnippet::Core do
62
62
  repo_name = "my-repo"
63
63
  ref_name = "thisisdu"
64
64
 
65
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
66
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
67
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
68
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/file.c"
65
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
66
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
67
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
68
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/file.c"
69
69
 
70
70
  # snippet.json
71
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
71
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
72
72
  '{"name": "' + repo_name + '"}'
73
73
  ].join($/)
74
74
 
75
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/file.c", [
75
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/file.c", [
76
76
  '/* file.c */'
77
77
  ].join($/)
78
78
 
@@ -97,7 +97,7 @@ describe SocialSnippet::Core do
97
97
  ].join($/)
98
98
  end
99
99
 
100
- subject { fake_social_snippet.api.insert_snippet input }
100
+ subject { fake_core.api.insert_snippet input }
101
101
  it { should eq output }
102
102
 
103
103
  end # snip my-repo#thisisdu
@@ -112,7 +112,7 @@ describe SocialSnippet::Core do
112
112
  end
113
113
 
114
114
  it do
115
- expect { fake_social_snippet.api.insert_snippet input }.to(
115
+ expect { fake_core.api.insert_snippet input }.to(
116
116
  raise_error(SocialSnippet::Repository::Errors::NotExistRef)
117
117
  )
118
118
  end
@@ -138,17 +138,17 @@ describe SocialSnippet::Core do
138
138
  repo_name = "my-repo"
139
139
  ref_name = "1.0.0"
140
140
 
141
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
142
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
143
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
144
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c"
141
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
142
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
143
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
144
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c"
145
145
 
146
146
  # snippet.json
147
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
147
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
148
148
  '{"name": "' + repo_name + '"}'
149
149
  ].join($/)
150
150
 
151
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c", [
151
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c", [
152
152
  'func: 1.0.0',
153
153
  ].join($/)
154
154
  end # prepare my-repo#1.0.0
@@ -156,7 +156,7 @@ describe SocialSnippet::Core do
156
156
  before { find_repo_mock }
157
157
 
158
158
  it do
159
- expect(fake_social_snippet.api.insert_snippet(input)).to eq [
159
+ expect(fake_core.api.insert_snippet(input)).to eq [
160
160
  '/* @snippet<my-repo#1.0.0:func.c> */',
161
161
  'func: 1.0.0',
162
162
  'main',
@@ -169,17 +169,17 @@ describe SocialSnippet::Core do
169
169
  repo_name = "my-repo"
170
170
  ref_name = "1.0.1"
171
171
 
172
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
173
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
174
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
175
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c"
172
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
173
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
174
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
175
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c"
176
176
 
177
177
  # snippet.json
178
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
178
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
179
179
  '{"name": "' + repo_name + '"}'
180
180
  ].join($/)
181
181
 
182
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c", [
182
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c", [
183
183
  'func: 1.0.1',
184
184
  ].join($/)
185
185
  end # prepare my-repo#1.0.1
@@ -187,7 +187,7 @@ describe SocialSnippet::Core do
187
187
  before { find_repo_mock }
188
188
 
189
189
  it do
190
- expect(fake_social_snippet.api.insert_snippet(input)).to eq [
190
+ expect(fake_core.api.insert_snippet(input)).to eq [
191
191
  '/* @snippet<my-repo#1.0.1:func.c> */',
192
192
  'func: 1.0.1',
193
193
  'main',
@@ -200,17 +200,17 @@ describe SocialSnippet::Core do
200
200
  repo_name = "my-repo"
201
201
  ref_name = "1.1.0"
202
202
 
203
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
204
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
205
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
206
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c"
203
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
204
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
205
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
206
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c"
207
207
 
208
208
  # snippet.json
209
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
209
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
210
210
  '{"name": "' + repo_name + '"}'
211
211
  ].join($/)
212
212
 
213
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c", [
213
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c", [
214
214
  'func: 1.1.0',
215
215
  ].join($/)
216
216
  end # prepare my-repo#1.1.0
@@ -218,7 +218,7 @@ describe SocialSnippet::Core do
218
218
  before { find_repo_mock }
219
219
 
220
220
  it do
221
- expect(fake_social_snippet.api.insert_snippet(input)).to eq [
221
+ expect(fake_core.api.insert_snippet(input)).to eq [
222
222
  '/* @snippet<my-repo#1.1.0:func.c> */',
223
223
  'func: 1.1.0',
224
224
  'main',
@@ -231,17 +231,17 @@ describe SocialSnippet::Core do
231
231
  repo_name = "my-repo"
232
232
  ref_name = "9.9.9"
233
233
 
234
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
235
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
236
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
237
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c"
234
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
235
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
236
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
237
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c"
238
238
 
239
239
  # snippet.json
240
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
240
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
241
241
  '{"name": "' + repo_name + '"}'
242
242
  ].join($/)
243
243
 
244
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c", [
244
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/func.c", [
245
245
  'func: 9.9.9',
246
246
  ].join($/)
247
247
  end # prepare my-repo#9.9.9
@@ -249,7 +249,7 @@ describe SocialSnippet::Core do
249
249
  before { find_repo_mock }
250
250
 
251
251
  it do
252
- expect(fake_social_snippet.api.insert_snippet(input)).to eq [
252
+ expect(fake_core.api.insert_snippet(input)).to eq [
253
253
  '/* @snippet<my-repo#1.1.0:func.c> */',
254
254
  'func: 1.1.0',
255
255
  'main',
@@ -274,39 +274,39 @@ describe SocialSnippet::Core do
274
274
  repo_name = "my-repo"
275
275
  ref_name = "1.2.3"
276
276
 
277
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
278
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
279
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
280
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
281
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/file_1"
282
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_a"
283
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_a/file_2"
284
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_b"
285
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_b/file_3"
286
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_c"
287
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_c/file_4"
277
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
278
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
279
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
280
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
281
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/file_1"
282
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_a"
283
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_a/file_2"
284
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_b"
285
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_b/file_3"
286
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_c"
287
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_c/file_4"
288
288
 
289
289
  # snippet.json
290
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
290
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
291
291
  '{"name": "' + repo_name + '", "main": "src"}'
292
292
  ].join($/)
293
293
 
294
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/file_1", [
294
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/file_1", [
295
295
  '@snip<subdir_a/file_2>',
296
296
  'file_1',
297
297
  ].join($/)
298
298
 
299
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_a/file_2", [
299
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_a/file_2", [
300
300
  '@snip<../subdir_b/file_3>',
301
301
  'file_2',
302
302
  ].join($/)
303
303
 
304
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_b/file_3", [
304
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_b/file_3", [
305
305
  '@snip<../subdir_c/file_4>',
306
306
  'file_3',
307
307
  ].join($/)
308
308
 
309
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_c/file_4", [
309
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/subdir_c/file_4", [
310
310
  'file_4',
311
311
  ].join($/)
312
312
  end # prepare my-repo#1.2.3
@@ -336,7 +336,7 @@ describe SocialSnippet::Core do
336
336
  ].join($/).freeze
337
337
  end
338
338
 
339
- subject { fake_social_snippet.api.insert_snippet input }
339
+ subject { fake_core.api.insert_snippet input }
340
340
  it { should eq output }
341
341
 
342
342
  end
@@ -349,18 +349,18 @@ describe SocialSnippet::Core do
349
349
  repo_name = "directly"
350
350
  ref_name = "3.2.1"
351
351
 
352
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
353
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
354
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
355
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
356
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1"
352
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
353
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
354
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
355
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
356
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1"
357
357
 
358
358
  # snippet.json
359
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
359
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
360
360
  '{"name": "' + repo_name + '"}'
361
361
  ].join($/)
362
362
 
363
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1", [
363
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1", [
364
364
  '@snip<1>',
365
365
  '1',
366
366
  ].join($/)
@@ -370,18 +370,18 @@ describe SocialSnippet::Core do
370
370
  repo_name = "loop-1"
371
371
  ref_name = "1.1.1"
372
372
 
373
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
374
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
375
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
376
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
377
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop"
373
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
374
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
375
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
376
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
377
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop"
378
378
 
379
379
  # snippet.json
380
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
380
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
381
381
  '{"name": "' + repo_name + '"}'
382
382
  ].join($/)
383
383
 
384
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop", [
384
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop", [
385
385
  '@snip<loop-2:loop>',
386
386
  'loop-1',
387
387
  ].join($/)
@@ -391,18 +391,18 @@ describe SocialSnippet::Core do
391
391
  repo_name = "loop-2"
392
392
  ref_name = "1.1.1"
393
393
 
394
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
395
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
396
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
397
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
398
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop"
394
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
395
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
396
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
397
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
398
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop"
399
399
 
400
400
  # snippet.json
401
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
401
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
402
402
  '{"name": "' + repo_name + '"}'
403
403
  ].join($/)
404
404
 
405
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop", [
405
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop", [
406
406
  '@snip<loop-3:loop>',
407
407
  'loop-2',
408
408
  ].join($/)
@@ -412,18 +412,18 @@ describe SocialSnippet::Core do
412
412
  repo_name = "loop-3"
413
413
  ref_name = "1.1.1"
414
414
 
415
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
416
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
417
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
418
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
419
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop"
415
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
416
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
417
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
418
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
419
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop"
420
420
 
421
421
  # snippet.json
422
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
422
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
423
423
  '{"name": "' + repo_name + '"}'
424
424
  ].join($/)
425
425
 
426
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop", [
426
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/loop", [
427
427
  '@snip<loop-1:loop>',
428
428
  '@snip<non-loop-4:non-loop>',
429
429
  'loop-3',
@@ -434,18 +434,18 @@ describe SocialSnippet::Core do
434
434
  repo_name = "non-loop-4"
435
435
  ref_name = "1.1.1"
436
436
 
437
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
438
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
439
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
440
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
441
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/non-loop"
437
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
438
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
439
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
440
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
441
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/non-loop"
442
442
 
443
443
  # snippet.json
444
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
444
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
445
445
  '{"name": "' + repo_name + '"}'
446
446
  ].join($/)
447
447
 
448
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/non-loop", [
448
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/non-loop", [
449
449
  'non-loop-4',
450
450
  ].join($/)
451
451
  end # prepare non-loop-4#1.1.1
@@ -477,7 +477,7 @@ describe SocialSnippet::Core do
477
477
  ].join($/)
478
478
  end
479
479
 
480
- subject { fake_social_snippet.api.insert_snippet input }
480
+ subject { fake_core.api.insert_snippet input }
481
481
  it { should eq output }
482
482
 
483
483
  end # has loop
@@ -501,7 +501,7 @@ describe SocialSnippet::Core do
501
501
  ].join($/)
502
502
  end
503
503
 
504
- subject { fake_social_snippet.api.insert_snippet input }
504
+ subject { fake_core.api.insert_snippet input }
505
505
  it { should eq output }
506
506
 
507
507
  end
@@ -516,18 +516,18 @@ describe SocialSnippet::Core do
516
516
  repo_name = "my-repo-1"
517
517
  ref_name = "0.0.1"
518
518
 
519
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
520
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
521
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
522
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
523
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1"
519
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
520
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
521
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
522
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
523
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1"
524
524
 
525
525
  # snippet.json
526
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
526
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
527
527
  '{"name": "' + repo_name + '"}'
528
528
  ].join($/)
529
529
 
530
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1", [
530
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1", [
531
531
  '@snip<my-repo-2#0:2>',
532
532
  'my-repo-1:1',
533
533
  ].join($/)
@@ -537,18 +537,18 @@ describe SocialSnippet::Core do
537
537
  repo_name = "my-repo-2"
538
538
  ref_name = "0.0.1"
539
539
 
540
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
541
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
542
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
543
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
544
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2"
540
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
541
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
542
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
543
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
544
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2"
545
545
 
546
546
  # snippet.json
547
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
547
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
548
548
  '{"name": "' + repo_name + '"}'
549
549
  ].join($/)
550
550
 
551
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2", [
551
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2", [
552
552
  '@snip<my-repo-3:path/to/3>',
553
553
  'my-repo-2:2',
554
554
  ].join($/)
@@ -558,18 +558,18 @@ describe SocialSnippet::Core do
558
558
  repo_name = "my-repo-2"
559
559
  ref_name = "1.2.3"
560
560
 
561
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
562
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
563
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
564
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
565
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2"
561
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
562
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
563
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
564
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
565
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2"
566
566
 
567
567
  # snippet.json
568
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
568
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
569
569
  '{"name": "' + repo_name + '"}'
570
570
  ].join($/)
571
571
 
572
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2", [
572
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2", [
573
573
  'miss!!',
574
574
  ].join($/)
575
575
  end # prepare my-repo-2#1.2.3
@@ -578,20 +578,20 @@ describe SocialSnippet::Core do
578
578
  repo_name = "my-repo-3"
579
579
  ref_name = "1.2.3"
580
580
 
581
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
582
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
583
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
584
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
585
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/path"
586
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/path/to"
587
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/path/to/3"
581
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
582
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
583
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
584
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
585
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/path"
586
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/path/to"
587
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/path/to/3"
588
588
 
589
589
  # snippet.json
590
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
590
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
591
591
  '{"name": "' + repo_name + '"}'
592
592
  ].join($/)
593
593
 
594
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/path/to/3", [
594
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/path/to/3", [
595
595
  '@snip<my-repo-4:path/to/4>',
596
596
  'my-repo-3:path/to/3',
597
597
  ].join($/)
@@ -601,22 +601,22 @@ describe SocialSnippet::Core do
601
601
  repo_name = "my-repo-4"
602
602
  ref_name = "1.2.3"
603
603
 
604
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
605
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
606
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
607
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
608
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
609
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources"
610
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path"
611
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to"
612
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/4"
604
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
605
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
606
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
607
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
608
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
609
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources"
610
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path"
611
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to"
612
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/4"
613
613
 
614
614
  # snippet.json
615
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
615
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
616
616
  '{"name": "' + repo_name + '", "main": "sources"}'
617
617
  ].join($/)
618
618
 
619
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/4", [
619
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/4", [
620
620
  '@snip<my-repo-5:path/to/5>',
621
621
  'my-repo-4:sources/path/to/4',
622
622
  ].join($/)
@@ -626,22 +626,22 @@ describe SocialSnippet::Core do
626
626
  repo_name = "my-repo-5"
627
627
  ref_name = "100.200.300"
628
628
 
629
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
630
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
631
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
632
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
633
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
634
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources"
635
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path"
636
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to"
637
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/5"
629
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
630
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
631
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
632
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
633
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
634
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources"
635
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path"
636
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to"
637
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/5"
638
638
 
639
639
  # snippet.json
640
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
640
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
641
641
  '{"name": "' + repo_name + '", "main": "sources"}'
642
642
  ].join($/)
643
643
 
644
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/5", [
644
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/5", [
645
645
  '@snip<my-repo-6:path/to/6>',
646
646
  'my-repo-5:sources/path/to/5',
647
647
  ].join($/)
@@ -651,22 +651,22 @@ describe SocialSnippet::Core do
651
651
  repo_name = "my-repo-5"
652
652
  ref_name = "99.999.999"
653
653
 
654
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
655
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
656
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
657
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
658
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
659
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources"
660
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path"
661
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to"
662
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/5"
654
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
655
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
656
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
657
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
658
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
659
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources"
660
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path"
661
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to"
662
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/5"
663
663
 
664
664
  # snippet.json
665
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
665
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
666
666
  '{"name": "' + repo_name + '", "main": "sources"}'
667
667
  ].join($/)
668
668
 
669
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/5", [
669
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/5", [
670
670
  'miss!!',
671
671
  'my-repo-5:5',
672
672
  ].join($/)
@@ -675,20 +675,20 @@ describe SocialSnippet::Core do
675
675
  before do
676
676
  repo_name = "my-repo-6"
677
677
 
678
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}"
679
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/.git"
680
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json"
681
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/sources"
682
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/sources/path"
683
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/sources/path/to"
684
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/sources/path/to/6"
678
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}"
679
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/.git"
680
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json"
681
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/sources"
682
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/sources/path"
683
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/sources/path/to"
684
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/sources/path/to/6"
685
685
 
686
686
  # snippet.json
687
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json", [
687
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json", [
688
688
  '{"name": "' + repo_name + '", "main": "sources"}'
689
689
  ].join($/)
690
690
 
691
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/sources/path/to/6", [
691
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/sources/path/to/6", [
692
692
  '@snip<my-repo-7:path/to/7>',
693
693
  'my-repo-6:sources/path/to/6',
694
694
  ].join($/)
@@ -698,22 +698,22 @@ describe SocialSnippet::Core do
698
698
  repo_name = "my-repo-7"
699
699
  ref_name = "1.2.3"
700
700
 
701
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
702
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
703
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
704
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
705
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
706
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources"
707
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path"
708
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to"
709
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/7"
701
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
702
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
703
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
704
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
705
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
706
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources"
707
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path"
708
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to"
709
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/7"
710
710
 
711
711
  # snippet.json
712
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
712
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
713
713
  '{"name": "' + repo_name + '", "main": "sources"}'
714
714
  ].join($/)
715
715
 
716
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/7", [
716
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/sources/path/to/7", [
717
717
  'end',
718
718
  'my-repo-7:sources/path/to/7',
719
719
  ].join($/)
@@ -749,7 +749,7 @@ describe SocialSnippet::Core do
749
749
  ].join($/).freeze
750
750
  end
751
751
 
752
- subject { fake_social_snippet.api.insert_snippet input }
752
+ subject { fake_core.api.insert_snippet input }
753
753
  it { should eq output }
754
754
 
755
755
  end # snip my-repo-1:1
@@ -762,26 +762,26 @@ describe SocialSnippet::Core do
762
762
  repo_name = "my-repo"
763
763
  ref_name = "0.0.1"
764
764
 
765
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
766
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
767
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
768
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
769
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1"
770
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2"
771
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/3"
772
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/4"
773
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/5"
774
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/6"
775
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/7"
776
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/8"
777
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/9"
765
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
766
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
767
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
768
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
769
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1"
770
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2"
771
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/3"
772
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/4"
773
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/5"
774
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/6"
775
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/7"
776
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/8"
777
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/9"
778
778
 
779
779
  # snippet.json
780
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
780
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
781
781
  '{"name": "' + repo_name + '"}'
782
782
  ].join($/)
783
783
 
784
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1", [
784
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/1", [
785
785
  '@snip<5>',
786
786
  '@snip<4>',
787
787
  '@snip<3>',
@@ -789,7 +789,7 @@ describe SocialSnippet::Core do
789
789
  '1',
790
790
  ].join($/)
791
791
 
792
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2", [
792
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/2", [
793
793
  '@snip<9>',
794
794
  '@snip<8>',
795
795
  '@snip<7>',
@@ -797,31 +797,31 @@ describe SocialSnippet::Core do
797
797
  '2',
798
798
  ].join($/)
799
799
 
800
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/3", [
800
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/3", [
801
801
  '3',
802
802
  ].join($/)
803
803
 
804
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/4", [
804
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/4", [
805
805
  '4',
806
806
  ].join($/)
807
807
 
808
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/5", [
808
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/5", [
809
809
  '5',
810
810
  ].join($/)
811
811
 
812
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/6", [
812
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/6", [
813
813
  '6',
814
814
  ].join($/)
815
815
 
816
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/7", [
816
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/7", [
817
817
  '7',
818
818
  ].join($/)
819
819
 
820
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/8", [
820
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/8", [
821
821
  '8',
822
822
  ].join($/)
823
823
 
824
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/9", [
824
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/9", [
825
825
  '9',
826
826
  ].join($/)
827
827
  end
@@ -859,7 +859,7 @@ describe SocialSnippet::Core do
859
859
  ].join($/)
860
860
  end
861
861
 
862
- subject { fake_social_snippet.api.insert_snippet input }
862
+ subject { fake_core.api.insert_snippet input }
863
863
  it { should eq output }
864
864
 
865
865
  end # snippet snippets
@@ -870,27 +870,27 @@ describe SocialSnippet::Core do
870
870
  repo_name = "my-repo"
871
871
  ref_name = "0.0.3"
872
872
 
873
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
874
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
875
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
876
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
877
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
878
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
879
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
873
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
874
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
875
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
876
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
877
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
878
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
879
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
880
880
 
881
881
  # snippet.json
882
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
882
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
883
883
  '{"name": "' + repo_name + '", "main": "src"}',
884
884
  ].join($/)
885
885
 
886
886
  # src/1.rb
887
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
887
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
888
888
  '# @snip</2.rb>',
889
889
  'OK',
890
890
  ].join($/)
891
891
 
892
892
  # src/2.rb
893
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
893
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
894
894
  '0.0.3',
895
895
  ].join($/)
896
896
 
@@ -900,21 +900,21 @@ describe SocialSnippet::Core do
900
900
  repo_name = "my-repo"
901
901
  ref_name = "0.0.2"
902
902
 
903
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
904
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
905
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
906
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
907
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
908
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
909
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
903
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
904
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
905
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
906
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
907
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
908
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
909
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
910
910
 
911
911
  # snippet.json
912
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
912
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
913
913
  '{"name": "' + repo_name + '", "main": "src"}',
914
914
  ].join($/)
915
915
 
916
916
  # src/1.rb
917
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
917
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
918
918
  '# @snip</2.rb>',
919
919
  'def func_1',
920
920
  ' return 2 * func_2()',
@@ -922,7 +922,7 @@ describe SocialSnippet::Core do
922
922
  ].join($/)
923
923
 
924
924
  # src/2.rb
925
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
925
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
926
926
  'ERROR_CASE',
927
927
  ].join($/)
928
928
 
@@ -932,21 +932,21 @@ describe SocialSnippet::Core do
932
932
  repo_name = "my-repo"
933
933
  ref_name = "0.0.1"
934
934
 
935
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
936
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
937
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
938
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
939
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
940
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
941
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
935
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
936
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
937
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
938
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
939
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
940
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
941
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
942
942
 
943
943
  # snippet.json
944
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
944
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
945
945
  '{"name": "' + repo_name + '", "main": "src"}',
946
946
  ].join($/)
947
947
 
948
948
  # src/1.rb
949
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
949
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
950
950
  '# @snip</2.rb>',
951
951
  'def func_1',
952
952
  ' return 2 * func_2()',
@@ -954,7 +954,7 @@ describe SocialSnippet::Core do
954
954
  ].join($/)
955
955
 
956
956
  # src/2.rb
957
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
957
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
958
958
  'ERROR_CASE',
959
959
  ].join($/)
960
960
 
@@ -964,21 +964,21 @@ describe SocialSnippet::Core do
964
964
  repo_name = "my-repo"
965
965
  ref_name = "1.0.0"
966
966
 
967
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
968
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
969
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
970
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
971
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
972
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
973
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
967
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
968
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
969
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
970
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
971
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
972
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
973
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
974
974
 
975
975
  # snippet.json
976
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
976
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
977
977
  '{"name": "' + repo_name + '", "main": "src"}',
978
978
  ].join($/)
979
979
 
980
980
  # src/1.rb
981
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
981
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
982
982
  '# @snip</2.rb>',
983
983
  'def func_1',
984
984
  ' return 2 * func_2()',
@@ -986,7 +986,7 @@ describe SocialSnippet::Core do
986
986
  ].join($/)
987
987
 
988
988
  # src/2.rb
989
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
989
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
990
990
  'THIS_IS_OK',
991
991
  ].join($/)
992
992
  end # prepare my-repo#1.0.0
@@ -995,20 +995,20 @@ describe SocialSnippet::Core do
995
995
  repo_name = "new-my-repo"
996
996
  ref_name = "0.0.1"
997
997
 
998
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
999
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
1000
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
1001
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
1002
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
1003
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
998
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
999
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
1000
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
1001
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
1002
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
1003
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
1004
1004
 
1005
1005
  # snippet.json
1006
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
1006
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
1007
1007
  '{"name": "' + repo_name + '", "main": "src"}',
1008
1008
  ].join($/)
1009
1009
 
1010
1010
  # src/1.rb
1011
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
1011
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
1012
1012
  'OLD VERSION',
1013
1013
  ].join($/)
1014
1014
  end # prepare new-my-repo#0.0.1
@@ -1017,22 +1017,22 @@ describe SocialSnippet::Core do
1017
1017
  repo_name = "new-my-repo"
1018
1018
  ref_name = "0.0.2"
1019
1019
 
1020
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
1021
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
1022
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
1023
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
1024
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
1025
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
1026
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
1027
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/3.rb"
1020
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
1021
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
1022
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
1023
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
1024
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
1025
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
1026
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
1027
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/3.rb"
1028
1028
 
1029
1029
  # snippet.json
1030
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
1030
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
1031
1031
  '{"name": "' + repo_name + '", "main": "src"}',
1032
1032
  ].join($/)
1033
1033
 
1034
1034
  # src/1.rb
1035
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
1035
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
1036
1036
  '# @snip <my-repo#0:1.rb>',
1037
1037
  '# @snip </2.rb>',
1038
1038
  '# @snip <3.rb>',
@@ -1040,12 +1040,12 @@ describe SocialSnippet::Core do
1040
1040
  ].join($/)
1041
1041
 
1042
1042
  # src/2.rb
1043
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
1043
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
1044
1044
  'OK: 2.rb',
1045
1045
  ].join($/)
1046
1046
 
1047
1047
  # src/3.rb
1048
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/3.rb", [
1048
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/3.rb", [
1049
1049
  'OK: 3.rb',
1050
1050
  ].join($/)
1051
1051
  end # prepare new-my-repo#0.0.2
@@ -1073,7 +1073,7 @@ describe SocialSnippet::Core do
1073
1073
  ].join($/)
1074
1074
  end
1075
1075
 
1076
- subject { fake_social_snippet.api.insert_snippet input }
1076
+ subject { fake_core.api.insert_snippet input }
1077
1077
  it { should eq output }
1078
1078
 
1079
1079
  end # use my-repo
@@ -1097,7 +1097,7 @@ describe SocialSnippet::Core do
1097
1097
  ].join($/)
1098
1098
  end
1099
1099
 
1100
- subject { fake_social_snippet.api.insert_snippet input }
1100
+ subject { fake_core.api.insert_snippet input }
1101
1101
  it { should eq output }
1102
1102
 
1103
1103
  end # use my-repo#1
@@ -1126,7 +1126,7 @@ describe SocialSnippet::Core do
1126
1126
  ].join($/)
1127
1127
  end
1128
1128
 
1129
- subject { fake_social_snippet.api.insert_snippet input }
1129
+ subject { fake_core.api.insert_snippet input }
1130
1130
  it { should eq output }
1131
1131
 
1132
1132
  end # use my-repo#1 and my-repo#0
@@ -1154,7 +1154,7 @@ describe SocialSnippet::Core do
1154
1154
  ].join($/)
1155
1155
  end
1156
1156
 
1157
- subject { fake_social_snippet.api.insert_snippet input }
1157
+ subject { fake_core.api.insert_snippet input }
1158
1158
  it { should eq output }
1159
1159
 
1160
1160
  end # use new-my-repo
@@ -1167,21 +1167,21 @@ describe SocialSnippet::Core do
1167
1167
  repo_name = "my-repo"
1168
1168
  ref_name = "0.0.3"
1169
1169
 
1170
- FileUtils.mkdir_p "#{tmp_repo_path}"
1171
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
1172
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
1173
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
1174
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
1175
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
1176
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
1170
+ ::FileUtils.mkdir_p "#{tmp_repo_path}"
1171
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}"
1172
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/.git"
1173
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src"
1174
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json"
1175
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
1176
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
1177
1177
 
1178
1178
  # snippet.json
1179
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
1179
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
1180
1180
  '{"name": "' + repo_name + '", "main": "src"}',
1181
1181
  ].join($/)
1182
1182
 
1183
1183
  # src/1.rb
1184
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
1184
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
1185
1185
  '# @snip</2.rb>',
1186
1186
  'def func_1',
1187
1187
  ' return 2 * func_2()',
@@ -1189,7 +1189,7 @@ describe SocialSnippet::Core do
1189
1189
  ].join($/)
1190
1190
 
1191
1191
  # src/2.rb
1192
- File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
1192
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
1193
1193
  'def func_2',
1194
1194
  ' return 42',
1195
1195
  'end',
@@ -1218,7 +1218,7 @@ describe SocialSnippet::Core do
1218
1218
  ].join($/)
1219
1219
  end
1220
1220
 
1221
- subject { fake_social_snippet.api.insert_snippet input }
1221
+ subject { fake_core.api.insert_snippet input }
1222
1222
  it { should eq output }
1223
1223
 
1224
1224
  end # use latest version without ref
@@ -1229,21 +1229,21 @@ describe SocialSnippet::Core do
1229
1229
  repo_name = "my-repo"
1230
1230
  ref_name = "0.0.1"
1231
1231
 
1232
- FileUtils.mkdir_p "#{repo_path}"
1233
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}"
1234
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}/.git"
1235
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}/src"
1236
- FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/snippet.json"
1237
- FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
1238
- FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
1232
+ ::FileUtils.mkdir_p "#{repo_path}"
1233
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}"
1234
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}/.git"
1235
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}/src"
1236
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/snippet.json"
1237
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
1238
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
1239
1239
 
1240
1240
  # snippet.json
1241
- File.write "#{repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
1241
+ ::File.write "#{repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
1242
1242
  '{"name": "' + repo_name + '", "main": "src"}',
1243
1243
  ].join($/)
1244
1244
 
1245
1245
  # src/1.rb
1246
- File.write "#{repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
1246
+ ::File.write "#{repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
1247
1247
  '# @snip</2.rb>',
1248
1248
  'def func_1',
1249
1249
  ' return 2 * func_2()',
@@ -1251,13 +1251,13 @@ describe SocialSnippet::Core do
1251
1251
  ].join($/)
1252
1252
 
1253
1253
  # src/2.rb
1254
- File.write "#{repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
1254
+ ::File.write "#{repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
1255
1255
  'def func_2',
1256
1256
  ' return 42',
1257
1257
  'end',
1258
1258
  ].join($/)
1259
1259
 
1260
- allow(fake_social_snippet.repo_manager).to receive(:find_repository).with(repo_name, ref_name) do
1260
+ allow(fake_core.repo_manager).to receive(:find_repository).with(repo_name, ref_name) do
1261
1261
  repo = SocialSnippet::Repository::Drivers::BaseRepository.new("#{repo_path}/#{repo_name}/#{ref_name}")
1262
1262
  allow(repo).to receive(:refs).and_return([
1263
1263
  '0.0.1',
@@ -1275,21 +1275,21 @@ describe SocialSnippet::Core do
1275
1275
  repo_name = "my-repo"
1276
1276
  ref_name = "0.0.2"
1277
1277
 
1278
- FileUtils.mkdir_p "#{repo_path}"
1279
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}"
1280
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}/.git"
1281
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}/src"
1282
- FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/snippet.json"
1283
- FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
1284
- FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
1278
+ ::FileUtils.mkdir_p "#{repo_path}"
1279
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}"
1280
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}/.git"
1281
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/#{ref_name}/src"
1282
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/snippet.json"
1283
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/src/1.rb"
1284
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/#{ref_name}/src/2.rb"
1285
1285
 
1286
1286
  # snippet.json
1287
- File.write "#{repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
1287
+ ::File.write "#{repo_path}/#{repo_name}/#{ref_name}/snippet.json", [
1288
1288
  '{"name": "' + repo_name + '", "main": "src"}',
1289
1289
  ].join($/)
1290
1290
 
1291
1291
  # src/1.rb
1292
- File.write "#{repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
1292
+ ::File.write "#{repo_path}/#{repo_name}/#{ref_name}/src/1.rb", [
1293
1293
  '# @snip</2.rb>',
1294
1294
  'def func_1',
1295
1295
  ' return 2 * func_2()',
@@ -1297,13 +1297,13 @@ describe SocialSnippet::Core do
1297
1297
  ].join($/)
1298
1298
 
1299
1299
  # src/2.rb
1300
- File.write "#{repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
1300
+ ::File.write "#{repo_path}/#{repo_name}/#{ref_name}/src/2.rb", [
1301
1301
  'def func_2',
1302
1302
  ' return 10000 + 42',
1303
1303
  'end',
1304
1304
  ].join($/)
1305
1305
 
1306
- allow(fake_social_snippet.repo_manager).to receive(:find_repository).with(repo_name, ref_name) do
1306
+ allow(fake_core.repo_manager).to receive(:find_repository).with(repo_name, ref_name) do
1307
1307
  repo = SocialSnippet::Repository::Drivers::BaseRepository.new("#{repo_path}/#{repo_name}/#{ref_name}")
1308
1308
  allow(repo).to receive(:refs).and_return([
1309
1309
  '0.0.1',
@@ -1341,7 +1341,7 @@ describe SocialSnippet::Core do
1341
1341
  ].join($/)
1342
1342
  end
1343
1343
 
1344
- subject { fake_social_snippet.api.insert_snippet(input) }
1344
+ subject { fake_core.api.insert_snippet(input) }
1345
1345
  it { should eq output }
1346
1346
 
1347
1347
  end # use 0.0.1
@@ -1371,7 +1371,7 @@ describe SocialSnippet::Core do
1371
1371
  ].join($/)
1372
1372
  end
1373
1373
 
1374
- subject { fake_social_snippet.api.insert_snippet(input) }
1374
+ subject { fake_core.api.insert_snippet(input) }
1375
1375
  it { should eq output }
1376
1376
 
1377
1377
  end # use 0.0.2
@@ -1408,7 +1408,7 @@ describe SocialSnippet::Core do
1408
1408
  ].join($/)
1409
1409
  end
1410
1410
 
1411
- subject { fake_social_snippet.api.insert_snippet(input) }
1411
+ subject { fake_core.api.insert_snippet(input) }
1412
1412
  it { should eq output }
1413
1413
 
1414
1414
  end # use 0.0.1 and 0.0.2
@@ -1420,21 +1420,21 @@ describe SocialSnippet::Core do
1420
1420
  before do
1421
1421
  repo_name = "my-repo"
1422
1422
 
1423
- FileUtils.mkdir_p "#{repo_path}"
1424
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}"
1425
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/.git"
1426
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/src"
1427
- FileUtils.touch "#{repo_path}/#{repo_name}/snippet.json"
1428
- FileUtils.touch "#{repo_path}/#{repo_name}/src/1.rb"
1429
- FileUtils.touch "#{repo_path}/#{repo_name}/src/2.rb"
1423
+ ::FileUtils.mkdir_p "#{repo_path}"
1424
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}"
1425
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/.git"
1426
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/src"
1427
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/snippet.json"
1428
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/src/1.rb"
1429
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/src/2.rb"
1430
1430
 
1431
1431
  # snippet.json
1432
- File.write "#{repo_path}/#{repo_name}/snippet.json", [
1432
+ ::File.write "#{repo_path}/#{repo_name}/snippet.json", [
1433
1433
  '{"name": "' + repo_name + '", "main": "src"}',
1434
1434
  ].join($/)
1435
1435
 
1436
1436
  # src/1.rb
1437
- File.write "#{repo_path}/#{repo_name}/src/1.rb", [
1437
+ ::File.write "#{repo_path}/#{repo_name}/src/1.rb", [
1438
1438
  '# @snip</2.rb>',
1439
1439
  'def func_1',
1440
1440
  ' return 2 * func_2()',
@@ -1442,7 +1442,7 @@ describe SocialSnippet::Core do
1442
1442
  ].join($/)
1443
1443
 
1444
1444
  # src/2.rb
1445
- File.write "#{repo_path}/#{repo_name}/src/2.rb", [
1445
+ ::File.write "#{repo_path}/#{repo_name}/src/2.rb", [
1446
1446
  'def func_2',
1447
1447
  ' return 42',
1448
1448
  'end',
@@ -1457,8 +1457,8 @@ describe SocialSnippet::Core do
1457
1457
  repo
1458
1458
  end
1459
1459
 
1460
- allow(fake_social_snippet.repo_manager).to receive(:find_repository).with(repo_name) { repo_config.call }
1461
- allow(fake_social_snippet.repo_manager).to receive(:find_repository).with(repo_name, short_commit_id) { repo_config.call }
1460
+ allow(fake_core.repo_manager).to receive(:find_repository).with(repo_name) { repo_config.call }
1461
+ allow(fake_core.repo_manager).to receive(:find_repository).with(repo_name, short_commit_id) { repo_config.call }
1462
1462
 
1463
1463
  end # prepare my-repo
1464
1464
 
@@ -1485,7 +1485,7 @@ describe SocialSnippet::Core do
1485
1485
  ].join($/)
1486
1486
  end
1487
1487
 
1488
- subject { fake_social_snippet.api.insert_snippet(input) }
1488
+ subject { fake_core.api.insert_snippet(input) }
1489
1489
  it { should eq output }
1490
1490
 
1491
1491
  end
@@ -1495,33 +1495,33 @@ describe SocialSnippet::Core do
1495
1495
  before do
1496
1496
  repo_name = "my-repo"
1497
1497
 
1498
- FileUtils.mkdir_p "#{repo_path}"
1499
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}"
1500
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/.git"
1501
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/a"
1502
- FileUtils.touch "#{repo_path}/#{repo_name}/snippet.json"
1503
- FileUtils.touch "#{repo_path}/#{repo_name}/a.rb"
1504
- FileUtils.touch "#{repo_path}/#{repo_name}/a/1.rb"
1505
- FileUtils.touch "#{repo_path}/#{repo_name}/a/2.rb"
1498
+ ::FileUtils.mkdir_p "#{repo_path}"
1499
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}"
1500
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/.git"
1501
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/a"
1502
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/snippet.json"
1503
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/a.rb"
1504
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/a/1.rb"
1505
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/a/2.rb"
1506
1506
 
1507
1507
  # snippet.json
1508
- File.write "#{repo_path}/#{repo_name}/snippet.json", [
1508
+ ::File.write "#{repo_path}/#{repo_name}/snippet.json", [
1509
1509
  '{"name": "' + repo_name + '"}',
1510
1510
  ].join($/)
1511
1511
 
1512
1512
  # a.rb
1513
- File.write "#{repo_path}/#{repo_name}/a.rb", [
1513
+ ::File.write "#{repo_path}/#{repo_name}/a.rb", [
1514
1514
  '# @snip <./a/1.rb>',
1515
1515
  '# @snip <./a/2.rb>',
1516
1516
  ].join($/)
1517
1517
 
1518
1518
  # a/1.rb
1519
- File.write "#{repo_path}/#{repo_name}/a/1.rb", [
1519
+ ::File.write "#{repo_path}/#{repo_name}/a/1.rb", [
1520
1520
  'puts "1"',
1521
1521
  ].join($/)
1522
1522
 
1523
1523
  # a/2.rb
1524
- File.write "#{repo_path}/#{repo_name}/a/2.rb", [
1524
+ ::File.write "#{repo_path}/#{repo_name}/a/2.rb", [
1525
1525
  'puts "2"',
1526
1526
  ].join($/)
1527
1527
 
@@ -1534,8 +1534,8 @@ describe SocialSnippet::Core do
1534
1534
  repo
1535
1535
  end
1536
1536
 
1537
- allow(fake_social_snippet.repo_manager).to receive(:find_repository).with("my-repo") { repo_config.call }
1538
- allow(fake_social_snippet.repo_manager).to receive(:find_repository).with("my-repo", short_commit_id) { repo_config.call }
1537
+ allow(fake_core.repo_manager).to receive(:find_repository).with("my-repo") { repo_config.call }
1538
+ allow(fake_core.repo_manager).to receive(:find_repository).with("my-repo", short_commit_id) { repo_config.call }
1539
1539
  end # my-repo
1540
1540
 
1541
1541
  let(:input) do
@@ -1554,7 +1554,7 @@ describe SocialSnippet::Core do
1554
1554
  ].join($/)
1555
1555
  end
1556
1556
 
1557
- subject { fake_social_snippet.api.insert_snippet(input) }
1557
+ subject { fake_core.api.insert_snippet(input) }
1558
1558
  it { should eq output }
1559
1559
 
1560
1560
  end # snip with repo
@@ -1564,22 +1564,22 @@ describe SocialSnippet::Core do
1564
1564
  before do
1565
1565
  repo_name = "repo-a"
1566
1566
 
1567
- FileUtils.mkdir_p "#{repo_path}"
1568
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}"
1569
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/.git"
1570
- FileUtils.touch "#{repo_path}/#{repo_name}/snippet.json"
1571
- FileUtils.touch "#{repo_path}/#{repo_name}/parent"
1572
- FileUtils.touch "#{repo_path}/#{repo_name}/child_1"
1573
- FileUtils.touch "#{repo_path}/#{repo_name}/child_2"
1574
- FileUtils.touch "#{repo_path}/#{repo_name}/child_3"
1567
+ ::FileUtils.mkdir_p "#{repo_path}"
1568
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}"
1569
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/.git"
1570
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/snippet.json"
1571
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/parent"
1572
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/child_1"
1573
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/child_2"
1574
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/child_3"
1575
1575
 
1576
1576
  # snippet.json
1577
- File.write "#{repo_path}/#{repo_name}/snippet.json", [
1577
+ ::File.write "#{repo_path}/#{repo_name}/snippet.json", [
1578
1578
  '{"name": "' + repo_name + '"}',
1579
1579
  ].join($/)
1580
1580
 
1581
1581
  # parent
1582
- File.write "#{repo_path}/#{repo_name}/parent", [
1582
+ ::File.write "#{repo_path}/#{repo_name}/parent", [
1583
1583
  '@snip<child_1>',
1584
1584
  '@snip<child_2>',
1585
1585
  '@snip<child_3>',
@@ -1594,8 +1594,8 @@ describe SocialSnippet::Core do
1594
1594
  repo
1595
1595
  end
1596
1596
 
1597
- allow(fake_social_snippet.repo_manager).to receive(:find_repository).with(repo_name) { repo_config.call }
1598
- allow(fake_social_snippet.repo_manager).to receive(:find_repository).with(repo_name, short_commit_id) { repo_config.call }
1597
+ allow(fake_core.repo_manager).to receive(:find_repository).with(repo_name) { repo_config.call }
1598
+ allow(fake_core.repo_manager).to receive(:find_repository).with(repo_name, short_commit_id) { repo_config.call }
1599
1599
  end # repo-a
1600
1600
 
1601
1601
  let(:input) do
@@ -1613,7 +1613,7 @@ describe SocialSnippet::Core do
1613
1613
  ].join($/)
1614
1614
  end
1615
1615
 
1616
- subject { fake_social_snippet.api.insert_snippet(input) }
1616
+ subject { fake_core.api.insert_snippet(input) }
1617
1617
  it { should eq output }
1618
1618
 
1619
1619
  end # multiple snippets without duplicates
@@ -1623,22 +1623,22 @@ describe SocialSnippet::Core do
1623
1623
  before do
1624
1624
  repo_name = "my_repo"
1625
1625
 
1626
- FileUtils.mkdir_p "#{repo_path}"
1627
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}"
1628
- FileUtils.mkdir_p "#{repo_path}/#{repo_name}/.git"
1629
- FileUtils.touch "#{repo_path}/#{repo_name}/snippet.json"
1630
- FileUtils.touch "#{repo_path}/#{repo_name}/parent"
1631
- FileUtils.touch "#{repo_path}/#{repo_name}/child_1"
1632
- FileUtils.touch "#{repo_path}/#{repo_name}/child_2"
1633
- FileUtils.touch "#{repo_path}/#{repo_name}/child_3"
1626
+ ::FileUtils.mkdir_p "#{repo_path}"
1627
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}"
1628
+ ::FileUtils.mkdir_p "#{repo_path}/#{repo_name}/.git"
1629
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/snippet.json"
1630
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/parent"
1631
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/child_1"
1632
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/child_2"
1633
+ ::FileUtils.touch "#{repo_path}/#{repo_name}/child_3"
1634
1634
 
1635
1635
  # snippet.json
1636
- File.write "#{repo_path}/#{repo_name}/snippet.json", [
1636
+ ::File.write "#{repo_path}/#{repo_name}/snippet.json", [
1637
1637
  '{"name": "' + repo_name + '"}',
1638
1638
  ].join($/)
1639
1639
 
1640
1640
  # parent
1641
- File.write "#{repo_path}/#{repo_name}/parent", [
1641
+ ::File.write "#{repo_path}/#{repo_name}/parent", [
1642
1642
  '@snip<child_1>',
1643
1643
  '@snip<child_2>',
1644
1644
  '@snip<child_2>',
@@ -1657,8 +1657,8 @@ describe SocialSnippet::Core do
1657
1657
  repo
1658
1658
  end
1659
1659
 
1660
- allow(fake_social_snippet.repo_manager).to receive(:find_repository).with(repo_name) { repo_config.call }
1661
- allow(fake_social_snippet.repo_manager).to receive(:find_repository).with(repo_name, short_commit_id) { repo_config.call }
1660
+ allow(fake_core.repo_manager).to receive(:find_repository).with(repo_name) { repo_config.call }
1661
+ allow(fake_core.repo_manager).to receive(:find_repository).with(repo_name, short_commit_id) { repo_config.call }
1662
1662
  end
1663
1663
 
1664
1664
  let(:input) do
@@ -1679,7 +1679,7 @@ describe SocialSnippet::Core do
1679
1679
  ].join($/)
1680
1680
  end
1681
1681
 
1682
- subject { fake_social_snippet.api.insert_snippet(input) }
1682
+ subject { fake_core.api.insert_snippet(input) }
1683
1683
  it { should eq output }
1684
1684
 
1685
1685
  end
@@ -1691,17 +1691,17 @@ describe SocialSnippet::Core do
1691
1691
  before do
1692
1692
  repo_name = "my-repo"
1693
1693
 
1694
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}"
1695
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}"
1696
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/.git"
1697
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/src"
1698
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json"
1699
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/src/1"
1700
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/src/2"
1701
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/src/3"
1694
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}"
1695
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}"
1696
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/.git"
1697
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/src"
1698
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json"
1699
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/src/1"
1700
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/src/2"
1701
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/src/3"
1702
1702
 
1703
1703
  # snippet.json
1704
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json", [
1704
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json", [
1705
1705
  '{',
1706
1706
  ' "name": "' + repo_name + '",',
1707
1707
  ' "main": "src"',
@@ -1709,18 +1709,18 @@ describe SocialSnippet::Core do
1709
1709
  ].join($/)
1710
1710
 
1711
1711
  # src/1
1712
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/src/1", [
1712
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/src/1", [
1713
1713
  '@snip<2>',
1714
1714
  '@snip<3>',
1715
1715
  ].join($/)
1716
1716
 
1717
1717
  # src/2
1718
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/src/2", [
1718
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/src/2", [
1719
1719
  '2',
1720
1720
  ].join($/)
1721
1721
 
1722
1722
  # src/3
1723
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/src/3", [
1723
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/src/3", [
1724
1724
  '3',
1725
1725
  ].join($/)
1726
1726
  end # prepare for my-repo
@@ -1729,18 +1729,18 @@ describe SocialSnippet::Core do
1729
1729
  repo_name = "has-version"
1730
1730
  repo_version = "0.0.1"
1731
1731
 
1732
- FileUtils.mkdir_p "#{tmp_repo_path}"
1733
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
1734
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}"
1735
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}/.git"
1736
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src"
1737
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/snippet.json"
1738
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/1"
1739
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/2"
1740
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/3"
1732
+ ::FileUtils.mkdir_p "#{tmp_repo_path}"
1733
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
1734
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}"
1735
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}/.git"
1736
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src"
1737
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/snippet.json"
1738
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/1"
1739
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/2"
1740
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/3"
1741
1741
 
1742
1742
  # snippet.json
1743
- File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/snippet.json", [
1743
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/snippet.json", [
1744
1744
  '{',
1745
1745
  ' "name": "' + repo_name + '",',
1746
1746
  ' "main": "src"',
@@ -1748,19 +1748,19 @@ describe SocialSnippet::Core do
1748
1748
  ].join($/)
1749
1749
 
1750
1750
  # src/1
1751
- File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/1", [
1751
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/1", [
1752
1752
  '@snip<2>',
1753
1753
  '@snip<3>',
1754
1754
  '0.0.1: 1',
1755
1755
  ].join($/)
1756
1756
 
1757
1757
  # src/2
1758
- File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/2", [
1758
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/2", [
1759
1759
  '0.0.1: 2',
1760
1760
  ].join($/)
1761
1761
 
1762
1762
  # src/3
1763
- File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/3", [
1763
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/3", [
1764
1764
  '0.0.1: 3',
1765
1765
  ].join($/)
1766
1766
  end # prepare has-version#0.0.1
@@ -1769,18 +1769,18 @@ describe SocialSnippet::Core do
1769
1769
  repo_name = "has-version"
1770
1770
  repo_version = "1.2.3"
1771
1771
 
1772
- FileUtils.mkdir_p "#{tmp_repo_path}"
1773
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
1774
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}"
1775
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}/.git"
1776
- FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src"
1777
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/snippet.json"
1778
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/1"
1779
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/2"
1780
- FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/3"
1772
+ ::FileUtils.mkdir_p "#{tmp_repo_path}"
1773
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}"
1774
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}"
1775
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}/.git"
1776
+ ::FileUtils.mkdir_p "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src"
1777
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/snippet.json"
1778
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/1"
1779
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/2"
1780
+ ::FileUtils.touch "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/3"
1781
1781
 
1782
1782
  # snippet.json
1783
- File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/snippet.json", [
1783
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/snippet.json", [
1784
1784
  '{',
1785
1785
  ' "name": "' + repo_name + '",',
1786
1786
  ' "main": "src"',
@@ -1788,19 +1788,19 @@ describe SocialSnippet::Core do
1788
1788
  ].join($/)
1789
1789
 
1790
1790
  # src/1
1791
- File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/1", [
1791
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/1", [
1792
1792
  '@snip<2>',
1793
1793
  '@snip<3>',
1794
1794
  '1.2.3: 1',
1795
1795
  ].join($/)
1796
1796
 
1797
1797
  # src/2
1798
- File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/2", [
1798
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/2", [
1799
1799
  '1.2.3: 2',
1800
1800
  ].join($/)
1801
1801
 
1802
1802
  # src/3
1803
- File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/3", [
1803
+ ::File.write "#{tmp_repo_path}/#{repo_name}/#{repo_version}/src/3", [
1804
1804
  '1.2.3: 3',
1805
1805
  ].join($/)
1806
1806
  end # prepare has-version#1.2.3
@@ -1837,7 +1837,7 @@ describe SocialSnippet::Core do
1837
1837
  ].join($/).freeze
1838
1838
  end
1839
1839
 
1840
- subject { fake_social_snippet.api.insert_snippet(input) }
1840
+ subject { fake_core.api.insert_snippet(input) }
1841
1841
  it { should eq output }
1842
1842
 
1843
1843
  end
@@ -1864,7 +1864,7 @@ describe SocialSnippet::Core do
1864
1864
  ].join($/).freeze
1865
1865
  end
1866
1866
 
1867
- subject { fake_social_snippet.api.insert_snippet(input) }
1867
+ subject { fake_core.api.insert_snippet(input) }
1868
1868
  it { should eq output }
1869
1869
 
1870
1870
  end # snipped
@@ -1897,7 +1897,7 @@ describe SocialSnippet::Core do
1897
1897
  ].join($/).freeze
1898
1898
  end
1899
1899
 
1900
- subject { fake_social_snippet.api.insert_snippet(input) }
1900
+ subject { fake_core.api.insert_snippet(input) }
1901
1901
  it { should eq output }
1902
1902
 
1903
1903
  end
@@ -1927,7 +1927,7 @@ describe SocialSnippet::Core do
1927
1927
  ].join($/)
1928
1928
  end
1929
1929
 
1930
- subject { fake_social_snippet.api.insert_snippet(input) }
1930
+ subject { fake_core.api.insert_snippet(input) }
1931
1931
  it { should eq output }
1932
1932
 
1933
1933
  end # already snipped case
@@ -1952,7 +1952,7 @@ describe SocialSnippet::Core do
1952
1952
  ].join($/)
1953
1953
  end
1954
1954
 
1955
- subject { fake_social_snippet.api.insert_snippet(input) }
1955
+ subject { fake_core.api.insert_snippet(input) }
1956
1956
  it { should eq output }
1957
1957
 
1958
1958
  end # not already snipped case
@@ -1964,15 +1964,15 @@ describe SocialSnippet::Core do
1964
1964
  before do
1965
1965
  repo_name = "my_lib"
1966
1966
 
1967
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}"
1968
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}"
1969
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/.git"
1970
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/src/lib"
1971
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json"
1972
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/src/lib/add_func.cpp"
1967
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}"
1968
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}"
1969
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/.git"
1970
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/src/lib"
1971
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json"
1972
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/src/lib/add_func.cpp"
1973
1973
 
1974
1974
  # snippet.json
1975
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json", [
1975
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json", [
1976
1976
  '{',
1977
1977
  ' "name": "' + repo_name + '",',
1978
1978
  ' "main": "src"',
@@ -1980,7 +1980,7 @@ describe SocialSnippet::Core do
1980
1980
  ].join($/)
1981
1981
 
1982
1982
  # src/add_func.cpp
1983
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/src/add_func.cpp", [
1983
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/src/add_func.cpp", [
1984
1984
  'int add_func( int a, int b ) {',
1985
1985
  ' return a + b;',
1986
1986
  '}',
@@ -1990,19 +1990,19 @@ describe SocialSnippet::Core do
1990
1990
  before do
1991
1991
  repo_name = "my_repo_a"
1992
1992
 
1993
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}"
1994
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}"
1995
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/.git"
1996
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json"
1997
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/use_add_func.cpp"
1993
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}"
1994
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}"
1995
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/.git"
1996
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json"
1997
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/use_add_func.cpp"
1998
1998
 
1999
1999
  # snippet.json
2000
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json", [
2000
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json", [
2001
2001
  '{"name": "' + repo_name + '"}',
2002
2002
  ].join($/)
2003
2003
 
2004
2004
  # use_add_func.cpp
2005
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/use_add_func.cpp", [
2005
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/use_add_func.cpp", [
2006
2006
  '// @snip <my_lib:add_func.cpp>',
2007
2007
  'int my_repo_a_use_add_func( int a, int b ) {',
2008
2008
  ' return add_func(a, b);',
@@ -2013,19 +2013,19 @@ describe SocialSnippet::Core do
2013
2013
  before do
2014
2014
  repo_name = "my_repo_b"
2015
2015
 
2016
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}"
2017
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}"
2018
- FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/.git"
2019
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json"
2020
- FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/use_add_func.cpp"
2016
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}"
2017
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}"
2018
+ ::FileUtils.mkdir_p "#{tmp_repo_path_no_ver}/#{repo_name}/.git"
2019
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json"
2020
+ ::FileUtils.touch "#{tmp_repo_path_no_ver}/#{repo_name}/use_add_func.cpp"
2021
2021
 
2022
2022
  # snippet.json
2023
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json", [
2023
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/snippet.json", [
2024
2024
  '{"name": "' + repo_name + '"}',
2025
2025
  ].join($/)
2026
2026
 
2027
2027
  # use_add_func.cpp
2028
- File.write "#{tmp_repo_path_no_ver}/#{repo_name}/use_add_func.cpp", [
2028
+ ::File.write "#{tmp_repo_path_no_ver}/#{repo_name}/use_add_func.cpp", [
2029
2029
  '// @snip <my_lib:add_func.cpp>',
2030
2030
  'int my_repo_b_use_add_func( int a, int b ) {',
2031
2031
  ' return add_func(a, b);',
@@ -2078,7 +2078,7 @@ describe SocialSnippet::Core do
2078
2078
  end
2079
2079
 
2080
2080
  context "call insert_snippet" do
2081
- subject { fake_social_snippet.api.insert_snippet(input) }
2081
+ subject { fake_core.api.insert_snippet(input) }
2082
2082
  it { should eq output }
2083
2083
  end
2084
2084
 
@@ -2091,8 +2091,8 @@ describe SocialSnippet::Core do
2091
2091
  context "range cut (simple)" do
2092
2092
 
2093
2093
  before do
2094
- FileUtils.touch "./file1.cpp"
2095
- File.write "./file1.cpp", [
2094
+ ::FileUtils.touch "./file1.cpp"
2095
+ ::File.write "./file1.cpp", [
2096
2096
  "// @begin_cut",
2097
2097
  "#include <path/to/lib>",
2098
2098
  "// @end_cut",
@@ -2115,16 +2115,16 @@ describe SocialSnippet::Core do
2115
2115
  ].join($/)
2116
2116
  end
2117
2117
 
2118
- subject { fake_social_snippet.api.insert_snippet(input) }
2118
+ subject { fake_core.api.insert_snippet(input) }
2119
2119
  it { should eq output }
2120
2120
 
2121
- end
2121
+ end # range cut
2122
2122
 
2123
2123
  context "range cut (nested snippet)" do
2124
2124
 
2125
2125
  before do
2126
- FileUtils.touch "./file1.cpp"
2127
- File.write "./file1.cpp", [
2126
+ ::FileUtils.touch "./file1.cpp"
2127
+ ::File.write "./file1.cpp", [
2128
2128
  "// @begin_cut",
2129
2129
  "#include <path/to/lib>",
2130
2130
  "// @end_cut",
@@ -2132,7 +2132,7 @@ describe SocialSnippet::Core do
2132
2132
  "void func1() {",
2133
2133
  "}",
2134
2134
  ].join($/)
2135
- File.write "./file2.cpp", [
2135
+ ::File.write "./file2.cpp", [
2136
2136
  "// @begin_cut",
2137
2137
  "#include <path/to/lib>",
2138
2138
  "// @end_cut",
@@ -2158,13 +2158,647 @@ describe SocialSnippet::Core do
2158
2158
  ].join($/)
2159
2159
  end
2160
2160
 
2161
- subject { fake_social_snippet.api.insert_snippet(input) }
2161
+ subject { fake_core.api.insert_snippet(input) }
2162
+ it { should eq output }
2163
+
2164
+ end # range cut (nested)
2165
+
2166
+ context "cut line" do
2167
+
2168
+ before do
2169
+ ::FileUtils.touch "./file1.cpp"
2170
+ ::File.write "./file1.cpp", [
2171
+ "#include <path/to/lib> // @cut",
2172
+ "void func() {",
2173
+ "}",
2174
+ ].join($/)
2175
+ end
2176
+
2177
+ let(:input) do
2178
+ [
2179
+ "// @snip <./file1.cpp>",
2180
+ ].join($/)
2181
+ end
2182
+
2183
+ let(:output) do
2184
+ [
2185
+ "// @snippet <file1.cpp>",
2186
+ "void func() {",
2187
+ "}",
2188
+ ].join($/)
2189
+ end
2190
+
2191
+ subject { fake_core.api.insert_snippet(input) }
2192
+ it { should eq output }
2193
+
2194
+ end # cut line
2195
+
2196
+ context "cut line (nested case)" do
2197
+
2198
+ before do
2199
+ ::FileUtils.touch "./file1.cpp"
2200
+ ::File.write "./file1.cpp", [
2201
+ "#include <path/to/lib> // @cut",
2202
+ "// @snip <./file2.cpp>",
2203
+ "void func1() {",
2204
+ "}",
2205
+ ].join($/)
2206
+ ::File.write "./file2.cpp", [
2207
+ "#include <path/to/lib> // @cut",
2208
+ "void func2() {",
2209
+ "}",
2210
+ ].join($/)
2211
+ end
2212
+
2213
+ let(:input) do
2214
+ [
2215
+ "// @snip <./file1.cpp>",
2216
+ ].join($/)
2217
+ end
2218
+
2219
+ let(:output) do
2220
+ [
2221
+ "// @snippet <file2.cpp>",
2222
+ "void func2() {",
2223
+ "}",
2224
+ "// @snippet <file1.cpp>",
2225
+ "void func1() {",
2226
+ "}",
2227
+ ].join($/)
2228
+ end
2229
+
2230
+ subject { fake_core.api.insert_snippet(input) }
2162
2231
  it { should eq output }
2163
2232
 
2164
2233
  end
2165
2234
 
2166
2235
  end # filters
2167
2236
 
2237
+ context "snippet's context testing" do
2238
+
2239
+ context "Golang Project 1" do
2240
+
2241
+ before do
2242
+ ::FileUtils.mkdir "./runner"
2243
+ ::FileUtils.touch "./runner/runner.go"
2244
+ ::FileUtils.mkdir "./solver"
2245
+ ::FileUtils.touch "./solver/input.go"
2246
+ ::FileUtils.touch "./solver/output.go"
2247
+ ::FileUtils.touch "./solver/solver.go"
2248
+ ::FileUtils.mkdir "./typedef"
2249
+ ::FileUtils.touch "./typedef/typedef.go"
2250
+ ::FileUtils.touch "./main.go"
2251
+
2252
+ ::File.write "./runner/runner", [
2253
+ "// @snip <../solver/solver.go>",
2254
+ ].join($/)
2255
+
2256
+ ::File.write "./solver/input.go", [
2257
+ "type Input struct {",
2258
+ " eof bool",
2259
+ "}",
2260
+ ].join($/)
2261
+
2262
+ ::File.write "./solver/output.go", [
2263
+ "type Output struct {",
2264
+ "}",
2265
+ ].join($/)
2266
+
2267
+ ::File.write "./solver/solver.go", [
2268
+ "// @snip <./input.go>",
2269
+ "// @snip <./output.go>",
2270
+ "",
2271
+ "type Solver struct {",
2272
+ "in *Input",
2273
+ "out *Output",
2274
+ "}",
2275
+ "",
2276
+ "func (s *Solver) input() *Input {",
2277
+ "return s.in",
2278
+ "}",
2279
+ "",
2280
+ "func CreateSolver() *Solver {",
2281
+ "s := new(Solver)",
2282
+ "s.in = new(Input)",
2283
+ "s.out = new(Output)",
2284
+ "return s",
2285
+ "}",
2286
+ ].join($/)
2287
+
2288
+ ::File.write "./typedef/typedef.go", [
2289
+ "type Int int64",
2290
+ ].join($/)
2291
+
2292
+ ::File.write "main.go", [
2293
+ "package main",
2294
+ "",
2295
+ "// @snip <./typedef/typedef.go>",
2296
+ "// @snip <./solver/solver.go>",
2297
+ "// @snip <./runner/runner.go>",
2298
+ "",
2299
+ "func main() {",
2300
+ "}",
2301
+ "",
2302
+ ].join($/)
2303
+ end
2304
+
2305
+ context "snip from main.go directly" do
2306
+
2307
+ let(:input) { ::File.read "main.go" }
2308
+
2309
+ let(:output) do
2310
+ [
2311
+ "package main",
2312
+ "",
2313
+ "// @snippet <typedef/typedef.go>",
2314
+ "type Int int64",
2315
+ "// @snippet <solver/input.go>",
2316
+ "type Input struct {",
2317
+ " eof bool",
2318
+ "}",
2319
+ "// @snippet <solver/output.go>",
2320
+ "type Output struct {",
2321
+ "}",
2322
+ "// @snippet <solver/solver.go>",
2323
+ "",
2324
+ "type Solver struct {",
2325
+ "in *Input",
2326
+ "out *Output",
2327
+ "}",
2328
+ "",
2329
+ "func (s *Solver) input() *Input {",
2330
+ "return s.in",
2331
+ "}",
2332
+ "",
2333
+ "func CreateSolver() *Solver {",
2334
+ "s := new(Solver)",
2335
+ "s.in = new(Input)",
2336
+ "s.out = new(Output)",
2337
+ "return s",
2338
+ "}",
2339
+ "// @snippet <runner/runner.go>",
2340
+ "",
2341
+ "func main() {",
2342
+ "}",
2343
+ ].join($/)
2344
+ end
2345
+
2346
+ subject { fake_core.api.insert_snippet input }
2347
+ it { should eq output }
2348
+
2349
+ end # snip from main.go directly
2350
+
2351
+ context "snip main.go" do
2352
+
2353
+ let(:input) do
2354
+ [
2355
+ "// @snip <main.go>",
2356
+ ].join($/)
2357
+ end
2358
+
2359
+ let(:output) do
2360
+ [
2361
+ "// @snippet <typedef/typedef.go>",
2362
+ "type Int int64",
2363
+ "// @snippet <solver/input.go>",
2364
+ "type Input struct {",
2365
+ " eof bool",
2366
+ "}",
2367
+ "// @snippet <solver/output.go>",
2368
+ "type Output struct {",
2369
+ "}",
2370
+ "// @snippet <solver/solver.go>",
2371
+ "",
2372
+ "type Solver struct {",
2373
+ "in *Input",
2374
+ "out *Output",
2375
+ "}",
2376
+ "",
2377
+ "func (s *Solver) input() *Input {",
2378
+ "return s.in",
2379
+ "}",
2380
+ "",
2381
+ "func CreateSolver() *Solver {",
2382
+ "s := new(Solver)",
2383
+ "s.in = new(Input)",
2384
+ "s.out = new(Output)",
2385
+ "return s",
2386
+ "}",
2387
+ "// @snippet <runner/runner.go>",
2388
+ "// @snippet <main.go>",
2389
+ "package main",
2390
+ "",
2391
+ "",
2392
+ "func main() {",
2393
+ "}",
2394
+ ].join($/)
2395
+ end
2396
+
2397
+ subject { fake_core.api.insert_snippet input }
2398
+ it { should eq output }
2399
+
2400
+ end # snip main.go
2401
+
2402
+ end # Golang Project 1
2403
+
2404
+ context "../" do
2405
+
2406
+ before do
2407
+ ::FileUtils.mkdir "./foo"
2408
+ ::FileUtils.touch "./foo/foo.go"
2409
+ ::FileUtils.mkdir "./bar"
2410
+ ::FileUtils.touch "./bar/bar.go"
2411
+
2412
+ ::File.write "./foo/foo.go", [
2413
+ "// @begin_cut",
2414
+ "package foo",
2415
+ "// @end_cut",
2416
+ "func Foo() {",
2417
+ "}",
2418
+ ].join($/)
2419
+
2420
+ ::File.write "./bar/bar.go", [
2421
+ "// @begin_cut",
2422
+ "package bar",
2423
+ "import \"../foo\"",
2424
+ "// @end_cut",
2425
+ "// @snip <../foo/foo.go>",
2426
+ "func Bar() {",
2427
+ "}",
2428
+ ].join($/)
2429
+ end
2430
+
2431
+ let(:input) do
2432
+ [
2433
+ "// @snip <./foo/foo.go>",
2434
+ "// @snip <./bar/bar.go>",
2435
+ ].join($/)
2436
+ end
2437
+
2438
+ let(:output) do
2439
+ [
2440
+ "// @snippet <foo/foo.go>",
2441
+ "func Foo() {",
2442
+ "}",
2443
+ "// @snippet <bar/bar.go>",
2444
+ "func Bar() {",
2445
+ "}",
2446
+ ].join($/)
2447
+ end
2448
+
2449
+ subject { fake_core.api.insert_snippet input }
2450
+ it { should eq output }
2451
+
2452
+ end
2453
+
2454
+ end
2455
+
2456
+ context "@no_tag" do
2457
+
2458
+ context "no_tag is in cut range" do
2459
+
2460
+ before do
2461
+ ::FileUtils.touch "proxy.rb"
2462
+ ::FileUtils.touch "foo.rb"
2463
+ ::FileUtils.mkdir "foo"
2464
+ ::FileUtils.touch "foo/func1.rb"
2465
+ ::FileUtils.touch "foo/func2.rb"
2466
+ ::FileUtils.touch "foo/func3.rb"
2467
+
2468
+ ::File.write "proxy.rb", [
2469
+ "# @snip <foo.rb>",
2470
+ "# @begin_cut",
2471
+ "# @no_tag",
2472
+ "# @end_cut",
2473
+ ].join($/)
2474
+
2475
+ ::File.write "foo.rb", [
2476
+ "# @begin_cut",
2477
+ "# @no_tag",
2478
+ "# @end_cut",
2479
+ "# @snip <foo/func1.rb>",
2480
+ "# @snip <foo/func2.rb>",
2481
+ "# @snip <foo/func3.rb>",
2482
+ ].join($/)
2483
+
2484
+ ::File.write "foo/func1.rb", [
2485
+ "def func1",
2486
+ " 1",
2487
+ "end",
2488
+ ].join($/)
2489
+
2490
+ ::File.write "foo/func2.rb", [
2491
+ "def func2",
2492
+ " 2",
2493
+ "end",
2494
+ ].join($/)
2495
+
2496
+ ::File.write "foo/func3.rb", [
2497
+ "def func3",
2498
+ " 3",
2499
+ "end",
2500
+ ].join($/)
2501
+ end
2502
+
2503
+ context "snip foo.rb" do
2504
+
2505
+ let(:input) do
2506
+ [
2507
+ "# @snip <foo.rb>",
2508
+ ].join($/)
2509
+ end
2510
+
2511
+ let(:output) do
2512
+ [
2513
+ "# @snippet <foo/func1.rb>",
2514
+ "def func1",
2515
+ " 1",
2516
+ "end",
2517
+ "# @snippet <foo/func2.rb>",
2518
+ "def func2",
2519
+ " 2",
2520
+ "end",
2521
+ "# @snippet <foo/func3.rb>",
2522
+ "def func3",
2523
+ " 3",
2524
+ "end",
2525
+ "# @snippet <foo.rb>",
2526
+ ].join($/)
2527
+ end
2528
+
2529
+ subject { fake_core.api.insert_snippet input }
2530
+ it { should eq output }
2531
+
2532
+ end # snip foo.rb
2533
+
2534
+ context "snip proxy.rb" do
2535
+
2536
+ let(:input) do
2537
+ [
2538
+ "# @snip <proxy.rb>",
2539
+ ].join($/)
2540
+ end
2541
+
2542
+ let(:output) do
2543
+ [
2544
+ "# @snippet <foo/func1.rb>",
2545
+ "def func1",
2546
+ " 1",
2547
+ "end",
2548
+ "# @snippet <foo/func2.rb>",
2549
+ "def func2",
2550
+ " 2",
2551
+ "end",
2552
+ "# @snippet <foo/func3.rb>",
2553
+ "def func3",
2554
+ " 3",
2555
+ "end",
2556
+ "# @snippet <foo.rb>",
2557
+ "# @snippet <proxy.rb>",
2558
+ ].join($/)
2559
+ end
2560
+
2561
+ subject { fake_core.api.insert_snippet input }
2562
+ it { should eq output }
2563
+
2564
+ end # snip proxy.rb
2565
+
2566
+ end
2567
+
2568
+ context "for ruby module" do
2569
+
2570
+ before do
2571
+ ::FileUtils.touch "proxy.rb"
2572
+ ::FileUtils.touch "foo.rb"
2573
+ ::FileUtils.mkdir "foo"
2574
+ ::FileUtils.touch "foo/func1.rb"
2575
+ ::FileUtils.touch "foo/func2.rb"
2576
+ ::FileUtils.touch "foo/func3.rb"
2577
+
2578
+ ::File.write "proxy.rb", [
2579
+ "# @snip <foo.rb>",
2580
+ "# @no_tag",
2581
+ ].join($/)
2582
+
2583
+ ::File.write "foo.rb", [
2584
+ "# @no_tag",
2585
+ "# @snip <foo/func1.rb>",
2586
+ "# @snip <foo/func2.rb>",
2587
+ "# @snip <foo/func3.rb>",
2588
+ ].join($/)
2589
+
2590
+ ::File.write "foo/func1.rb", [
2591
+ "def func1",
2592
+ " 1",
2593
+ "end",
2594
+ ].join($/)
2595
+
2596
+ ::File.write "foo/func2.rb", [
2597
+ "def func2",
2598
+ " 2",
2599
+ "end",
2600
+ ].join($/)
2601
+
2602
+ ::File.write "foo/func3.rb", [
2603
+ "def func3",
2604
+ " 3",
2605
+ "end",
2606
+ ].join($/)
2607
+ end
2608
+
2609
+ context "snip foo.rb" do
2610
+
2611
+ let(:input) do
2612
+ [
2613
+ "# @snip <foo.rb>",
2614
+ ].join($/)
2615
+ end
2616
+
2617
+ let(:output) do
2618
+ [
2619
+ "# @snippet <foo/func1.rb>",
2620
+ "def func1",
2621
+ " 1",
2622
+ "end",
2623
+ "# @snippet <foo/func2.rb>",
2624
+ "def func2",
2625
+ " 2",
2626
+ "end",
2627
+ "# @snippet <foo/func3.rb>",
2628
+ "def func3",
2629
+ " 3",
2630
+ "end",
2631
+ ].join($/)
2632
+ end
2633
+
2634
+ subject { fake_core.api.insert_snippet input }
2635
+ it { should eq output }
2636
+
2637
+ end # snip foo.rb
2638
+
2639
+ context "snip proxy.rb" do
2640
+
2641
+ let(:input) do
2642
+ [
2643
+ "# @snip <proxy.rb>",
2644
+ ].join($/)
2645
+ end
2646
+
2647
+ let(:output) do
2648
+ [
2649
+ "# @snippet <foo/func1.rb>",
2650
+ "def func1",
2651
+ " 1",
2652
+ "end",
2653
+ "# @snippet <foo/func2.rb>",
2654
+ "def func2",
2655
+ " 2",
2656
+ "end",
2657
+ "# @snippet <foo/func3.rb>",
2658
+ "def func3",
2659
+ " 3",
2660
+ "end",
2661
+ ].join($/)
2662
+ end
2663
+
2664
+ subject { fake_core.api.insert_snippet input }
2665
+ it { should eq output }
2666
+
2667
+ end # snip proxy.rb
2668
+
2669
+ context "add nested module" do
2670
+
2671
+ before do
2672
+ ::FileUtils.touch "foo/bar.rb"
2673
+ ::FileUtils.mkdir "foo/bar"
2674
+ ::FileUtils.touch "foo/bar/func1.rb"
2675
+ ::FileUtils.touch "foo/bar/func2.rb"
2676
+ ::FileUtils.touch "foo/bar/func3.rb"
2677
+
2678
+ ::File.write "foo.rb", [
2679
+ "# @no_tag",
2680
+ "# @snip <foo/func1.rb>",
2681
+ "# @snip <foo/func2.rb>",
2682
+ "# @snip <foo/func3.rb>",
2683
+ "# @snip <foo/bar.rb>",
2684
+ ].join($/)
2685
+
2686
+ ::File.write "foo/bar.rb", [
2687
+ "# @no_tag",
2688
+ "# @snip <bar/func1.rb>",
2689
+ "# @snip <bar/func2.rb>",
2690
+ "# @snip <bar/func3.rb>",
2691
+ ].join($/)
2692
+
2693
+ ::File.write "foo/bar/func1.rb", [
2694
+ "def bfunc1",
2695
+ " 1",
2696
+ "end",
2697
+ ].join($/)
2698
+
2699
+ ::File.write "foo/bar/func2.rb", [
2700
+ "def bfunc2",
2701
+ " 2",
2702
+ "end",
2703
+ ].join($/)
2704
+
2705
+ ::File.write "foo/bar/func3.rb", [
2706
+ "def bfunc3",
2707
+ " 3",
2708
+ "end",
2709
+ ].join($/)
2710
+ end
2711
+
2712
+ context "snip foo.rb" do
2713
+
2714
+ let(:input) do
2715
+ [
2716
+ "# @snip <foo.rb>",
2717
+ ].join($/)
2718
+ end
2719
+
2720
+ let(:output) do
2721
+ [
2722
+ "# @snippet <foo/func1.rb>",
2723
+ "def func1",
2724
+ " 1",
2725
+ "end",
2726
+ "# @snippet <foo/func2.rb>",
2727
+ "def func2",
2728
+ " 2",
2729
+ "end",
2730
+ "# @snippet <foo/func3.rb>",
2731
+ "def func3",
2732
+ " 3",
2733
+ "end",
2734
+ "# @snippet <foo/bar/func1.rb>",
2735
+ "def bfunc1",
2736
+ " 1",
2737
+ "end",
2738
+ "# @snippet <foo/bar/func2.rb>",
2739
+ "def bfunc2",
2740
+ " 2",
2741
+ "end",
2742
+ "# @snippet <foo/bar/func3.rb>",
2743
+ "def bfunc3",
2744
+ " 3",
2745
+ "end",
2746
+ ].join($/)
2747
+ end
2748
+
2749
+ subject { fake_core.api.insert_snippet input }
2750
+ it { should eq output }
2751
+
2752
+ end
2753
+
2754
+ context "snip proxy.rb" do
2755
+
2756
+ let(:input) do
2757
+ [
2758
+ "# @snip <proxy.rb>",
2759
+ ].join($/)
2760
+ end
2761
+
2762
+ let(:output) do
2763
+ [
2764
+ "# @snippet <foo/func1.rb>",
2765
+ "def func1",
2766
+ " 1",
2767
+ "end",
2768
+ "# @snippet <foo/func2.rb>",
2769
+ "def func2",
2770
+ " 2",
2771
+ "end",
2772
+ "# @snippet <foo/func3.rb>",
2773
+ "def func3",
2774
+ " 3",
2775
+ "end",
2776
+ "# @snippet <foo/bar/func1.rb>",
2777
+ "def bfunc1",
2778
+ " 1",
2779
+ "end",
2780
+ "# @snippet <foo/bar/func2.rb>",
2781
+ "def bfunc2",
2782
+ " 2",
2783
+ "end",
2784
+ "# @snippet <foo/bar/func3.rb>",
2785
+ "def bfunc3",
2786
+ " 3",
2787
+ "end",
2788
+ ].join($/)
2789
+ end
2790
+
2791
+ subject { fake_core.api.insert_snippet input }
2792
+ it { should eq output }
2793
+
2794
+ end
2795
+
2796
+ end # add module
2797
+
2798
+ end # for ruby module
2799
+
2800
+ end
2801
+
2168
2802
  end # insert_snippet
2169
2803
 
2170
2804
  end # SocialSnippet::Core