trackler 2.2.0.5 → 2.2.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 447bff79931171eac084cccc735ad522e765f6af
4
- data.tar.gz: af1bd54ac24bd83154ca283f4de0e7670294f1a7
3
+ metadata.gz: c01a1f87bf36c0dda5c6dda215561d9aab7f404f
4
+ data.tar.gz: 0a4cc995dcc8b75e502196695e9c3cde56e838fb
5
5
  SHA512:
6
- metadata.gz: 843de8da103e7771059c6c2cfb0343db4dcadfa329d0ca454d41b5395968c7f7a4fa04fa0c7d834eb1fa1a11744316c47abbe1c394f3097d38a2f294fb10ae0d
7
- data.tar.gz: 9132d00fecdbdf9ee66a3b5a88821cbfbe65b9d58d7183cf475d96e79bc0908ba6e337bcf6efd5264020dd85ae42bf902c09020cddb23b932702b37a61a6c2b1
6
+ metadata.gz: 15312570345615c7f7ad2b1f0132ec8c86a76985c29c315a6ca0686800a11f44e4def5039e2e4cc41f349b2c2dae502f302c0f79ce3271bc5cf856227953a5d5
7
+ data.tar.gz: 0bba7ef3ede35c23798163a1f1e7ba8f43bfe8c07cf2548aa90d9cabefed2f6905f30434f9b661bc9577c06797bc36258e1ed4efbd3aaed803a34ae3b163d0a4
@@ -32,7 +32,7 @@ module Trackler
32
32
  end
33
33
 
34
34
  def active?
35
- !!config["active"]
35
+ !!config.active
36
36
  end
37
37
 
38
38
  def upcoming?
@@ -53,11 +53,11 @@ module Trackler
53
53
  end
54
54
 
55
55
  def checklist_issue
56
- config.fetch("checklist_issue", 1)
56
+ config.checklist_issue || 1
57
57
  end
58
58
 
59
59
  def gitter
60
- config["gitter"]
60
+ config.gitter
61
61
  end
62
62
 
63
63
  def icon_path
@@ -69,23 +69,23 @@ module Trackler
69
69
  end
70
70
 
71
71
  def language
72
- config['language'].to_s.strip
72
+ config.language.to_s.strip
73
73
  end
74
74
 
75
75
  def repository
76
- @repository ||= (config['repository'] || "https://github.com/exercism/%s" % id).to_s.strip
76
+ @repository ||= (config.repository || "https://github.com/exercism/%s" % id).to_s.strip
77
77
  end
78
78
 
79
79
  def test_pattern
80
- if config.key?('test_pattern')
81
- Regexp.new(config['test_pattern'])
80
+ if !!config.test_pattern
81
+ Regexp.new(config.test_pattern)
82
82
  else
83
83
  /test/i
84
84
  end
85
85
  end
86
86
 
87
87
  def ignore_pattern
88
- config.fetch('ignore_pattern', 'example')
88
+ config.ignore_pattern || 'example'
89
89
  end
90
90
 
91
91
  def docs(image_path: DocFile::DEFAULT_IMAGE_PATH)
@@ -124,15 +124,15 @@ module Trackler
124
124
  private
125
125
 
126
126
  def active_slugs
127
- (config["exercises"] || []).reject { |ex| ex["deprecated"] }.map { |ex| ex["slug"] }
127
+ exercises.reject(&:deprecated).map(&:slug)
128
128
  end
129
129
 
130
130
  def foregone_slugs
131
- config["foregone"] || []
131
+ config.foregone || []
132
132
  end
133
133
 
134
134
  def deprecated_slugs
135
- (config["exercises"] || []).select {|ex| ex["deprecated"]}.map { |ex| ex["slug"]}
135
+ exercises.select(&:deprecated).map(&:slug)
136
136
  end
137
137
 
138
138
  def most_popular_format(path)
@@ -142,8 +142,12 @@ module Trackler
142
142
  formats.max_by { |format| formats.count(format) }
143
143
  end
144
144
 
145
+ def exercises
146
+ config.exercises || []
147
+ end
148
+
145
149
  def config
146
- @config ||= JSON.parse(File.read(config_filename))
150
+ @config ||= JSON.parse(File.read(config_filename), object_class: OpenStruct)
147
151
  end
148
152
 
149
153
  def config_filename
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.0.5"
2
+ VERSION = "2.2.0.6"
3
3
  end
@@ -6,11 +6,10 @@
6
6
  {
7
7
  "uuid": "4e2533dd-3af5-400b-869d-78140764d533",
8
8
  "slug": "hello-world",
9
- "core": false,
10
- "unlocked_by": null,
9
+ "core": true,
11
10
  "difficulty": 1,
12
11
  "topics": [
13
-
12
+ "stdout"
14
13
  ]
15
14
  },
