learn_linter 0.4.0 → 0.5.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: bd2b34e3d54be42e6d9d5d5949b0e2bec7595a8d
4
- data.tar.gz: ca582bba312f9c03671a4ade445c44843b3241e7
3
+ metadata.gz: 50878a15317abe96eaf05ee2e8b1d3e74a4ca1d8
4
+ data.tar.gz: c2a6b0540e6512fc75b47881c9c62c9f4fd5cd1d
5
5
  SHA512:
6
- metadata.gz: 82465645b106001b1654e5f249a7f388c7aa4f817f1447b0c6a2dd169c54a9761e1219975cbdf21b387109b8030c1da6b87b256f9a812142eb7bcccd672f0ce6
7
- data.tar.gz: 0695a13d85bfed9cdff69c4bf1c40964a51ddb7b960daa4ae3a9807a7df93106a88c653ec1cd784445a349ea04d97fc0150c4bf21716453de6bf94e132075256
6
+ metadata.gz: 83e811fdd5e1595463cb15da512fc21631c2d8accdab1207834ec8d148b3a2c067bd77c3a4e4b35118b69bfa4544d9d38d775c6fb9a4c91ce8276abf2568ccd0
7
+ data.tar.gz: a0ff8b62314c8b05abdb214d72028f58ed9f09e039680da16172d728e8c2c4f6c80027865880489503be8a28899bca339e56056bfd7b2eda2bdaee55c9787b37
data/bin/learn-lint CHANGED
@@ -2,15 +2,20 @@
2
2
 
3
3
  require 'yaml'
4
4
  require 'optparse'
5
- require 'pry'
6
- require_relative '../lib/learn_linter'
5
+ require_relative '../lib/learn_linter.rb'
7
6
 
8
- if ARGV.length > 1 && ARGV[1] == "quiet"
7
+ if ARGV.length == 0
8
+ lint = LearnLinter.new.lint_directory
9
+ elsif ARGV.length == 1 && ARGV[0] == "quiet"
10
+ dir = File.expand_path(File.dirname(File.dirname(__FILE__)))
11
+ lint = LearnLinter.new(dir, "quiet")
12
+ elsif ARGV.length > 1 && ARGV[1] == "quiet"
9
13
  lint = LearnLinter.new(ARGV[0], "quiet").lint_directory
10
14
  elsif ARGV.length > 1 && ARG[1] != "quiet"
11
15
  puts "please use 'learn-lint directory_name quiet' or 'learn-lint directory_name"
12
- else
16
+ elsif ARGV.length == 1
13
17
  lint = LearnLinter.new(ARGV[0]).lint_directory
14
18
  end
15
19
 
16
20
 
21
+
@@ -14,7 +14,7 @@ class LearnError < StandardError
14
14
  @readme_error = {present_readme: false, valid_readme: false}
15
15
  @license_error = {present_license: false, valid_license: false}
16
16
  @correct_yaml_content = {message: ".learn file must have 'tags', 'resources' and 'languages' keys", color: :yellow}
17
- @valid_yaml = {message: "invalid yaml", color: :red}
17
+ @valid_yaml = {message: "invalid yaml or missing .learn", color: :red}
18
18
  @valid_license = {message: "invalid or missing license content", color: :yellow}
19
19
  @valid_readme = {message: "invalid code snippet. Must have three backticks to open and close all code snippets", color: :red}
20
20
  @present_learn = {message: "missing .learn file", color: :red}
@@ -1,3 +1,4 @@
1
+ require 'pry'
1
2
  class ReadmeLinter
2
3
 
3
4
  def self.parse_file(file, learn_error)
@@ -1,3 +1,3 @@
1
1
  class LearnLinter
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
data/lib/learn_linter.rb CHANGED
@@ -9,8 +9,8 @@ class LearnLinter
9
9
  attr_accessor :filepath, :quiet
10
10
 
11
11
 
12
- def initialize(filepath, quiet=nil)
13
- @filepath = filepath
12
+ def initialize(dir=nil, quiet=nil)
13
+ @filepath = dir || Dir.pwd
14
14
  @learn_error = LearnError.new
15
15
  @quiet = quiet
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: learn_linter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sophie DeBenedetto