unixoid-challenge 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/challenge_spec.rb +5 -5
- data/lib/unixoid/controller.rb +6 -0
- data/lib/unixoid/git.rb +4 -0
- data/lib/unixoid/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17ddc8e44321c2873e8f2b2b1e24654b8239700a
|
4
|
+
data.tar.gz: 229966a8fe1cd71baa1d02bb6168d859e4604908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fc2eec585418494ecc5f9e3c5df9c572e648dead2319d5fa3cb9741c1dbbd3d39308e0b638ec31777c223fb49ab431050b98d545cabedde5b7e4deea012413f
|
7
|
+
data.tar.gz: d3d2b21828f903f176b19a6fbf9e593ac2f57172dff0eb950b3f00ad9a982959087932c0c957d1ea3bc64b375999ae20af9e36df4b3b1e5999e610c5d6ce4e2a
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/unixoid-challenge.svg)](http://badge.fury.io/rb/unixoid-challenge)
|
2
|
+
|
1
3
|
Unixoid Challenge
|
2
4
|
=================
|
3
5
|
|
@@ -5,6 +7,8 @@ Instructions
|
|
5
7
|
------------
|
6
8
|
|
7
9
|
* Test time: 1 hour (you can take longer, don’t worry)
|
10
|
+
* You will need to have [RVM](https://github.com/makersacademy/pre_course/blob/master/pills/installing_rvm.md) configured if you're using a mac and be using a version of Ruby that is not the default (Note: if you are using Nitrous then you do not need to install Ruby - it's already there for you).
|
11
|
+
* Your Ruby version needs to be 2.1.x or higher (```ruby -v``` to check what you're on)
|
8
12
|
* Feel free to use google, your notes, books, etc. but work on your own
|
9
13
|
* Obviously don't use Sublime Text, Finder or similar tools – only the command-line
|
10
14
|
* You'll almost certainly need to Google some things. This is deliberate.
|
@@ -25,7 +29,7 @@ Then change into that directory using this next command:
|
|
25
29
|
cd temp
|
26
30
|
```
|
27
31
|
|
28
|
-
Checking and submitting your progress
|
32
|
+
Checking and submitting your progress:
|
29
33
|
-------------------------------------
|
30
34
|
|
31
35
|
First, you will need to install the `unixoid-challenge` gem, like this:
|
@@ -45,6 +49,8 @@ __(make sure you are in the temp directory when you run "unixoid-challenge")__
|
|
45
49
|
|
46
50
|
This will tell you if you've completed the task, or which of the tasks above you still need to complete. It will also submit your results to GitHub (you'll need your username and password that you use to login to GitHub) so we can track your progress.
|
47
51
|
|
52
|
+
The Challenge:
|
53
|
+
--------------
|
48
54
|
Now use your command line skills to complete the following:
|
49
55
|
|
50
56
|
1. Using one command, create a directory structure "my/private/files"
|
data/challenge_spec.rb
CHANGED
@@ -16,12 +16,12 @@ describe "Unixoid test" do
|
|
16
16
|
|
17
17
|
it "4. should have 'List of env vars that begin with T' on first line of t-vars.env" do
|
18
18
|
lines = File.readlines('my/private/files/t-vars.env')
|
19
|
-
expect(lines.shift).to match(/^List of env vars that begin with T$/i)
|
19
|
+
expect(lines.shift).to match(/^List of env vars that begin with T$/i)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "5. should have the list of env vars that begin with T in t-vars.env" do
|
23
23
|
lines = File.readlines('my/private/files/t-vars.env')
|
24
|
-
lines.shift if lines.first =~ /^List of env vars that begin with T$/i
|
24
|
+
lines.shift if lines.first =~ /^List of env vars that begin with T$/i
|
25
25
|
lines.shift if lines.first == "\n"
|
26
26
|
expect(lines.map{|l| l[0]}.uniq).to eq(['T'])
|
27
27
|
end
|
@@ -41,7 +41,7 @@ describe "Unixoid test" do
|
|
41
41
|
|
42
42
|
it "9. should have rw access for the owner only on my/private/files/t-vars.env" do
|
43
43
|
file = "my/private/files/t-vars.env"
|
44
|
-
permissions = File.stat(file).mode
|
44
|
+
permissions = File.stat(file).mode
|
45
45
|
expect(permissions).to eq(0100600) # rw for the user only
|
46
46
|
end
|
47
47
|
|
@@ -54,8 +54,8 @@ describe "Unixoid test" do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it "11. should have rw permissions for all users on my/public/files/t-vars.count" do
|
57
|
-
t_vars_permissions = File.stat('my/public/files/t-vars.count').mode
|
58
|
-
expect(t_vars_permissions & 0666).to eq(0666)
|
57
|
+
t_vars_permissions = File.stat('my/public/files/t-vars.count').mode
|
58
|
+
expect(t_vars_permissions & 0666).to eq(0666)
|
59
59
|
end
|
60
60
|
|
61
61
|
it "12. should have the count of text files in my/public/files/text-files-count.txt" do
|
data/lib/unixoid/controller.rb
CHANGED
@@ -23,6 +23,7 @@ module Unixoid
|
|
23
23
|
auth_fail! unless github.authenticated?
|
24
24
|
|
25
25
|
git = Git.new(github)
|
26
|
+
git_fail! unless git.installed?
|
26
27
|
get_config(git) unless git.configured?
|
27
28
|
|
28
29
|
puts "Submitting..."
|
@@ -51,6 +52,11 @@ module Unixoid
|
|
51
52
|
git.configure(name, email)
|
52
53
|
end
|
53
54
|
|
55
|
+
def git_fail!
|
56
|
+
puts 'Git is not installed - please follow the instructions at https://help.github.com/articles/set-up-git and then try again'.red
|
57
|
+
exit 1
|
58
|
+
end
|
59
|
+
|
54
60
|
def auth_fail!
|
55
61
|
puts 'Incorrect login details. Please run unixoid-challenge again'.red
|
56
62
|
exit 1
|
data/lib/unixoid/git.rb
CHANGED
@@ -47,6 +47,10 @@ module Unixoid
|
|
47
47
|
run('git remote rm origin')
|
48
48
|
end
|
49
49
|
|
50
|
+
def installed?
|
51
|
+
run('which git', outcodes: [0, 1]) != ''
|
52
|
+
end
|
53
|
+
|
50
54
|
def configured?
|
51
55
|
run('git config --get user.email', outcodes: [0, 1]) != '' && run('git config --get user.name', outcodes: [0, 1]) != ''
|
52
56
|
end
|
data/lib/unixoid/version.rb
CHANGED