social_snippet 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +7 -0
- data/README.md +1 -0
- data/lib/social_snippet.rb +13 -1
- data/lib/social_snippet/api.rb +3 -1
- data/lib/social_snippet/api/completion_api.rb +2 -6
- data/lib/social_snippet/api/config_api.rb +1 -1
- data/lib/social_snippet/api/manifest_api.rb +3 -5
- data/lib/social_snippet/api/show_api.rb +1 -2
- data/lib/social_snippet/command_line/command.rb +3 -2
- data/lib/social_snippet/command_line/sspm/sub_commands/complete_command.rb +1 -1
- data/lib/social_snippet/command_line/sspm/sub_commands/install_command.rb +0 -4
- data/lib/social_snippet/config.rb +0 -2
- data/lib/social_snippet/context.rb +0 -2
- data/lib/social_snippet/core.rb +1 -2
- data/lib/social_snippet/logger.rb +1 -2
- data/lib/social_snippet/registry/registry_resources/base.rb +0 -3
- data/lib/social_snippet/repository/drivers/base_repository.rb +0 -3
- data/lib/social_snippet/repository/drivers/git_repository.rb +0 -2
- data/lib/social_snippet/repository/repository_installer.rb +1 -2
- data/lib/social_snippet/snippet.rb +5 -1
- data/lib/social_snippet/tag.rb +0 -2
- data/lib/social_snippet/tsortable_hash.rb +0 -2
- data/lib/social_snippet/version.rb +1 -1
- data/social_snippet.gemspec +3 -2
- data/spec/lib/{api_spec.rb → api/insert_snippet_spec.rb} +2 -2
- data/test/{core_test.rb → insert_snippet_test.rb} +45 -4
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjJjNzJiN2EzNjk0Yzk3MjA0ODU3YWRiODIxYzE0NDYyNjZmODg3Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjA2MGEwNzEzZjk3NjZkMGEzMTE4ZGU5MzM1OWIxMmJjNjY4MzU5Yg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzVlYzRiZmQwM2MyZGM3ZWY5YjkxMjU4OGRlMmIzYjQyMmI0YmY1NzM3YTBl
|
10
|
+
OTBkYjBhMDliYTJjMzkyMjg2YWM0MjI3MDkzODA1MmY5M2Q1ZmRlNWZjYTdk
|
11
|
+
MTBjZTA1NDE4ZjljNGQ0ZTBkMDAwMWIxZjY3YjEwN2UzMDMyZmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDQxZWI2MDMyOTA0ODhkNTBiN2FmMjUxZDBhNjdiYjI1NzJjMjcwYzE0YmMy
|
14
|
+
NWIzMTgwZDkzZjA5YTllZWNkZmMzY2Q4YzFmNDZhZTU0NWJhM2ViYjBkNDYw
|
15
|
+
NWUyZjRhYmUxZTg4OWQzZThhNWY4ZDk4N2VhNzI5Zjg4YTZlODU=
|
data/.travis.yml
CHANGED
@@ -15,6 +15,13 @@ script:
|
|
15
15
|
- bundle exec rake spec_without_fakefs
|
16
16
|
- bundle exec rake test_without_fakefs
|
17
17
|
|
18
|
+
# shell access test
|
19
|
+
- bundle exec rake build
|
20
|
+
- gem install pkg/social_snippet-*.gem
|
21
|
+
- sspm install example-repo
|
22
|
+
- sspm update
|
23
|
+
- echo "// @snip <example-repo:func.cpp>" | ssnip
|
24
|
+
|
18
25
|
deploy:
|
19
26
|
provider: rubygems
|
20
27
|
api_key:
|
data/README.md
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
[![Code Climate](https://img.shields.io/codeclimate/github/social-snippet/social-snippet.svg?style=flat)](https://codeclimate.com/github/social-snippet/social-snippet)
|
6
6
|
[![Test Coverage](https://img.shields.io/codeclimate/coverage/github/social-snippet/social-snippet.svg?style=flat)](https://codeclimate.com/github/social-snippet/social-snippet)
|
7
7
|
[![API Doc](http://img.shields.io/badge/RubyDocs-API-green.svg?style=flat)](http://www.rubydoc.info/github/social-snippet/social-snippet)
|
8
|
+
[![Dependencies Status](https://img.shields.io/gemnasium/social-snippet/social-snippet.svg)](https://gemnasium.com/social-snippet/social-snippet)
|
8
9
|
|
9
10
|
TODO: Write a gem description
|
10
11
|
|
data/lib/social_snippet.rb
CHANGED
@@ -1,5 +1,17 @@
|
|
1
|
-
|
1
|
+
require "tsort"
|
2
|
+
require "logger"
|
3
|
+
require "highline"
|
4
|
+
require "pathname"
|
5
|
+
require "json"
|
6
|
+
require "yaml"
|
7
|
+
require "version_sorter"
|
8
|
+
require "rest_client"
|
9
|
+
require "optparse"
|
10
|
+
require "uri"
|
11
|
+
require "rugged"
|
12
|
+
require "wisper"
|
2
13
|
|
14
|
+
module SocialSnippet; end
|
3
15
|
require_relative "social_snippet/core"
|
4
16
|
require_relative "social_snippet/version"
|
5
17
|
require_relative "social_snippet/tag"
|
data/lib/social_snippet/api.rb
CHANGED
@@ -12,6 +12,8 @@ require_relative "api/registry_api"
|
|
12
12
|
|
13
13
|
class SocialSnippet::Api
|
14
14
|
|
15
|
+
include ::Wisper::Publisher
|
16
|
+
|
15
17
|
attr_reader :core
|
16
18
|
|
17
19
|
# Constructor
|
@@ -36,7 +38,7 @@ class SocialSnippet::Api
|
|
36
38
|
private
|
37
39
|
|
38
40
|
def output(message)
|
39
|
-
|
41
|
+
broadcast :message, message
|
40
42
|
end
|
41
43
|
|
42
44
|
end
|
@@ -1,12 +1,8 @@
|
|
1
1
|
module SocialSnippet::Api::CompletionApi
|
2
2
|
|
3
3
|
def complete_snippet_path(keyword)
|
4
|
-
core.repo_manager.complete(keyword)
|
5
|
-
|
6
|
-
|
7
|
-
def cli_complete_snippet_path(keyword)
|
8
|
-
complete_snippet_path(keyword).each do |cand_repo|
|
9
|
-
output cand_repo
|
4
|
+
core.repo_manager.complete(keyword).each do |snippet_path|
|
5
|
+
output snippet_path
|
10
6
|
end
|
11
7
|
end
|
12
8
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module SocialSnippet::Api::ManifestApi
|
2
2
|
|
3
|
-
require "json"
|
4
|
-
|
5
3
|
# Initialize the snippet.json interactively.
|
6
4
|
# $ sspm init
|
7
5
|
def init_manifest(options = {})
|
@@ -16,9 +14,9 @@ module SocialSnippet::Api::ManifestApi
|
|
16
14
|
def loop_manifest_questions(answer)
|
17
15
|
loop do
|
18
16
|
answer = ask_manifest_questions(manifest_questions(answer), answer)
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
output ""
|
18
|
+
output ::JSON.pretty_generate(answer)
|
19
|
+
output ""
|
22
20
|
break if ask_confirm("Is this okay? [Y/N]: ")
|
23
21
|
end
|
24
22
|
answer
|
@@ -8,8 +8,6 @@
|
|
8
8
|
#
|
9
9
|
class SocialSnippet::CommandLine::Command
|
10
10
|
|
11
|
-
require "optparse"
|
12
|
-
|
13
11
|
attr_reader :args
|
14
12
|
attr_reader :tokens
|
15
13
|
attr_reader :options
|
@@ -65,6 +63,9 @@ class SocialSnippet::CommandLine::Command
|
|
65
63
|
define_options
|
66
64
|
parse_line_options
|
67
65
|
@tokens = args
|
66
|
+
core.api.on :message do |message|
|
67
|
+
core.logger.say message
|
68
|
+
end
|
68
69
|
end
|
69
70
|
|
70
71
|
def run
|
data/lib/social_snippet/core.rb
CHANGED
data/lib/social_snippet/tag.rb
CHANGED
data/social_snippet.gemspec
CHANGED
@@ -19,10 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.required_ruby_version = ">= 1.9.3"
|
21
21
|
|
22
|
-
spec.add_runtime_dependency "version_sorter", "~>
|
22
|
+
spec.add_runtime_dependency "version_sorter", "~> 2.0.0"
|
23
23
|
spec.add_runtime_dependency "rugged", ["~> 0.21.4", ">= 0.21.4"]
|
24
24
|
spec.add_runtime_dependency "rest-client", "~> 1.7.0"
|
25
|
-
spec.add_runtime_dependency "highline", "~> 1.
|
25
|
+
spec.add_runtime_dependency "highline", "~> 1.7.0"
|
26
|
+
spec.add_runtime_dependency "wisper", "~> 1.6.0"
|
26
27
|
|
27
28
|
spec.add_development_dependency "bundler"
|
28
29
|
spec.add_development_dependency "rake"
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module SocialSnippet
|
4
4
|
|
5
|
-
describe Api do
|
5
|
+
describe Api::InsertSnippetApi do
|
6
6
|
|
7
7
|
describe "#insert_snippet()", :without_fakefs => true do
|
8
8
|
|
@@ -54,7 +54,7 @@ module SocialSnippet
|
|
54
54
|
# tests from here
|
55
55
|
#
|
56
56
|
|
57
|
-
context "
|
57
|
+
context "insert a plain text" do
|
58
58
|
|
59
59
|
let(:input) do
|
60
60
|
[
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe SocialSnippet::
|
3
|
+
describe SocialSnippet::Api::InsertSnippetApi do
|
4
4
|
|
5
5
|
before do
|
6
6
|
allow_any_instance_of(::SocialSnippet::CommandLine::Command).to receive(:social_snippet).and_return fake_core
|
@@ -2791,13 +2791,54 @@ describe SocialSnippet::Core do
|
|
2791
2791
|
subject { fake_core.api.insert_snippet input }
|
2792
2792
|
it { should eq output }
|
2793
2793
|
|
2794
|
-
end
|
2794
|
+
end # snip proxy
|
2795
2795
|
|
2796
|
-
end # add module
|
2796
|
+
end # add nested module
|
2797
2797
|
|
2798
2798
|
end # for ruby module
|
2799
2799
|
|
2800
|
-
end
|
2800
|
+
end # @no_tag
|
2801
|
+
|
2802
|
+
describe "not found case" do
|
2803
|
+
|
2804
|
+
context "create project on current directory" do
|
2805
|
+
|
2806
|
+
before do
|
2807
|
+
::FileUtils.touch "snippet.c"
|
2808
|
+
::FileUtils.mkdir_p "path/to"
|
2809
|
+
::FileUtils.touch "path/to/found.c"
|
2810
|
+
|
2811
|
+
::File.write "snippet.c", [
|
2812
|
+
"/* @snip <path/to/found.c> */",
|
2813
|
+
"/* @snip <path/to/not_found.c> */",
|
2814
|
+
].join($/)
|
2815
|
+
end
|
2816
|
+
|
2817
|
+
context "snip snippet.c" do
|
2818
|
+
|
2819
|
+
let(:input) do
|
2820
|
+
[
|
2821
|
+
"/* @snip<snippet.c> */",
|
2822
|
+
].join($/)
|
2823
|
+
end
|
2824
|
+
|
2825
|
+
let(:output) do
|
2826
|
+
[
|
2827
|
+
"/* @snippet<path/to/found.c> */",
|
2828
|
+
"/* @snippet<path/to/not_found.c> */",
|
2829
|
+
"ERROR: No such file or directory - ./path/to/not_found.c",
|
2830
|
+
"/* @snippet<snippet.c> */",
|
2831
|
+
].join($/)
|
2832
|
+
end
|
2833
|
+
|
2834
|
+
subject { fake_core.api.insert_snippet input }
|
2835
|
+
it { should eq output }
|
2836
|
+
|
2837
|
+
end # snip snippet.c
|
2838
|
+
|
2839
|
+
end # create project on current directory
|
2840
|
+
|
2841
|
+
end # not found case
|
2801
2842
|
|
2802
2843
|
end # insert_snippet
|
2803
2844
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_snippet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroyuki Sano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02
|
11
|
+
date: 2015-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: version_sorter
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rugged
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,6 +60,20 @@ dependencies:
|
|
60
60
|
version: 1.7.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: highline
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 1.7.0
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ~>
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.7.0
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: wisper
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
64
78
|
requirements:
|
65
79
|
- - ~>
|
@@ -274,7 +288,7 @@ files:
|
|
274
288
|
- spec/helpers/codeclimate_helper.rb
|
275
289
|
- spec/helpers/fakefs_helper.rb
|
276
290
|
- spec/helpers/webmock_helper.rb
|
277
|
-
- spec/lib/
|
291
|
+
- spec/lib/api/insert_snippet_spec.rb
|
278
292
|
- spec/lib/command_line/sspm_config_spec.rb
|
279
293
|
- spec/lib/command_line/sspm_init_spec.rb
|
280
294
|
- spec/lib/command_line/sspm_install_spec.rb
|
@@ -298,8 +312,8 @@ files:
|
|
298
312
|
- test/command_test.rb
|
299
313
|
- test/config_test.rb
|
300
314
|
- test/context_test.rb
|
301
|
-
- test/core_test.rb
|
302
315
|
- test/git_repository_test.rb
|
316
|
+
- test/insert_snippet_test.rb
|
303
317
|
- test/install_command_test.rb
|
304
318
|
- test/repository_manager_test.rb
|
305
319
|
- test/snippet_test.rb
|
@@ -335,7 +349,7 @@ test_files:
|
|
335
349
|
- spec/helpers/codeclimate_helper.rb
|
336
350
|
- spec/helpers/fakefs_helper.rb
|
337
351
|
- spec/helpers/webmock_helper.rb
|
338
|
-
- spec/lib/
|
352
|
+
- spec/lib/api/insert_snippet_spec.rb
|
339
353
|
- spec/lib/command_line/sspm_config_spec.rb
|
340
354
|
- spec/lib/command_line/sspm_init_spec.rb
|
341
355
|
- spec/lib/command_line/sspm_install_spec.rb
|
@@ -359,8 +373,8 @@ test_files:
|
|
359
373
|
- test/command_test.rb
|
360
374
|
- test/config_test.rb
|
361
375
|
- test/context_test.rb
|
362
|
-
- test/core_test.rb
|
363
376
|
- test/git_repository_test.rb
|
377
|
+
- test/insert_snippet_test.rb
|
364
378
|
- test/install_command_test.rb
|
365
379
|
- test/repository_manager_test.rb
|
366
380
|
- test/snippet_test.rb
|