16
15
  {
@@ -20,97 +19,127 @@
20
19
  "unlocked_by": null,
21
20
  "difficulty": 1,
22
21
  "topics": [
23
-
22
+ "dates"
24
23
  ]
25
24
  },
26
25
  {
27
- "uuid": "e24451fd-761d-4d20-81d9-e470486ec44a",
28
- "slug": "leap",
26
+ "uuid": "9ac0b041-a7aa-4b0c-952a-d38d35e2cd65",
27
+ "slug": "bob",
29
28
  "core": false,
30
29
  "unlocked_by": null,
31
30
  "difficulty": 1,
32
31
  "topics": [
33
-
32
+ "control_flow_conditionals"
34
33
  ]
35
34
  },
36
35
  {
37
- "uuid": "68103f44-b442-48e6-b2b5-09001f73e926",
38
- "slug": "hamming",
39
- "core": false,
40
- "unlocked_by": null,
36
+ "uuid": "e24451fd-761d-4d20-81d9-e470486ec44a",
37
+ "slug": "leap",
38
+ "core": true,
41
39
  "difficulty": 1,
42
40
  "topics": [
43
-
41
+ "control_flow_conditionals",
42
+ "input_validation",
43
+ "boolean_logic"
44
44
  ]
45
45
  },
46
46
  {
47
- "uuid": "8a62e53e-59c2-42d5-96e5-a0f8f9b5d177",
48
- "slug": "rna-transcription",
47
+ "uuid": "1a9c8d65-43ee-435e-8c55-9a45c14a71fb",
48
+ "slug": "raindrops",
49
49
  "core": false,
50
- "unlocked_by": null,
50
+ "unlocked_by": "leap",
51
51
  "difficulty": 1,
52
52
  "topics": [
53
-
53
+ "input_validation",
54
+ "control_flow_conditionals"
54
55
  ]
55
56
  },
56
57
  {
57
- "uuid": "1a9c8d65-43ee-435e-8c55-9a45c14a71fb",
58
- "slug": "raindrops",
58
+ "uuid": "ca5139b4-8b2f-44ea-8d83-0b8ca7674436",
59
+ "slug": "difference-of-squares",
59
60
  "core": false,
60
- "unlocked_by": null,
61
+ "unlocked_by": "leap",
61
62
  "difficulty": 1,
62
63
  "topics": [
63
-
64
+ "control_flow_conditionals",
65
+ "control_flow_loops",
66
+ "string_transformation",
67
+ "string_comparison"
64
68
  ]
65
69
  },
66
70
  {
67
- "uuid": "51bd6542-408b-4a73-8343-1c4d50db5315",
68
- "slug": "word-count",
71
+ "uuid": "a7e2018a-c454-4fe0-ad35-229304306648",
72
+ "slug": "pangram",
73
+ "core": true,
74
+ "difficulty": 2,
75
+ "topics": [
76
+ "string_transformation"
77
+ ]
78
+ },
79
+ {
80
+ "uuid": "33d9eb48-5958-4e98-afc0-8cff89577c86",
81
+ "slug": "anagram",
69
82
  "core": false,
70
- "unlocked_by": null,
71
- "difficulty": 1,
83
+ "unlocked_by": "pangram",
84
+ "difficulty": 2,
72
85
  "topics": [
73
-
86
+ "control_flow_loops",
87
+ "string_transformation"
74
88
  ]
75
89
  },
76
90
  {
77
- "uuid": "9ac0b041-a7aa-4b0c-952a-d38d35e2cd65",
78
- "slug": "bob",
91
+ "uuid": "68103f44-b442-48e6-b2b5-09001f73e926",
92
+ "slug": "hamming",
79
93
  "core": false,
80
- "unlocked_by": null,
81
- "difficulty": 1,
94
+ "unlocked_by": "pangram",
95
+ "difficulty": 2,
82
96
  "topics": [
83
-
97
+ "control_flow_loops",
98
+ "string_comparison"
84
99
  ]
85
100
  },
86
101
  {
87
- "uuid": "ca5139b4-8b2f-44ea-8d83-0b8ca7674436",
88
- "slug": "difference-of-squares",
102
+ "uuid": "8a62e53e-59c2-42d5-96e5-a0f8f9b5d177",
103
+ "slug": "rna-transcription",
89
104
  "core": false,
90
- "unlocked_by": null,
91
- "difficulty": 1,
105
+ "unlocked_by": "pangram",
106
+ "difficulty": 2,
92
107
  "topics": [
93
-
108
+ "control_flow_loops",
109
+ "associative_arrays"
94
110
  ]
95
111
  },
96
112
  {
97
- "uuid": "33d9eb48-5958-4e98-afc0-8cff89577c86",
98
- "slug": "anagram",
113
+ "uuid": "51bd6542-408b-4a73-8343-1c4d50db5315",
114
+ "slug": "word-count",
99
115
  "core": false,
100
- "unlocked_by": null,
101
- "difficulty": 1,
116
+ "unlocked_by": "pangram",
117
+ "difficulty": 2,
102
118
  "topics": [
103
-
119
+ "control_flow_loops",
120
+ "string_comparison"
104
121
  ]
105
122
  },
106
123
  {
107
- "uuid": "a7e2018a-c454-4fe0-ad35-229304306648",
108
- "slug": "pangram",
124
+ "uuid": "0cfac255-6871-4588-a16b-98f7692bfdbe",
125
+ "slug": "two-fer",
109
126
  "core": false,
110
- "unlocked_by": null,
111
- "difficulty": 1,
127
+ "unlocked_by": "pangram",
128
+ "difficulty": 2,
112
129
  "topics": [
113
-
130
+ "text_formatting",
131
+ "control_flow_conditionals"
132
+ ]
133
+ },
134
+ {
135
+ "uuid": "9f9a1a49-472f-4a39-aa28-6aa17eeebdc7",
136
+ "slug": "phone-number",
137
+ "core": false,
138
+ "unlocked_by": "pangram",
139
+ "difficulty": 2,
140
+ "topics": [
141
+ "string_comparison",
142
+ "control_flow_conditionals"
114
143
  ]
115
144
  }
116
145
  ],
