technologist 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bf836d500b3b397f7887b91fad2f4b36b421c46
4
- data.tar.gz: 5a05188e267a135e6c98c1d3b51188a2c646833e
3
+ metadata.gz: 4bbc961282d2862ad3488cdf378e6d9b19b90cd3
4
+ data.tar.gz: 52243c0f99f97473f80e6b49d5f468bdd990ce19
5
5
  SHA512:
6
- metadata.gz: 0fc8d41691e9660c430632f23c0bdc91af07d037d0499c47141566b610777f14fed340b1ac24a32365f83752ed790c45f700834a04a5608850d595d048d2e84f
7
- data.tar.gz: b374785d7c9eed4fc899170633000fcdc3e2f82d6a2c57f564452df757bd05b2d87c6e68a3ac93eab4448ddc99d2b60e2e3218414861096cde47a08cb6f192d8
6
+ metadata.gz: e58a914c663a8104a3477ab5022896e53f552158c774638d06dfcee38493e8cdab531ae9beb75850c839cf1457b7d609ca697f2ff846be7a7c8f80396af8db9e
7
+ data.tar.gz: 232121c7c70e681fc83b2add66a60924b184873d1aaed57bc26bc29a713b49c987f7b5ad5b58851e1b9bc675028fe3ff350e2422af93413c4a1e7943321d5ff1
data/README.md CHANGED
@@ -26,8 +26,9 @@ Or install it yourself as:
26
26
  require 'technologist'
27
27
 
28
28
  technologist = Technologist::Repository.new('.')
29
- technologist.primary_frameworks # => ['Dashing']
30
- technologist.secondary_frameworks # => ['Sinatra']
29
+ technologist.primary_frameworks # => ['Sinatra']
30
+ technologist.secondary_frameworks # => ['Dashing']
31
+ technologist.frameworks # => ['Sinatra', 'Dashing']
31
32
  ```
32
33
 
33
34
  ## Development
@@ -42,7 +43,7 @@ To add a framework definition add a new section to the
42
43
  [frameworks.yml](lib/technologist/frameworks.yml) file and
43
44
  add a new spec covering the new framework in [spec/frameworks_rules_spec.rb](spec/frameworks_rules_spec.rb)
44
45
 
45
- 1. Fork it ( https://github.com/[my-github-username]/technologist/fork )
46
+ 1. Fork it ( https://github.com/koffeinfrei/technologist/fork )
46
47
  2. Create your feature branch (`git checkout -b my-new-feature`)
47
48
  3. Commit your changes (`git commit -am 'Add some feature'`)
48
49
  4. Push to the branch (`git push origin my-new-feature`)
@@ -11,18 +11,24 @@ module Technologist
11
11
  @yaml_parser = YamlParser.new(FRAMEWORK_RULES)
12
12
  end
13
13
 
14
+ def frameworks
15
+ matched_frameworks.flat_map do |technology, definition|
16
+ [definition['primary'], technology]
17
+ end.compact.uniq
18
+ end
19
+
14
20
  def primary_frameworks
15
- matched_frameworks.map do |technology|
21
+ matched_frameworks.map do |technology, definition|
16
22
  # it's either the primary value defined in the yaml
17
23
  # or the technology itself
18
- yaml_parser.rules[technology]['primary'] || technology
24
+ definition['primary'] || technology
19
25
  end.uniq
20
26
  end
21
27
 
22
28
  def secondary_frameworks
23
- matched_frameworks.map do |technology|
29
+ matched_frameworks.map do |technology, definition|
24
30
  # it's a secondary if a primary is defined in the yaml
25
- yaml_parser.rules[technology]['primary'] && technology
31
+ definition['primary'] && technology
26
32
  end.compact
27
33
  end
28
34
 
@@ -31,13 +37,12 @@ module Technologist
31
37
  def matched_frameworks
32
38
  @frameworks ||=
33
39
  begin
34
- yaml_parser.rules.map do |technology, definition|
35
- definition['rules'].map do |rule|
36
- if rule.matches?(repository)
37
- technology
38
- end
40
+ matched_rules = yaml_parser.rules.select do |technology, definition|
41
+ definition['rules'].any? do |rule|
42
+ rule.matches?(repository)
39
43
  end
40
- end.flatten.compact
44
+ end
45
+ Hash[matched_rules]
41
46
  end
42
47
  end
43
48
  end
@@ -10,6 +10,10 @@ module Technologist
10
10
  @framework_detector = FrameworkDetector.new(@git_repository)
11
11
  end
12
12
 
13
+ def frameworks
14
+ framework_detector.frameworks
15
+ end
16
+
13
17
  def primary_frameworks
14
18
  framework_detector.primary_frameworks
15
19
  end
@@ -1,3 +1,3 @@
1
1
  module Technologist
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: technologist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Reigel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-04 00:00:00.000000000 Z
11
+ date: 2015-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged