social_snippet 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +2 -0
  3. data/.travis.yml +22 -3
  4. data/Gemfile +25 -2
  5. data/Guardfile +9 -0
  6. data/README.md +6 -1
  7. data/Rakefile +51 -1
  8. data/appveyor.yml +36 -0
  9. data/bin/ssnip +10 -0
  10. data/bin/sspm +10 -0
  11. data/lib/social_snippet.rb +15 -4
  12. data/lib/social_snippet/api.rb +238 -0
  13. data/lib/social_snippet/command_line.rb +4 -0
  14. data/lib/social_snippet/command_line/command.rb +158 -0
  15. data/lib/social_snippet/command_line/ssnip.rb +2 -0
  16. data/lib/social_snippet/command_line/ssnip/main_command.rb +26 -0
  17. data/lib/social_snippet/command_line/sspm.rb +3 -0
  18. data/lib/social_snippet/command_line/sspm/main_command.rb +63 -0
  19. data/lib/social_snippet/command_line/sspm/sub_commands.rb +16 -0
  20. data/lib/social_snippet/command_line/sspm/sub_commands/complete_command.rb +28 -0
  21. data/lib/social_snippet/command_line/sspm/sub_commands/info_command.rb +28 -0
  22. data/lib/social_snippet/command_line/sspm/sub_commands/install_command.rb +103 -0
  23. data/lib/social_snippet/command_line/sspm/sub_commands/publish_command.rb +51 -0
  24. data/lib/social_snippet/command_line/sspm/sub_commands/search_command.rb +32 -0
  25. data/lib/social_snippet/command_line/sspm/sub_commands/update_command.rb +37 -0
  26. data/lib/social_snippet/config.rb +92 -0
  27. data/lib/social_snippet/context.rb +89 -0
  28. data/lib/social_snippet/core.rb +40 -0
  29. data/lib/social_snippet/inserter.rb +64 -0
  30. data/lib/social_snippet/logger.rb +9 -0
  31. data/lib/social_snippet/registry.rb +3 -0
  32. data/lib/social_snippet/registry/registry_client.rb +15 -0
  33. data/lib/social_snippet/registry/registry_resources.rb +3 -0
  34. data/lib/social_snippet/registry/registry_resources/base.rb +80 -0
  35. data/lib/social_snippet/registry/registry_resources/repositories.rb +23 -0
  36. data/lib/social_snippet/repository.rb +6 -0
  37. data/lib/social_snippet/repository/drivers.rb +3 -0
  38. data/lib/social_snippet/repository/drivers/base_repository.rb +192 -0
  39. data/lib/social_snippet/repository/drivers/git_repository.rb +76 -0
  40. data/lib/social_snippet/repository/repository_errors.rb +5 -0
  41. data/lib/social_snippet/repository/repository_factory.rb +59 -0
  42. data/lib/social_snippet/repository/repository_installer.rb +86 -0
  43. data/lib/social_snippet/repository/repository_manager.rb +177 -0
  44. data/lib/social_snippet/resolvers.rb +4 -0
  45. data/lib/social_snippet/resolvers/base_resolver.rb +103 -0
  46. data/lib/social_snippet/resolvers/dep_resolver.rb +61 -0
  47. data/lib/social_snippet/resolvers/insert_resolver.rb +100 -0
  48. data/lib/social_snippet/snippet.rb +14 -0
  49. data/lib/social_snippet/tag.rb +198 -0
  50. data/lib/social_snippet/tag_parser.rb +61 -0
  51. data/lib/social_snippet/version.rb +26 -1
  52. data/social_snippet.gemspec +18 -3
  53. data/spec/helpers/codeclimate_helper.rb +4 -0
  54. data/spec/helpers/fakefs_helper.rb +15 -0
  55. data/spec/helpers/webmock_helper.rb +16 -0
  56. data/spec/lib/api_spec.rb +106 -0
  57. data/spec/lib/command_line/sspm_install_spec.rb +224 -0
  58. data/spec/lib/command_line/sspm_search_spec.rb +167 -0
  59. data/spec/lib/command_line/sspm_spec.rb +81 -0
  60. data/spec/lib/config_spec.rb +56 -0
  61. data/spec/lib/context_spec.rb +48 -0
  62. data/spec/lib/core_spec.rb +126 -0
  63. data/spec/lib/inserter_spec.rb +177 -0
  64. data/spec/lib/registry_client_spec.rb +173 -0
  65. data/spec/lib/repository/base_repository_spec.rb +104 -0
  66. data/spec/lib/repository/git_repository_spec.rb +83 -0
  67. data/spec/lib/repository/repository_factory_spec.rb +31 -0
  68. data/spec/lib/repository/repository_installer_spec.rb +63 -0
  69. data/spec/lib/repository/repository_manager_spec.rb +201 -0
  70. data/spec/lib/tag_parser_spec.rb +173 -0
  71. data/spec/lib/tag_spec.rb +93 -0
  72. data/spec/spec_helper.rb +106 -0
  73. data/test/base_repository_test.rb +375 -0
  74. data/test/command_test.rb +39 -0
  75. data/test/context_test.rb +31 -0
  76. data/test/core_test.rb +2091 -0
  77. data/test/git_repository_test.rb +114 -0
  78. data/test/install_command_test.rb +28 -0
  79. data/test/repository_manager_test.rb +109 -0
  80. data/test/tag_parser_test.rb +47 -0
  81. data/test/tag_test.rb +217 -0
  82. data/test/version_test.rb +56 -0
  83. metadata +271 -14
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTFlZGM4YzNkZTliN2YwNTRkYzQwN2Q5NGRjNDQ4Y2IyYTNmMDI3Mw==
4
+ Mzg5Mjk4NTRjY2Q5YTA0NTJjMGUxOWM5NGJjYzFkMDcwZjYxYWNjOA==
5
5
  data.tar.gz: !binary |-
6
- ZDUzNDMxYzdiNzY2NDMxNWNkNmQyMjc5OTBiNjNhYmIyNDBkMjIxYw==
6
+ M2Q0NjlhNzU1YWViYTg3OGJiNjJiNWNmMzExZGEwYzQ2YjQ0ZWUzMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MTZmNmUzZjA2NTM5YzBiNmNiYzZkODYxNTA4NmVjYmRjMzIyYjExOTY4ZWFl
10
- ZmIyMTdlNDYzNDQ2YzY4MWUzOWVlMDliZmRlM2U4NTQ2YmYxY2I4YjQ3MDQ4
11
- YzllZGVjNDJmMmIxYjI2NGYxNmZjOWJlNDEwMDZmNTkzNWZhNGI=
9
+ Mzc0MDUxM2VmMmZlYjczNjc0NzQ0N2I5ZThiZWMxMmZiNzY3OTYzNzUzODNh
10
+ NDQyNzgzMTU1NmUzMDhiNmNhZGZiYjM3ZjEzZWJmNmFlOTRkNjkzZjIwMTEw
11
+ NTNhYzQyMjZiOWIyOGZjNDZhNzQzYWQyMmNkNTlkMzE3MGRmZmM=
12
12
  data.tar.gz: !binary |-
13
- YmUyMTg5ZWE5MjZkMzhjOWQ4YmRlYjMxMzlmY2RhM2E4MDQ2MDAwZGQ2N2Ey
14
- OTIyYWJmNzVjYmJhYjBlNTY4ZDIxYTYyYmI5MjdmM2FmZjNiYWUyZDhmNDI2
15
- MjhhMzUwZDk5ZWQ0ZjVmOTUzZWJiNTQxNzI5Yzg2MGI3Y2VjYjM=
13
+ MGRlZDc4ODRjNWQ0N2RkNTQ1M2JiOTJlZTg1NTU3OWM0ZjA2NzQ4YmM2Yzk1
14
+ NTE5YTA3ZDk0NDA3NmI4NmM3YThkYWM4YzUxYzdlNjM2ZjUzOWU2NDBjNTJl
15
+ ZjM4MTBmMzJkZWQ2N2U0Mzc2ZjkzNzRhOTZhNWEyNWM5MDQwMmQ=
data/.gitignore CHANGED
@@ -7,6 +7,8 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /vendor/
11
+ .pryrc
10
12
  *.bundle
11
13
  *.so
12
14
  *.o
