dissect 0.1.0pre → 0.1.1pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/README.md +29 -16
- data/dissect.gemspec +1 -0
- data/lib/dissect.rb +2 -1
- data/lib/dissect/finders/base_finder.rb +29 -0
- data/lib/dissect/finders/gem_finder.rb +11 -0
- data/lib/dissect/models/finding.rb +3 -3
- data/lib/dissect/version.rb +1 -1
- data/patterns.json +8 -0
- metadata +20 -3
- data/lib/dissect/client.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7ead41a217cfd49b5a6ecb1ab7e8de0fa05ab50
|
4
|
+
data.tar.gz: c5ae819d6d09de484058f0aa659cb1300f69fb5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b65b43998c97673c197bdc9a597786b1358afe47015f24963c80a65a69764c2a6bd3528e0e7c11c0132fa8dcf604977fb21f7c6e3ea0832a96c5519f981f3591
|
7
|
+
data.tar.gz: 30499cd34de4c31c574139ed84774a08fac0904a11d90bdb59217540847c1ddaa0f5477a0b81308bd11b883acddbd458c961ba18c57429e2100308e60e2c1be4
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/README.md
CHANGED
@@ -1,14 +1,23 @@
|
|
1
|
-
[travis]: https://travis-ci.org/
|
1
|
+
[travis]: https://travis-ci.org/olejrosendahl/dissect
|
2
|
+
[codeclimate]: https://codeclimate.com/github/olejrosendahl/dissect
|
3
|
+
[coveralls]: https://coveralls.io/r/olejrosendahl/dissect
|
4
|
+
[rubygems]: https://rubygems.org/gems/dissect
|
2
5
|
|
3
6
|
# Dissect
|
4
7
|
|
5
|
-
[][travis]
|
9
|
+
[][codeclimate]
|
10
|
+
[][coveralls]
|
11
|
+
[][rubygems]
|
6
12
|
|
7
|
-
|
8
|
-
Wikies, but what often lacks is examples of the features used in the wild.
|
13
|
+
*EXPERIMENTAL*
|
9
14
|
|
10
|
-
|
11
|
-
|
15
|
+
Problem: Libraries are often well documented, but what often lacks to
|
16
|
+
get started is to see examples of their features used in the wild.
|
17
|
+
|
18
|
+
Solution: Find Open Source projects on Github where the libraries are
|
19
|
+
used. Learn their API's and see how other programmers use them and
|
20
|
+
explore possibilities.
|
12
21
|
|
13
22
|
## Installation
|
14
23
|
|
@@ -28,19 +37,23 @@ Or install it yourself as:
|
|
28
37
|
|
29
38
|
## API
|
30
39
|
|
31
|
-
|
32
|
-
|
40
|
+
```ruby
|
41
|
+
# search organization for given library name
|
42
|
+
find(organization, name)
|
43
|
+
```
|
33
44
|
|
34
45
|
## Usage
|
35
46
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
47
|
+
```ruby
|
48
|
+
dissect = Dissect::Finders::GemFinder.new
|
49
|
+
findings = dissect.find("thoughtbot", "devise")
|
50
|
+
findings.each do |f|
|
51
|
+
puts f.name
|
52
|
+
puts f.path
|
53
|
+
puts f.html_url
|
54
|
+
puts f.repository_name
|
55
|
+
end
|
56
|
+
```
|
44
57
|
|
45
58
|
## Development
|
46
59
|
|
data/dissect.gemspec
CHANGED
data/lib/dissect.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Dissect
|
2
|
+
module Finders
|
3
|
+
class BaseFinder
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@connection = Octokit::Client.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def find(organization, name, language)
|
10
|
+
findings = []
|
11
|
+
patterns.each do |pattern|
|
12
|
+
query = "#{sprintf(pattern["pattern"], name)} filename:#{pattern["filename"]} path:#{pattern["path"]} user:#{organization} language:#{language}"
|
13
|
+
result = @connection.get("/search/code", q: query)
|
14
|
+
result[:items].each do |item|
|
15
|
+
findings << Models::Finding.new(item, pattern["description"])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
findings
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def patterns
|
24
|
+
JSON.parse(File.read("#{File.dirname(__FILE__)}/../../../patterns.json"))
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/dissect/version.rb
CHANGED
data/patterns.json
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dissect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ole J. Rosendahl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Simple wrapper around Octokit.rb's code search to find Gems in Gemfiles
|
98
112
|
email:
|
99
113
|
- ole.johnny.rosendahl@gmail.com
|
@@ -101,6 +115,7 @@ executables: []
|
|
101
115
|
extensions: []
|
102
116
|
extra_rdoc_files: []
|
103
117
|
files:
|
118
|
+
- ".coveralls.yml"
|
104
119
|
- ".gitignore"
|
105
120
|
- ".rspec"
|
106
121
|
- ".travis.yml"
|
@@ -114,11 +129,13 @@ files:
|
|
114
129
|
- bin/setup
|
115
130
|
- dissect.gemspec
|
116
131
|
- lib/dissect.rb
|
117
|
-
- lib/dissect/
|
132
|
+
- lib/dissect/finders/base_finder.rb
|
133
|
+
- lib/dissect/finders/gem_finder.rb
|
118
134
|
- lib/dissect/formatters/console.rb
|
119
135
|
- lib/dissect/formatters/json.rb
|
120
136
|
- lib/dissect/models/finding.rb
|
121
137
|
- lib/dissect/version.rb
|
138
|
+
- patterns.json
|
122
139
|
homepage: https://github.com/olejrosendahl/dissect
|
123
140
|
licenses:
|
124
141
|
- MIT
|
data/lib/dissect/client.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
module Dissect
|
2
|
-
class Client
|
3
|
-
|
4
|
-
PATTERNS = [
|
5
|
-
"gem '%s' filename:Gemfile path:/",
|
6
|
-
"gem \"%s\" filename:Gemfile path:/",
|
7
|
-
]
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
@connection = Octokit::Client.new
|
11
|
-
end
|
12
|
-
|
13
|
-
def code_search(gem, organisation, language)
|
14
|
-
findings = []
|
15
|
-
PATTERNS.each do |pattern|
|
16
|
-
result = @connection.get("/search/code", q: query_string(pattern, gem, organisation, language))
|
17
|
-
result[:items].each do |item|
|
18
|
-
findings << Models::Finding.new(item)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
findings
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def query_string(pattern, gem, user, language)
|
27
|
-
sprintf(pattern, gem) + " user:#{user} language:#{language}"
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|