unixoid-challenge 0.0.3
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/bin/unixoid-challenge +7 -0
- data/lib/unixoid_challenge.rb +18 -0
- data/spec/unixoid_spec.rb +85 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 18d85ad45d8ef76a1b9dc886b0ed47394004a5b4
|
4
|
+
data.tar.gz: 3eb07e2b2596fbd41aa7eb369447619000108717
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0ef798ea0f8f701709a1748fa5db108fce1dc05c5fa1095dbff167c5fdd39cdd8704c25a3149a9cc13573a716e71ddf80d932e2efb6c79a156c17c4eac9698a1
|
7
|
+
data.tar.gz: f4cac2700e00c819f709078e90fd62d795acde897d2d7b9aa85be0f47199b89c14f7859437e9a0108212ccf49d2f61eeae705188295c08018ea4dd0068663f8d
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class UnixoidChallenge
|
2
|
+
def self.run
|
3
|
+
puts "Running the Unixoid Challenge Assessor ..."
|
4
|
+
File.write 'unixoid_spec.rb', File.readlines(File.join(File.dirname(__FILE__), '..','spec','unixoid_spec.rb')).join
|
5
|
+
`rspec unixoid_spec.rb > unixoid_results.txt`
|
6
|
+
puts 'Please enter your github user name:'
|
7
|
+
username = gets.chomp
|
8
|
+
curl = %Q{curl -u #{username} https://api.github.com/user/repos -d '{"name":"unixoid_submission"}'}
|
9
|
+
%x[#{curl}]
|
10
|
+
`git init`
|
11
|
+
`git add unixoid_results.txt`
|
12
|
+
`git commit -am 'unixoid submission'`
|
13
|
+
add_remote = "git remote add origin git@github.com:#{username}/unixoid_submission.git"
|
14
|
+
%x[#{add_remote}]
|
15
|
+
`git push -f origin master`
|
16
|
+
puts "Completed Submission!"
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
describe "Unixoid test" do
|
2
|
+
|
3
|
+
it "1. should have a my/private/files directory" do
|
4
|
+
expect(File.exist?('my/private/files')).to be true
|
5
|
+
end
|
6
|
+
|
7
|
+
it "2. should have a my/public/files directory" do
|
8
|
+
expect(File.exist?('my/public/files')).to be true
|
9
|
+
end
|
10
|
+
|
11
|
+
it "3. should have a my/private/files/t-vars.env file" do
|
12
|
+
expect(File.exist?('my/private/files/t-vars.env')).to be true
|
13
|
+
end
|
14
|
+
|
15
|
+
it "4. should have 'List of env vars that begin with T' on first line of t-vars.env" do
|
16
|
+
lines = File.readlines('my/private/files/t-vars.env')
|
17
|
+
expect(lines.shift).to match(/^List of env vars that begin with T$/i)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "5. should have the list of env vars that begin with T in t-vars.env" do
|
21
|
+
lines = File.readlines('my/private/files/t-vars.env')
|
22
|
+
lines.shift if lines.first =~ /^List of env vars that begin with T$/i
|
23
|
+
lines.shift if lines.first == "\n"
|
24
|
+
expect(lines.map{|l| l[0]}.uniq).to eq(['T'])
|
25
|
+
end
|
26
|
+
|
27
|
+
it "6. should have the TESTING_MAKERS env variable set up" do
|
28
|
+
expect(ENV["TESTING_MAKERS"]).to eq('working')
|
29
|
+
end
|
30
|
+
|
31
|
+
it "7. should have the TESTING_MAKERS env set to be created for new terminal windows" do
|
32
|
+
expect(File.read("#{Dir.home}/.bash_profile")).to match(/export\s+TESTING_MAKERS=working/)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "8a. should have t-vars.count in my/public/files" do
|
36
|
+
expect(File.exist?('my/public/files/t-vars.count')).to be true
|
37
|
+
lines = File.readlines('my/public/files/t-vars.count')
|
38
|
+
end
|
39
|
+
|
40
|
+
it "8b. should have the count of env vars in my/public/files/t-vars.count" do
|
41
|
+
expect(File.read('my/public/files/t-vars.count')).to match(/^Overall count:\s+\d+\s*$/i)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "9. should have rw access for the owner only on my/private/files/t-vars.env" do
|
45
|
+
file = "my/private/files/t-vars.env"
|
46
|
+
permissions = File.stat(file).mode
|
47
|
+
expect(permissions).to eq(0100600) # rw for the user only
|
48
|
+
end
|
49
|
+
|
50
|
+
it "10. should only allow the owner to change into my/private/files" do
|
51
|
+
folder = "my/private/files"
|
52
|
+
permissions = File.stat(folder).mode
|
53
|
+
expect(permissions & 0000100).not_to eq(0)
|
54
|
+
expect(permissions & 0000010).to eq(0)
|
55
|
+
expect(permissions & 0000001).to eq(0)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "11. should have rw permissions for all users on my/public/files/t-vars.count" do
|
59
|
+
t_vars_permissions = File.stat('my/public/files/t-vars.count').mode
|
60
|
+
expect(t_vars_permissions & 0666).to eq(0666)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "12a. should have text-files-count.txt in my/public/files" do
|
64
|
+
expect(File.exist?('my/public/files/text-files-count.txt')).to be true
|
65
|
+
end
|
66
|
+
|
67
|
+
it "12b. should have the count of text files in my/public/files/text-files-count.txt" do
|
68
|
+
expect(File.read('my/public/files/text-files-count.txt')).to match(/^\s*\d{2,6}\s*$/)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "13a. should have first-three-env.txt in my/private/files" do
|
72
|
+
expect(File.exist?('my/private/files/first-three-env.txt')).to be true
|
73
|
+
end
|
74
|
+
|
75
|
+
it "13b. should have the the first three env vars in my/private/files/first-three-env.txt" do
|
76
|
+
lines = File.readlines('my/private/files/first-three-env.txt')
|
77
|
+
expect(lines.sort).to eq lines
|
78
|
+
expect(lines.count).to eq(3)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "14. should have commands.txt in my/private/files" do
|
82
|
+
expect(File.exist?('my/private/files/commands.txt')).to be true
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unixoid-challenge
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sam Joseph
|
8
|
+
- Dan Le Dosquet-Bergquist
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-10-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3'
|
28
|
+
description: A gem to assess your performance on the unixoid challenge
|
29
|
+
email: sam@makersacademy.com
|
30
|
+
executables:
|
31
|
+
- unixoid-challenge
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- bin/unixoid-challenge
|
36
|
+
- lib/unixoid_challenge.rb
|
37
|
+
- spec/unixoid_spec.rb
|
38
|
+
homepage: http://makersacademy.com
|
39
|
+
licenses: []
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 2.2.2
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Test your command line skills!
|
61
|
+
test_files: []
|