data/.travis.yml CHANGED
@@ -1,8 +1,21 @@
1
1
  language: ruby
2
+
2
3
  rvm:
3
- - 2.1
4
- - 2.0
5
- - 1.9
4
+ - "2.2"
5
+ - "2.1"
6
+ - "2.0"
7
+ - "1.9"
8
+
9
+ bundler_args: "--without debug --jobs 3"
10
+
11
+ sudo: false
12
+
13
+ script:
14
+ - bundle exec rake spec
15
+ - bundle exec rake spec_without_fakefs
16
+ - bundle exec rake test
17
+ - bundle exec rake test_without_fakefs
18
+
6
19
  deploy:
7
20
  provider: rubygems
8
21
  api_key:
@@ -10,3 +23,9 @@ deploy:
10
23
  secure: "hlC3/Vsqpw3RdA0g8nAuusXEpGiwLtndGQVd8eg8x7yCoubFmsruwJG2Cci4QF2aIVGovFzrrmlxPb204nndsmBCzTLZEnn2dsCqOt8TZDAyFRZf6xeZ53eT7AjOJvFIafS4YLQ975upzsQ/cW4OgWFRaqhHgckTUSapa7Dyeao="
11
24
  gem:
12
25
  master: social_snippet
26
+
27
+ cache:
28
+ bundler: true
29
+ directories:
30
+ - node_modules
31
+ - bower_components
data/Gemfile CHANGED
@@ -1,4 +1,27 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in social-snippet.gemspec
4
- gemspec
3
+ gem "bundler"
4
+ gem "rake"
5
+ gem "version_sorter"
6
+ gem "rugged"
7
+ gem "rest-client"
8
+
9
+ group :development do
10
+ gem "yard", :require => false
11
+ gem "pry", :require => false
12
+ gem "guard", :require => false
13
+ gem "guard-shell", :require => false
14
+ end
15
+
16
+ group :test do
17
+ gem "rspec", :require => false
18
+ gem "fakefs", :require => false
19
+ gem "webmock", :require => false
20
+ gem "simplecov", :require => false
21
+ gem "codeclimate-test-reporter", :require => false
22
+ end
23
+
24
+ # should be disabled on travis-ci
25
+ group :debug do
26
+ gem "pry-byebug", :require => false
27
+ end
data/Guardfile ADDED
@@ -0,0 +1,9 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :shell do
5
+ watch(/(.*)\.rb/) do |m|
6
+ system "bundle exec rake spec"
7
+ system "bundle exec rake test"
8
+ end
9
+ end
data/README.md CHANGED
@@ -1,4 +1,9 @@
1
- # SocialSnippet
1
+ # Social Snippet
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/social_snippet.svg)](http://badge.fury.io/rb/social_snippet)
4
+ [![Build Status](https://travis-ci.org/social-snippet/social-snippet.svg?branch=master)](https://travis-ci.org/social-snippet/social-snippet)
5
+ [![Code Climate](https://codeclimate.com/github/social-snippet/social-snippet/badges/gpa.svg)](https://codeclimate.com/github/social-snippet/social-snippet)
6
+ [![Test Coverage](https://codeclimate.com/github/social-snippet/social-snippet/badges/coverage.svg)](https://codeclimate.com/github/social-snippet/social-snippet)
2
7
 
3
8
  TODO: Write a gem description
4
9
 
data/Rakefile CHANGED
@@ -1,7 +1,57 @@
1
+ require "bundler/setup"
1
2
  require "bundler/gem_tasks"
2
3
 
3
4
  task :default => [:spec]
4
5
 
5
6
  require "rspec/core/rake_task"
6
- RSpec::Core::RakeTask.new :spec
7
+
8
+ # rake spec
9
+ RSpec::Core::RakeTask.new(:spec) do |t|
10
+ ENV["RSPEC_WITHOUT_FAKEFS"] = "false"
11
+ t.rspec_opts = [
12
+ "--format documentation",
13
+ "--color",
14
+ "--tag ~without_fakefs",
15
+ ]
16
+ end
17
+
18
+ # rake spec_without_fs
19
+ RSpec::Core::RakeTask.new(:spec_without_fakefs) do |t|
20
+ ENV["RSPEC_WITHOUT_FAKEFS"] = "true"
21
+ t.rspec_opts = [
22
+ "--format documentation",
23
+ "--color",
24
+ "--tag without_fakefs",
25
+ ]
26
+ end
27
+
28
+ # rake test
29
+ RSpec::Core::RakeTask.new(:test) do |t|
30
+ ENV["RSPEC_WITHOUT_FAKEFS"] = "false"
31
+ t.rspec_opts = [
32
+ "--pattern '../test/*_test.rb'",
33
+ "--color",
34
+ "--tag ~without_fakefs",
35
+ ]
36
+ end
37
+
38
+ # rake test_without_fakefs
39
+ RSpec::Core::RakeTask.new(:test_without_fakefs) do |t|
40
+ ENV["RSPEC_WITHOUT_FAKEFS"] = "true"
41
+ t.rspec_opts = [
42
+ "--pattern '../test/*_test.rb'",
43
+ "--color",
44
+ "--tag without_fakefs",
45
+ ]
46
+ end
47
+
48
+ require "yard"
49
+ require "yard/rake/yardoc_task"
50
+
51
+ # rake yard
52
+ YARD::Rake::YardocTask.new do |t|
53
+ t.files = [
54
+ "lib/{,**}/*.rb"
55
+ ]
56
+ end
7
57
 
data/appveyor.yml ADDED
@@ -0,0 +1,36 @@
1
+ version: "{build}"
2
+
3
+ install:
4
+ - ps: iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
5
+ - choco install pkgconfiglite
6
+ - git clone --branch v0.21.1 --depth 1 --single-branch git://github.com/libgit2/libgit2 libgit2
7
+ - cd libgit2
8
+ - cmake -DCMAKE_BUILD_TYPE=Release -DTHREADSAFE=ON -DBUILD_CLAR=OFF -DCMAKE_INSTALL_PREFIX=%PREFIX%\libgit2 .
9
+ - cmake --build . --target install
10
+
11
+ - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
12
+ - ruby --version
13
+ - SET PATH=%PREFIX%\libgit2\bin;%PATH%
14
+
15
+ - gem update --system
16
+ - gem install rugged --no-ri --no-rdoc -- --use-system-libraries --with-git2-dir=%PREFIX%\libgit2
17
+ - gem install bundler --no-ri --no-rdoc
18
+ - bundle install --jobs 2
19
+
20
+ test_script:
21
+ - cmd: bundle exec rake spec
22
+ - cmd: bundle exec rake spec_without_fakefs
23
+ - cmd: bundle exec rake test
24
+ - cmd: bundle exec rake test_without_fakefs
25
+
26
+ build: off
27
+
28
+ environment:
29
+
30
+ global:
31
+ PREFIX: c:\libs
32
+
33
+ matrix:
34
+ - ruby_version: "21"
35
+ - ruby_version: "20"
36
+ - ruby_version: "19"
data/bin/ssnip ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../lib/social_snippet"
4
+
5
+ module SocialSnippet::CommandLine
6
+ cli = SSnip::MainCommand.new ARGV.clone
7
+ cli.init
8
+ cli.run
9
+ end
10
+
data/bin/sspm ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../lib/social_snippet"
4
+
5
+ module SocialSnippet::CommandLine
6
+ cli = SSpm::MainCommand.new ARGV.clone
7
+ cli.init
8
+ cli.run
9
+ end
10
+
@@ -1,5 +1,16 @@
1
- require "social_snippet/version"
1
+ module SocialSnippet; end
2
2
 
3
- module SocialSnippet
4
- # Your code goes here...
5
- end
3
+ require_relative "social_snippet/core"
4
+ require_relative "social_snippet/version"
5
+ require_relative "social_snippet/tag"
6
+ require_relative "social_snippet/tag_parser"
7
+ require_relative "social_snippet/config"
8
+ require_relative "social_snippet/repository"
9
+ require_relative "social_snippet/context"
10
+ require_relative "social_snippet/snippet"
11
+ require_relative "social_snippet/inserter"
12
+ require_relative "social_snippet/resolvers"
13
+ require_relative "social_snippet/registry"
14
+ require_relative "social_snippet/command_line"
15
+ require_relative "social_snippet/logger"
16
+ require_relative "social_snippet/api"
@@ -0,0 +1,238 @@
1
+ require "json"
2
+
3
+ class SocialSnippet::Api
4
+
5
+ attr_reader :social_snippet
6
+
7
+ # Constructor
8
+ def initialize(new_social_snippet)
9
+ @social_snippet = new_social_snippet
10
+ end
11
+
12
+ # Insert snippets to given text
13
+ #
14
+ # @param src [String] The text of source code
15
+ def insert_snippet(src)
16
+ resolver = ::SocialSnippet::Resolvers::InsertResolver.new(social_snippet)
17
+ res = resolver.insert(src)
18
+ output res
19
+ res
20
+ end
21
+
22
+ def install_repository_by_name(repo_name, repo_ref, options = {})
23
+ installed_as = repo_name
24
+ installed_as = options[:name] unless options[:name].nil?
25
+
26
+ unless installed_as === repo_name
27
+ output "Installing as #{installed_as}"
28
+ end
29
+
30
+ if social_snippet.repo_manager.exists?(installed_as, repo_ref)
31
+ output "#{installed_as} is already installed"
32
+ return
33
+ end
34
+
35
+ output "Finding: #{repo_name}"
36
+ info = social_snippet.registry_client.repositories.find(repo_name)
37
+ output "Found at: #{info["url"]}"
38
+
39
+ output "Cloning repository..."
40
+ repo = ::SocialSnippet::Repository::RepositoryFactory.clone(info["url"])
41
+
42
+ install_repository installed_as, repo_ref, repo
43
+ end
44
+
45
+ def install_repository_by_url(repo_url, repo_ref, options = {})
46
+ output "Cloning repository..."
47
+ repo = ::SocialSnippet::Repository::RepositoryFactory.clone(repo_url)
48
+ install_repository_by_repo repo, repo_ref, options
49
+ end
50
+
51
+ def install_repository_by_path(repo_path, repo_ref, options = {})
52
+ output "Cloning repository..."
53
+ repo = ::SocialSnippet::Repository::RepositoryFactory.clone_local(repo_path)
54
+ install_repository_by_repo repo, repo_ref, options
55
+ end
56
+
57
+ def install_repository_by_repo(repo, repo_ref, options)
58
+ installed_as = repo.name
59
+ installed_as = options[:name] unless options[:name].nil?
60
+ output "Installing as #{installed_as}"
61
+
62
+ if social_snippet.repo_manager.exists?(installed_as)
63
+ output "#{installed_as} is already installed"
64
+ return
65
+ end
66
+
67
+ install_repository installed_as, repo_ref, repo
68
+ end
69
+
70
+ # Install repository
71
+ #
72
+ # @param repo [::SocialSnippet::Repository::Drivers::BaseRepository]
73
+ def install_repository(repo_name, repo_ref, repo, options = {})
74
+ display_name = repo_name
75
+
76
+ if repo_ref.nil?
77
+ repo_ref = resolve_reference(repo)
78
+
79
+ if repo.has_versions?
80
+ output "Resolving #{display_name}'s version"
81
+ else
82
+ output "No versions, use current reference"
83
+ end
84
+ end
85
+
86
+ display_name = "#{repo_name}\##{repo_ref}"
87
+
88
+ output "Installing: #{display_name}"
89
+ unless options[:dry_run]
90
+ social_snippet.repo_manager.install repo_name, repo_ref, repo, options
91
+ end
92
+
93
+ output "Success: #{display_name}"
94
+
95
+ # install dependencies
96
+ if has_dependencies?(repo)
97
+ output "Finding #{display_name}'s dependencies"
98
+ install_missing_dependencies repo.dependencies, options
99
+ output "Finish finding #{display_name}'s dependencies"
100
+ end
101
+ end
102
+
103
+ def update_repository(repo_name, options = {})
104
+ unless social_snippet.repo_manager.exists?(repo_name)
105
+ output "ERROR: #{repo_name} is not installed"
106
+ return
107
+ end
108
+
109
+ output "Fetching update for #{repo_name}"
110
+ ret = social_snippet.repo_manager.fetch(repo_name, options)
111
+
112
+ repo = social_snippet.repo_manager.find_repository(repo_name)
113
+ display_name = repo_name
114
+
115
+ # nothing to update
116
+ if ret == 0 && social_snippet.repo_manager.exists?(repo_name, repo.latest_version)
117
+ output "Everything up-to-date"
118
+ return
119
+ end
120
+
121
+ output "Updating #{repo_name}"
122
+ unless options[:dry_run]
123
+ version = repo.latest_version
124
+ if repo.has_versions? && repo.current_ref != version
125
+ output "Bumping version into #{version}"
126
+ display_name = "#{repo_name}\##{version}"
127
+ repo.checkout version
128
+ social_snippet.repo_manager.update repo_name, version, repo, options
129
+ end
130
+ social_snippet.repo_manager.cache_installing_repo repo
131
+ end
132
+
133
+ output "Success #{display_name}"
134
+
135
+ # update deps
136
+ if social_snippet.repo_manager.has_deps?(repo_name)
137
+ output "Updating #{display_name}'s dependencies"
138
+ deps = social_snippet.repo_manager.deps(repo_name)
139
+ install_missing_dependencies deps, options
140
+ output "Finish updating #{display_name}'s dependencies"
141
+ end
142
+ end
143
+
144
+ def update_all_repositories(options = {})
145
+ social_snippet.repo_manager.each_installed_repo do |repo_name|
146
+ update_repository repo_name, options
147
+ end
148
+ end
149
+
150
+ def complete_snippet_path(keyword)
151
+ social_snippet.repo_manager.complete(keyword)
152
+ end
153
+
154
+ def cli_complete_snippet_path(keyword)
155
+ complete_snippet_path(keyword).each do |cand_repo|
156
+ output cand_repo
157
+ end
158
+ end
159
+
160
+ def show_info(repo_name)
161
+ repo_info = social_snippet.registry_client.repositories.find(repo_name)
162
+ output ::JSON.pretty_generate(repo_info)
163
+ end
164
+
165
+ def search_repositories(query, options = {})
166
+ format_text = search_result_format(options)
167
+ social_snippet.registry_client.repositories.search(query).each do |repo|
168
+ output format_text % search_result_list(repo, options)
169
+ end
170
+ end
171
+
172
+ def add_url(url, options = {})
173
+ ret = social_snippet.registry_client.repositories.add_url(url)
174
+ output ret
175
+ end
176
+
177
+ #
178
+ # Helpers
179
+ #
180
+
181
+ private
182
+
183
+ def resolve_reference(repo)
184
+ if repo.has_versions?
185
+ repo.latest_version
186
+ else
187
+ repo.current_ref
188
+ end
189
+ end
190
+
191
+ def has_dependencies?(repo)
192
+ repo.dependencies && ( not repo.dependencies.empty? )
193
+ end
194
+
195
+ def install_missing_dependencies(repo_deps, options = {})
196
+ repo_deps.each do |dep_repo_name, dep_repo_ref|
197
+ unless social_snippet.repo_manager.exists?(dep_repo_name, dep_repo_ref)
198
+ install_repository_by_name dep_repo_name, dep_repo_ref, options
199
+ end
200
+ end
201
+ end
202
+
203
+ def search_result_format(options)
204
+ keys = [ # TODO: improve (change order by option, etc...)
205
+ :name,
206
+ :desc,
207
+ :url,
208
+ :installed,
209
+ ]
210
+
211
+ list = []
212
+ keys.each {|key| list.push "%s" if options[key] }
213
+
214
+ return list.join(" ")
215
+ end
216
+
217
+ def search_result_list(repo, options)
218
+ list = []
219
+ list.push repo["name"] if options[:name]
220
+ list.push "\"#{repo["desc"]}\"" if options[:desc]
221
+ list.push repo["url"] if options[:url]
222
+ list.push search_result_installed(repo) if options[:installed]
223
+ return list
224
+ end
225
+
226
+ def search_result_installed(repo)
227
+ if social_snippet.repo_manager.exists?(repo["name"])
228
+ "#installed"
229
+ else
230
+ ""
231
+ end
232
+ end
233
+
234
+ def output(message)
235
+ social_snippet.logger.say message
236
+ end
237
+
238
+ end