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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97c35c84905e578a22c4c531c49d40c4e436549d
4
- data.tar.gz: d0eb69a6491baec9888e21823a52a285c17d8b90
3
+ metadata.gz: 17ddc8e44321c2873e8f2b2b1e24654b8239700a
4
+ data.tar.gz: 229966a8fe1cd71baa1d02bb6168d859e4604908
5
5
  SHA512:
6
- metadata.gz: 974c74defdf7dd192ec55dc875aef074e95c669e2783745bd1f70cde4297faeb7a5222070e44e208422484ace214c0719477f1a3d883f00bf862375dc9aec440
7
- data.tar.gz: 036214becabbb1491e7558401708ea649aa8e00c481d2f93142f7bfe17a0204ffcaeb269710b17079f251bb0fbfdcd9d64867e7ea8dfd424c20e750b1f11e982
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"
@@ -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
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module Unixoid
4
- VERSION = "0.1.3".freeze
4
+ VERSION = "0.1.4".freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unixoid-challenge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Joseph