comet 0.0.5 → 0.0.6

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: b5d9fd26f19f6023ec4d15b9186a50079045dd37
4
- data.tar.gz: ff8c5c289ea293fb40e7b2f555825cbfa2e3681c
3
+ metadata.gz: 2b58c5299c8f7df9bc5404118d335688e73b7487
4
+ data.tar.gz: e5bccd67ca9f8237d8c860f930d31db80aacc46b
5
5
  SHA512:
6
- metadata.gz: 963c36c4bac04255b008f17c465c3420b2d08bf7c2d3ad7a81849717f11e49ea28a0c9d21a4de3d2ed142656a4b42090d56b89c914ab12cf016de6ee379a9730
7
- data.tar.gz: 9c1a8871a5776ffe057d8c87cccfc81daf4914e5b398b255bfe9c0c56a1b1b2b9982fe9d397f7c5079b432807dcd816fa968cf91ec966ce1d73cb1ef9354d7e2
6
+ metadata.gz: 0f8680498d504f79e37cb894897e76d96b8b7c79f2f81e0eef81936ce995dbe347471ae3fa1915da0f491bf42fa3f737ca08c93c4927a33ef23eba7097d78a66
7
+ data.tar.gz: d9d9da04b752f630503f610a08d92e018f335bfa12a06bfab133777e050ce9e5d6720858d95a7c315205ab51d57625107a40d724fe908b7f709131a50964a5fb
data/bin/comet CHANGED
@@ -4,6 +4,7 @@ require 'yaml'
4
4
  require 'comet'
5
5
  require 'helpers'
6
6
  require 'openssl'
7
+ require 'shellwords'
7
8
 
8
9
  include GLI::App
9
10
 
@@ -55,11 +56,41 @@ command :fetch do |c|
55
56
  challenge = Comet::Challenge.find(@config, challenge_id)
56
57
  directory = challenge.download
57
58
 
58
- info = { 'id' => challenge_id.to_i, 'file_name' => "#{challenge.slug}.rb" }
59
- info_file = File.join(directory, '.challenge')
59
+ info_file = File.join(directory, '.kata')
60
+ info = YAML.load(File.read(info_file))
61
+ info['id'] = challenge_id.to_i
62
+
60
63
  File.write(info_file, info.to_yaml)
61
64
 
62
- puts "Downloaded challenge to #{directory}."
65
+ puts "Downloaded kata to #{directory}."
66
+ end
67
+ end
68
+
69
+ desc 'Run test suite'
70
+ command :test do |c|
71
+ c.action do |global_options, options, args|
72
+ current_dir = Dir.pwd
73
+ info_file = File.join(current_dir, '.kata')
74
+
75
+ if File.exists?(info_file)
76
+ kata_info = YAML.load(File.read(info_file))
77
+
78
+ case kata_info['test_runner']
79
+ when 'ruby'
80
+ runner = 'ruby'
81
+ when 'rspec'
82
+ runner = 'rspec --color --fail-fast'
83
+ else
84
+ runner = 'ruby'
85
+ end
86
+
87
+ slug = File.basename(current_dir)
88
+ test_file = File.join(current_dir, 'test', "#{slug}_test.rb")
89
+
90
+ exec("#{runner} #{test_file}")
91
+ else
92
+ puts "Not a challenge directory."
93
+ end
63
94
  end
64
95
  end
65
96
 
@@ -79,7 +110,7 @@ command :submit do |c|
79
110
 
80
111
  Dir.mktmpdir do |tmpdir|
81
112
  submission_file = File.join(tmpdir, 'submission.tar.gz')
82
- if system("tar zcf #{submission_file} -C #{lib_dir} .")
113
+ if system("tar zcf #{Shellwords.escape(submission_file)} -C #{Shellwords.escape(lib_dir)} .")
83
114
  payload = {
84
115
  submission: {
85
116
  challenge_id: challenge_info['id'],
@@ -1,3 +1,5 @@
1
+ require 'shellwords'
2
+
1
3
  class Comet::Challenge
2
4
  attr_reader :id, :name, :slug, :download_link, :basedir
3
5
 
@@ -11,7 +13,7 @@ class Comet::Challenge
11
13
 
12
14
  def download
13
15
  archive = Comet::API.download_archive(download_link, File.join(basedir, "#{slug}.tar.gz"))
14
- `tar zxf #{archive} -C #{basedir}`
16
+ `tar zxf #{Shellwords.escape(archive)} -C #{Shellwords.escape(basedir)}`
15
17
  File.delete(archive)
16
18
  File.join(basedir, slug)
17
19
  end
data/lib/comet/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Comet
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Sheehan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-18 00:00:00.000000000 Z
11
+ date: 2014-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
47
+ version: '2.14'
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '2.14'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: gli
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -70,17 +70,18 @@ dependencies:
70
70
  name: rest-client
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '1.6'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
83
- description:
82
+ version: '1.6'
83
+ description: Command-line interface to download various code exercises and their test
84
+ suites. When the tests are all passing submit your solution for grading.
84
85
  email: adam.sheehan@launchacademy.com
85
86
  executables:
86
87
  - comet
@@ -89,17 +90,18 @@ extra_rdoc_files:
89
90
  - README.rdoc
90
91
  - comet.rdoc
91
92
  files:
93
+ - README.rdoc
92
94
  - bin/comet
95
+ - comet.rdoc
93
96
  - lib/comet.rb
94
97
  - lib/comet/api.rb
95
98
  - lib/comet/challenge.rb
96
99
  - lib/comet/init.rb
97
100
  - lib/comet/version.rb
98
101
  - lib/helpers.rb
99
- - README.rdoc
100
- - comet.rdoc
101
102
  homepage: http://www.launchacademy.com
102
- licenses: []
103
+ licenses:
104
+ - MIT
103
105
  metadata: {}
104
106
  post_install_message:
105
107
  rdoc_options:
@@ -123,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
125
  version: '0'
124
126
  requirements: []
125
127
  rubyforge_project:
126
- rubygems_version: 2.0.6
128
+ rubygems_version: 2.2.2
127
129
  signing_key:
128
130
  specification_version: 4
129
131
  summary: Command-line interface for downloading and submitting code exercises.