tmc 0.0.2
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 +7 -0
- data/.gitignore +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +1 -0
- data/bin/tmc +10 -0
- data/lib/tmc.rb +33 -0
- data/lib/tmc/commands/lint.rb +20 -0
- data/lib/tmc/commands/lint/linter.rb +52 -0
- data/lib/tmc/version.rb +3 -0
- data/tmc.gemspec +23 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dde5c740e03c8b1e44403e4f6028b6c610c10dba
|
4
|
+
data.tar.gz: efdfbe8d3c43effc9f61121a47ce715066b30e4f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 43506aafe5872d5a279d5aa09363cf4fdb37d72edbe99237a4b7a32ff0b7c9de54492171bed057b2a1f2b797c93eb48bc8a6622d3a54e5ddd24e21d542faec58
|
7
|
+
data.tar.gz: 16f1b5606e1f601ba816e7d771dcafbef45d9f7faf2bb9a2d62e8f28a0081e6781b28f636a6cfeda57cbccb24cf8b986b90e1d188173f60b7859d636a1c3f7f9
|
data/.gitignore
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
/.config
|
19
|
+
/coverage/
|
20
|
+
/InstalledFiles
|
21
|
+
/pkg/
|
22
|
+
/spec/reports/
|
23
|
+
/test/tmp/
|
24
|
+
/test/version_tmp/
|
25
|
+
/tmp/
|
26
|
+
|
27
|
+
## Specific to RubyMotion:
|
28
|
+
.dat*
|
29
|
+
.repl_history
|
30
|
+
build/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalisation:
|
39
|
+
/.bundle/
|
40
|
+
/lib/bundler/man/
|
41
|
+
|
42
|
+
# for a library or gem, you might want to ignore these files since the code is
|
43
|
+
# intended to run in multiple environments; otherwise, check them in:
|
44
|
+
# Gemfile.lock
|
45
|
+
# .ruby-version
|
46
|
+
# .ruby-gemset
|
47
|
+
|
48
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
49
|
+
.rvmrc
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Jarmo Isotalo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# tmc-lint
|
2
|
+
|
3
|
+
TODO
|
4
|
+
|
5
|
+
Ideas:
|
6
|
+
- Validate metadata.yml
|
7
|
+
- Check that .class files and nbproject/private etc are not committed in the repo.
|
8
|
+
- Check that exercise names don't have dashes.
|
9
|
+
- ...
|
10
|
+
- Run this during course refresh.
|
11
|
+
|
12
|
+
Related: https://github.com/testmycode/tmc-server/issues/121
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
gem 'tmc'
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install tmc
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
TODO: Write usage instructions here
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
1. Fork it ( http://github.com/testmycode/tmc-lint/fork )
|
35
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
36
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
37
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
38
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/tmc
ADDED
data/lib/tmc.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "tmc/version"
|
2
|
+
|
3
|
+
module Tmc
|
4
|
+
# Your code goes here...
|
5
|
+
|
6
|
+
|
7
|
+
class Tmc
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
Dir.glob('lib/tmc/commands/*.rb').each do |command|
|
11
|
+
register(command)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def register(command)
|
16
|
+
require command.gsub("lib/", "")
|
17
|
+
end
|
18
|
+
|
19
|
+
def do_it(args)
|
20
|
+
const = ::Tmc::Commands.constants
|
21
|
+
command = args.shift.to_sym
|
22
|
+
cmd = const.find { |c| c.downcase == command }
|
23
|
+
if cmd
|
24
|
+
real_command = ::Tmc::Commands.const_get cmd
|
25
|
+
real_command = real_command.const_get cmd
|
26
|
+
real_command.new.do_it(args)
|
27
|
+
else
|
28
|
+
puts "Cannot find command: #{command} with parameters #{args.join(", ")}"
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative 'lint/linter'
|
2
|
+
module Tmc
|
3
|
+
module Commands
|
4
|
+
module Lint
|
5
|
+
class Lint
|
6
|
+
|
7
|
+
def do_it(args)
|
8
|
+
dir = args.shift
|
9
|
+
|
10
|
+
if dir.nil?
|
11
|
+
puts "no dir set"
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
|
15
|
+
Linter.new(dir).lint!
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'thread'
|
2
|
+
module Tmc
|
3
|
+
module Commands
|
4
|
+
module Lint
|
5
|
+
class Linter
|
6
|
+
|
7
|
+
def initialize(dir)
|
8
|
+
@queue = Array.new
|
9
|
+
@project_dir = Array.new
|
10
|
+
@config_files = Array.new
|
11
|
+
@base_dir = File.expand_path(dir)
|
12
|
+
@queue << @base_dir
|
13
|
+
end
|
14
|
+
|
15
|
+
def recursive_lint(dir)
|
16
|
+
puts "Checking #{dir} recursively"
|
17
|
+
if project_dir?(dir)
|
18
|
+
@project_dir << dir
|
19
|
+
end
|
20
|
+
Dir.glob(File.join(dir, '*')).each do |d|
|
21
|
+
if File.directory? d
|
22
|
+
recursive_lint(d)
|
23
|
+
elsif config_file?(d)
|
24
|
+
@config_files << d
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def lint!
|
30
|
+
recursive_lint(@base_dir)
|
31
|
+
end
|
32
|
+
|
33
|
+
def config_file?(file)
|
34
|
+
config_file_name = file.split("/")[-1]
|
35
|
+
%w(metadata.yml course_options.yml).include? config_file_name
|
36
|
+
end
|
37
|
+
|
38
|
+
def project_dir?(dir)
|
39
|
+
dir_contains_files?(dir, %w(src test))
|
40
|
+
end
|
41
|
+
|
42
|
+
def dir_contains_files?(dir, check)
|
43
|
+
dirs = Dir.glob(File.join(dir, '*'))
|
44
|
+
dirs.each do |d|
|
45
|
+
check.delete d.gsub(dir + "/","")
|
46
|
+
end
|
47
|
+
check.empty?
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/tmc/version.rb
ADDED
data/tmc.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tmc/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "tmc"
|
8
|
+
spec.version = Tmc::VERSION
|
9
|
+
spec.authors = ["Jarmo Isotalo"]
|
10
|
+
spec.email = ["jamo@isotalo.fi"]
|
11
|
+
spec.summary = %q{Commandline utilities for testmycode}
|
12
|
+
spec.description = %q{Commandline utilities for testmycode}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tmc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jarmo Isotalo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Commandline utilities for testmycode
|
42
|
+
email:
|
43
|
+
- jamo@isotalo.fi
|
44
|
+
executables:
|
45
|
+
- tmc
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/tmc
|
55
|
+
- lib/tmc.rb
|
56
|
+
- lib/tmc/commands/lint.rb
|
57
|
+
- lib/tmc/commands/lint/linter.rb
|
58
|
+
- lib/tmc/version.rb
|
59
|
+
- tmc.gemspec
|
60
|
+
homepage: ''
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.2.2
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Commandline utilities for testmycode
|
84
|
+
test_files: []
|