@@ -0,0 +1,16 @@
1
+ # {{ .Spec.Name }}
2
+
3
+ {{ .Spec.Description -}}
4
+ {{- with .Hints }}
5
+ {{ . }}
6
+ {{ end }}
7
+ {{- with .TrackInsert }}
8
+ {{ . }}
9
+ {{ end }}
10
+ {{- with .Spec.Credits -}}
11
+ ## Source
12
+
13
+ {{ . }}
14
+ {{ end }}
15
+ ## Submitting Incomplete Solutions
16
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,24 @@
1
+ {
2
+ "maintainers": [
3
+ {
4
+ "github_username": "adelcambre",
5
+ "show_on_website": false,
6
+ "alumnus": false,
7
+ "name": null,
8
+ "bio": null,
9
+ "link_text": null,
10
+ "link_url": null,
11
+ "avatar_url": null
12
+ },
13
+ {
14
+ "github_username": "kotp",
15
+ "show_on_website": false,
16
+ "alumnus": false,
17
+ "name": null,
18
+ "bio": null,
19
+ "link_text": null,
20
+ "link_url": null,
21
+ "avatar_url": null
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,18 @@
1
+ # Anagram
2
+
3
+ Given a word and a list of possible anagrams, select the correct sublist.
4
+
5
+ Given `"listen"` and a list of candidates like `"enlists" "google"
6
+ "inlets" "banana"` the program should return a list containing
7
+ `"inlets"`.
8
+
9
+ Run the tests with:
10
+
11
+ bats whatever_test.sh
12
+
13
+ ## Source
14
+
15
+ Inspired by the Extreme Startup game [https://github.com/rchatley/extreme_startup](https://github.com/rchatley/extreme_startup)
16
+
17
+ ## Submitting Incomplete Solutions
18
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,23 @@
1
+ # Bob
2
+
3
+ Bob is a lackadaisical teenager. In conversation, his responses are very limited.
4
+
5
+ Bob answers 'Sure.' if you ask him a question.
6
+
7
+ He answers 'Whoa, chill out!' if you yell at him.
8
+
9
+ He says 'Fine. Be that way!' if you address him without actually saying
10
+ anything.
11
+
12
+ He answers 'Whatever.' to anything else.
13
+
14
+ Run the tests with:
15
+
16
+ bats whatever_test.sh
17
+
18
+ ## Source
19
+
20
+ Inspired by the 'Deaf Grandma' exercise in Chris Pine's Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=06](http://pine.fm/LearnToProgram/?Chapter=06)
21
+
22
+ ## Submitting Incomplete Solutions
23
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,24 @@
1
+ # Difference Of Squares
2
+
3
+ Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.
4
+
5
+ The square of the sum of the first ten natural numbers is
6
+ (1 + 2 + ... + 10)² = 55² = 3025.
7
+
8
+ The sum of the squares of the first ten natural numbers is
9
+ 1² + 2² + ... + 10² = 385.
10
+
11
+ Hence the difference between the square of the sum of the first
12
+ ten natural numbers and the sum of the squares of the first ten
13
+ natural numbers is 3025 - 385 = 2640.
14
+
15
+ Run the tests with:
16
+
17
+ bats whatever_test.sh
18
+
19
+ ## Source
20
+
21
+ Problem 6 at Project Euler [http://projecteuler.net/problem=6](http://projecteuler.net/problem=6)
22
+
23
+ ## Submitting Incomplete Solutions
24
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,16 @@
1
+ # Gigasecond
2
+
3
+ Calculate the moment when someone has lived for 10^9 seconds.
4
+
5
+ A gigasecond is 10^9 (1,000,000,000) seconds.
6
+
7
+ Run the tests with:
8
+
9
+ bats whatever_test.sh
10
+
11
+ ## Source
12
+
13
+ Chapter 9 in Chris Pine's online Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=09](http://pine.fm/LearnToProgram/?Chapter=09)
14
+
15
+ ## Submitting Incomplete Solutions
16
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,47 @@
1
+ # Hamming
2
+
3
+ Calculate the Hamming difference between two DNA strands.
4
+
5
+ A mutation is simply a mistake that occurs during the creation or
6
+ copying of a nucleic acid, in particular DNA. Because nucleic acids are
7
+ vital to cellular functions, mutations tend to cause a ripple effect
8
+ throughout the cell. Although mutations are technically mistakes, a very
9
+ rare mutation may equip the cell with a beneficial attribute. In fact,
10
+ the macro effects of evolution are attributable by the accumulated
11
+ result of beneficial microscopic mutations over many generations.
12
+
13
+ The simplest and most common type of nucleic acid mutation is a point
14
+ mutation, which replaces one base with another at a single nucleotide.
15
+
16
+ By counting the number of differences between two homologous DNA strands
17
+ taken from different genomes with a common ancestor, we get a measure of
18
+ the minimum number of point mutations that could have occurred on the
19
+ evolutionary path between the two strands.
20
+
21
+ This is called the 'Hamming distance'.
22
+
23
+ It is found by comparing two DNA strands and counting how many of the
24
+ nucleotides are different from their equivalent in the other string.
25
+
26
+ GAGCCTACTAACGGGAT
27
+ CATCGTAATGACGGCCT
28
+ ^ ^ ^ ^ ^ ^^
29
+
30
+ The Hamming distance between these two DNA strands is 7.
31
+
32
+ # Implementation notes
33
+
34
+ The Hamming distance is only defined for sequences of equal length. This means
35
+ that based on the definition, each language could deal with getting sequences
36
+ of equal length differently.
37
+
38
+ Run the tests with:
39
+
40
+ bats whatever_test.sh
41
+
42
+ ## Source
43
+
44
+ The Calculating Point Mutations problem at Rosalind [http://rosalind.info/problems/hamm/](http://rosalind.info/problems/hamm/)
45
+
46
+ ## Submitting Incomplete Solutions
47
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,66 @@
1
+ # Hello World
2
+
3
+ The classical introductory exercise. Just say "Hello, World!".
4
+
5
+ ["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
6
+ the traditional first program for beginning programming in a new language
7
+ or environment.
8
+
9
+ The objectives are simple:
10
+
11
+ - Write a function that returns the string "Hello, World!".
12
+ - Run the test suite and make sure that it succeeds.
13
+ - Submit your solution and check it at the website.
14
+
15
+ If everything goes well, you will be ready to fetch your first real exercise.
16
+
17
+ # Welcome to Bash!
18
+
19
+ Unlike many other languages here, bash is a bit of a special snowflake.
20
+ If you are on a Mac or other unix-y platform, you almost definitely
21
+ already have bash. In fact, anything you type into the terminal is
22
+ likely going through bash.
23
+
24
+ The downside to this is that there isn't much of a development
25
+ ecosystem around bash like there is for other languages, and there are
26
+ multiple verions of bash that can be frustratingly incompatible. Luckily
27
+ we shouldn't hit those differences for these basic examples, and if you
28
+ can get the tests to pass on your machine, we are doing great.
29
+
30
+ ## Installation
31
+
32
+ As I said above, if you are on a unix-like OS (Mac OS X, Linux, Solaris,
33
+ etc), you probably already have bash.
34
+
35
+ ## Testing
36
+
37
+ As there isn't much of a bash ecosystem, there also isn't really a de
38
+ facto leader in the bash testing area. For these examples we are using
39
+ [bats](https://github.com/sstephenson/bats). You should be able to
40
+ install it from your favorite package manager, on OS X with homebrew
41
+ this would look something like this:
42
+
43
+ ```
44
+ $ brew install bats
45
+ ==> Downloading
46
+ https://github.com/sstephenson/bats/archive/v0.4.0.tar.gz
47
+ ==> Downloading from
48
+ https://codeload.github.com/sstephenson/bats/tar.gz/v0.4.0
49
+ ########################################################################
50
+ 100.0%
51
+ ==> ./install.sh /opt/boxen/homebrew/Cellar/bats/0.4.0
52
+ 🍺 /opt/boxen/homebrew/Cellar/bats/0.4.0: 10 files, 60K, built in 2
53
+ seconds
54
+ ```
55
+
56
+
57
+ Run the tests with:
58
+
59
+ bats whatever_test.sh
60
+
61
+ ## Source
62
+
63
+ This is an exercise to introduce users to using Exercism [http://en.wikipedia.org/wiki/%22Hello,_world!%22_program](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program)
64
+
65
+ ## Submitting Incomplete Solutions
66
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -1,9 +1,3 @@
1
1
  #!/bin/bash
2
2
 
3
- if [ "$#" -eq 0 ]; then
4
- greeter="World"
5
- else
6
- greeter="$@"
7
- fi
8
-
9
- echo "Hello, $greeter!"
3
+ echo "Hello, World!"
@@ -1,22 +1,8 @@
1
1
  #!/usr/bin/env bats
2
2
 
3
- @test "When given no name, it should greet the world!" {
3
+ @test "Say Hi!" {
4
4
  run bash hello_world.sh
5
5
 
6
6
  [ "$status" -eq 0 ]
7
7
  [ "$output" = "Hello, World!" ]
8
8
  }
9
-
10
- @test 'When given "Alice" it should greet Alice!' {
11
- run bash hello_world.sh Alice
12
-
13
- [ "$status" -eq 0 ]
14
- [ "$output" = "Hello, Alice!" ]
15
- }
16
-
17
- @test 'When given "Bob" it should greet Bob!' {
18
- run bash hello_world.sh Bob
19
-
20
- [ "$status" -eq 0 ]
21
- [ "$output" = "Hello, Bob!" ]
22
- }
@@ -0,0 +1,38 @@
1
+ # Leap
2
+
3
+ Given a year, report if it is a leap year.
4
+
5
+ The tricky thing here is that a leap year in the Gregorian calendar occurs:
6
+
7
+ ```plain
8
+ on every year that is evenly divisible by 4
9
+ except every year that is evenly divisible by 100
10
+ unless the year is also evenly divisible by 400
11
+ ```
12
+
13
+ For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap
14
+ year, but 2000 is.
15
+
16
+ If your language provides a method in the standard library that does
17
+ this look-up, pretend it doesn't exist and implement it yourself.
18
+
19
+ ## Notes
20
+
21
+ Though our exercise adopts some very simple rules, there is more to
22
+ learn!
23
+
24
+ For a delightful, four minute explanation of the whole leap year
25
+ phenomenon, go watch [this youtube video][video].
26
+
27
+ [video]: http://www.youtube.com/watch?v=xX96xng7sAE
28
+
29
+ Run the tests with:
30
+
31
+ bats whatever_test.sh
32
+
33
+ ## Source
34
+
35
+ JavaRanch Cattle Drive, exercise 3 [http://www.javaranch.com/leap.jsp](http://www.javaranch.com/leap.jsp)
36
+
37
+ ## Submitting Incomplete Solutions
38
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,20 @@
1
+ # Pangram
2
+
3
+ Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma,
4
+ "every letter") is a sentence using every letter of the alphabet at least once.
5
+ The best known English pangram is:
6
+ > The quick brown fox jumps over the lazy dog.
7
+
8
+ The alphabet used consists of ASCII letters `a` to `z`, inclusive, and is case
9
+ insensitive. Input will not contain non-ASCII symbols.
10
+
11
+ Run the tests with:
12
+
13
+ bats whatever_test.sh
14
+
15
+ ## Source
16
+
17
+ Wikipedia [https://en.wikipedia.org/wiki/Pangram](https://en.wikipedia.org/wiki/Pangram)
18
+
19
+ ## Submitting Incomplete Solutions
20
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,39 @@
1
+ # Phone Number
2
+
3
+ Clean up user-entered phone numbers so that they can be sent SMS messages.
4
+
5
+ The **North American Numbering Plan (NANP)** is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda. All NANP-countries share the same international country code: `1`.
6
+
7
+ NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number. The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*.
8
+
9
+
10
+ The format is usually represented as
11
+ ```
12
+ (NXX)-NXX-XXXX
13
+ ```
14
+ where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9.
15
+
16
+ Your task is to clean up differently formated telephone numbers by removing punctuation and the country code (1) if present.
17
+
18
+ For example, the inputs
19
+ - `+1 (613)-995-0253`
20
+ - `613-995-0253`
21
+ - `1 613 995 0253`
22
+ - `613.995.0253`
23
+
24
+ should all produce the output
25
+
26
+ `6139950253`
27
+
28
+ **Note:** As this exercise only deals with telephone numbers used in NANP-countries, only 1 is considered a valid country code.
29
+
30
+ Run the tests with:
31
+
32
+ bats whatever_test.sh
33
+
34
+ ## Source
35
+
36
+ Event Manager by JumpstartLab [http://tutorials.jumpstartlab.com/projects/eventmanager.html](http://tutorials.jumpstartlab.com/projects/eventmanager.html)
37
+
38
+ ## Submitting Incomplete Solutions
39
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env bash
2
+
3
+ correct_pattern="^1?[2-9][0-9]{2}[2-9][0-9]{6}$"
4
+
5
+ function usage {
6
+ echo "Usage: $0 <phone-number>"
7
+ # echo "<phone-number>: [1]NXX-NXX-XXXX : N=[2-9], X=[0-9]"
8
+ }
9
+
10
+ if [ "$#" -ne 1 ]; then
11
+ usage
12
+ exit 1
13
+ fi
14
+
15
+ input="$1"
16
+
17
+ # Remove everything but numbers
18
+ result=${input//[^0-9]/""}
19
+
20
+ # Error checking
21
+ if [[ ! $result =~ $correct_pattern ]]; then
22
+ echo "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9"
23
+ exit 1
24
+ fi
25
+
26
+ # Strip off leading 1 country code if exists
27
+ echo ${result: -10}
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env bats
2
+
3
+ @test "Cleans the number" {
4
+ run bash phone_number.sh "(223) 456-7890"
5
+ [ "$status" -eq 0 ]
6
+ [ "$output" = "2234567890" ]
7
+ }
8
+
9
+ @test "Cleans numbers with dots" {
10
+ run bash phone_number.sh "223.456.7890"
11
+ [ "$status" -eq 0 ]
12
+ [ "$output" = "2234567890" ]
13
+ }
14
+
15
+ @test "Cleans numbers with multiple spaces" {
16
+ run bash phone_number.sh "223 456 7890 "
17
+ [ "$status" -eq 0 ]
18
+ [ "$output" = "2234567890" ]
19
+ }
20
+
21
+ @test "Invalid when 9 digits" {
22
+ run bash phone_number.sh "123456789"
23
+ [ "$status" -eq 1 ]
24
+ [ "$output" = "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ]
25
+ }
26
+
27
+ @test "Invalid when 11 digits does not start with 1" {
28
+ run bash phone_number.sh "22234567890"
29
+ [ "$status" -eq 1 ]
30
+ [ "$output" = "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ]
31
+ }
32
+
33
+ @test "Valid when 11 digits and starting with 1" {
34
+ run bash phone_number.sh "12234567890"
35
+ [ "$status" -eq 0 ]
36
+ [ "$output" = "2234567890" ]
37
+ }
38
+
39
+ @test "Valid when 11 digits and starting with 1 even with punctuation" {
40
+ run bash phone_number.sh "+1 (223) 456-7890"
41
+ [ "$status" -eq 0 ]
42
+ [ "$output" = "2234567890" ]
43
+ }
44
+
45
+ @test "Invalid with more than 11 digits" {
46
+ run bash phone_number.sh "321234567890"
47
+ [ "$status" -eq 1 ]
48
+ [ "$output" = "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ]
49
+ }
50
+
51
+ @test "Invalid with letters" {
52
+ run bash phone_number.sh "123-abc-7890"
53
+ [ "$status" -eq 1 ]
54
+ [ "$output" = "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ]
55
+ }
56
+
57
+ @test "Invalid with punctuations" {
58
+ run bash phone_number.sh "123-@:!-7890"
59
+ [ "$status" -eq 1 ]
60
+ [ "$output" = "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ]
61
+ }
62
+
63
+ @test "Invalid if area code does not start with 2-9" {
64
+ run bash phone_number.sh "(123) 456-7890"
65
+ [ "$status" -eq 1 ]
66
+ [ "$output" = "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ]
67
+ }
68
+
69
+ @test "Invalid if exchange code does not start with 2-9" {
70
+ run bash phone_number.sh "(223) 056-7890"
71
+ [ "$status" -eq 1 ]
72
+ [ "$output" = "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ]
73
+ }
@@ -0,0 +1,29 @@
1
+ # Raindrops
2
+
3
+ Convert a number to a string, the contents of which depend on the number's factors.
4
+
5
+ - If the number has 3 as a factor, output 'Pling'.
6
+ - If the number has 5 as a factor, output 'Plang'.
7
+ - If the number has 7 as a factor, output 'Plong'.
8
+ - If the number does not have 3, 5, or 7 as a factor,
9
+ just pass the number's digits straight through.
10
+
11
+ ## Examples
12
+
13
+ - 28's factors are 1, 2, 4, **7**, 14, 28.
14
+ - In raindrop-speak, this would be a simple "Plong".
15
+ - 30's factors are 1, 2, **3**, **5**, 6, 10, 15, 30.
16
+ - In raindrop-speak, this would be a "PlingPlang".
17
+ - 34 has four factors: 1, 2, 17, and 34.
18
+ - In raindrop-speak, this would be "34".
19
+
20
+ Run the tests with:
21
+
22
+ bats whatever_test.sh
23
+
24
+ ## Source
25
+
26
+ A variation on a famous interview question intended to weed out potential candidates. [http://jumpstartlab.com](http://jumpstartlab.com)
27
+
28
+ ## Submitting Incomplete Solutions
29
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,30 @@
1
+ # Rna Transcription
2
+
3
+ Given a DNA strand, return its RNA complement (per RNA transcription).
4
+
5
+ Both DNA and RNA strands are a sequence of nucleotides.
6
+
7
+ The four nucleotides found in DNA are adenine (**A**), cytosine (**C**),
8
+ guanine (**G**) and thymine (**T**).
9
+
10
+ The four nucleotides found in RNA are adenine (**A**), cytosine (**C**),
11
+ guanine (**G**) and uracil (**U**).
12
+
13
+ Given a DNA strand, its transcribed RNA strand is formed by replacing
14
+ each nucleotide with its complement:
15
+
16
+ * `G` -> `C`
17
+ * `C` -> `G`
18
+ * `T` -> `A`
19
+ * `A` -> `U`
20
+
21
+ Run the tests with:
22
+
23
+ bats whatever_test.sh
24
+
25
+ ## Source
26
+
27
+ Rosalind [http://rosalind.info/problems/rna](http://rosalind.info/problems/rna)
28
+
29
+ ## Submitting Incomplete Solutions
30
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,53 @@
1
+ # Two Fer
2
+
3
+ `Two-fer` or `2-fer` is short for two for one. One for you and one for me.
4
+
5
+ ```
6
+ "One for X, one for me."
7
+ ```
8
+
9
+ When X is a name or "you".
10
+
11
+ If the given name is "Alice", the result should be "One for Alice, one for me."
12
+ If no name is given, the result should be "One for you, one for me."
13
+
14
+
15
+ ## Test-Driven Development
16
+
17
+ As programmers mature, they eventually want to test their code.
18
+
19
+ Here at Exercism we simulate [Test-Driven
20
+ Development](http://en.wikipedia.org/wiki/Test-driven_development) (TDD), where
21
+ you write your tests before writing any functionality. The simulation comes in
22
+ the form of a pre-written test suite, which will signal that you have solved
23
+ the problem.
24
+
25
+ It will also provide you with a safety net to explore other solutions without
26
+ breaking the functionality.
27
+
28
+ ### A typical TDD workflow on Exercism:
29
+
30
+ 1. Run the test file and pick one test that's failing.
31
+ 2. Write some code to fix the test you picked.
32
+ 3. Re-run the tests to confirm the test is now passing.
33
+ 4. Repeat from step 1.
34
+ 5. Submit your solution (`exercism submit /path/to/file`)
35
+
36
+ ## Instructions
37
+
38
+ Submissions are encouraged to be general, within reason. Having said that, it's
39
+ also important not to over-engineer a solution.
40
+
41
+ It's important to remember that the goal is to make code as expressive and
42
+ readable as we can.
43
+
44
+ Run the tests with:
45
+
46
+ bats whatever_test.sh
47
+
48
+ ## Source
49
+
50
+ This is an exercise to introduce users to basic programming constructs, just after hello World. [https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer)
51
+
52
+ ## Submitting Incomplete Solutions
53
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+
3
+ if [ "$#" -eq 0 ]; then
4
+ person="you"
5
+ else
6
+ person="$@"
7
+ fi
8
+
9
+ echo "One for $person, one for me."
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env bats
2
+
3
+ @test "When given no name, it should have one for you!" {
4
+ run bash two_fer.sh
5
+
6
+ [ "$status" -eq 0 ]
7
+ [ "$output" = "One for you, one for me." ]
8
+ }
9
+
10
+ @test 'When given "Alice" it should have one for Alice!' {
11
+ run bash two_fer.sh Alice
12
+
13
+ [ "$status" -eq 0 ]
14
+ [ "$output" = "One for Alice, one for me." ]
15
+ }
16
+
17
+ @test 'When given "Bob" it should have one for Bob!' {
18
+ run bash two_fer.sh Bob
19
+
20
+ [ "$status" -eq 0 ]
21
+ [ "$output" = "One for Bob, one for me." ]
22
+ }
23
+
@@ -0,0 +1,24 @@
1
+ # Word Count
2
+
3
+ Given a phrase, count the occurrences of each word in that phrase.
4
+
5
+ For example for the input `"olly olly in come free"`
6
+
7
+ ```plain
8
+ olly: 2
9
+ in: 1
10
+ come: 1
11
+ free: 1
12
+ ```
13
+
14
+
15
+ Run the tests with:
16
+
17
+ bats whatever_test.sh
18
+
19
+ ## Source
20
+
21
+ This is a classic toy problem, but we were reminded of it by seeing it in the Go Tour.
22
+
23
+ ## Submitting Incomplete Solutions
24
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -1,5 +1,3 @@
1
- ## ABOUT
2
-
3
1
  [Vim](http://www.vim.org) is a decades old text editor that is still wildly
4
2
  popular among programmers and people who like working in terminal emulators.
5
3
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0.5
4
+ version: 2.2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
@@ -573,32 +573,51 @@ files:
573
573
  - tracks/bash/README.md
574
574
  - tracks/bash/bin/fetch-configlet
575
575
  - tracks/bash/config.json
576
+ - tracks/bash/config/exercise_readme.go.tmpl
577
+ - tracks/bash/config/maintainers.json
576
578
  - tracks/bash/docs/EXERCISE_README_INSERT.md
577
579
  - tracks/bash/docs/INSTALLATION.md
578
580
  - tracks/bash/docs/LEARNING.md
579
581
  - tracks/bash/docs/RESOURCES.md
580
582
  - tracks/bash/docs/TESTS.md
583
+ - tracks/bash/exercises/anagram/README.md
581
584
  - tracks/bash/exercises/anagram/anagram_tests.sh
582
585
  - tracks/bash/exercises/anagram/example.sh
586
+ - tracks/bash/exercises/bob/README.md
583
587
  - tracks/bash/exercises/bob/bob_test.sh
584
588
  - tracks/bash/exercises/bob/example.sh
589
+ - tracks/bash/exercises/difference-of-squares/README.md
585
590
  - tracks/bash/exercises/difference-of-squares/difference_of_squares_test.sh
586
591
  - tracks/bash/exercises/difference-of-squares/example.sh
592
+ - tracks/bash/exercises/gigasecond/README.md
587
593
  - tracks/bash/exercises/gigasecond/example.sh
588
594
  - tracks/bash/exercises/gigasecond/gigasecond_test.sh
595
+ - tracks/bash/exercises/hamming/README.md
589
596
  - tracks/bash/exercises/hamming/example.sh
590
597
  - tracks/bash/exercises/hamming/hamming_test.sh
591
598
  - tracks/bash/exercises/hello-world/HINTS.md
599
+ - tracks/bash/exercises/hello-world/README.md
592
600
  - tracks/bash/exercises/hello-world/example.sh
593
601
  - tracks/bash/exercises/hello-world/hello_world_test.sh
602
+ - tracks/bash/exercises/leap/README.md
594
603
  - tracks/bash/exercises/leap/example.sh
595
604
  - tracks/bash/exercises/leap/leap_test.sh
605
+ - tracks/bash/exercises/pangram/README.md
596
606
  - tracks/bash/exercises/pangram/example.sh
597
607
  - tracks/bash/exercises/pangram/pangram_tests.sh
608
+ - tracks/bash/exercises/phone-number/README.md
609
+ - tracks/bash/exercises/phone-number/example.sh
610
+ - tracks/bash/exercises/phone-number/phone_number_tests.sh
611
+ - tracks/bash/exercises/raindrops/README.md
598
612
  - tracks/bash/exercises/raindrops/example.sh
599
613
  - tracks/bash/exercises/raindrops/raindrops_test.sh
614
+ - tracks/bash/exercises/rna-transcription/README.md
600
615
  - tracks/bash/exercises/rna-transcription/example.sh
601
616
  - tracks/bash/exercises/rna-transcription/rna_transcription_test.sh
617
+ - tracks/bash/exercises/two-fer/README.md
618
+ - tracks/bash/exercises/two-fer/example.sh
619
+ - tracks/bash/exercises/two-fer/two_fer_test.sh
620
+ - tracks/bash/exercises/word-count/README.md
602
621
  - tracks/bash/exercises/word-count/example.awk
603
622
  - tracks/bash/exercises/word-count/example.sh
604
623
  - tracks/bash/img/icon.png