wielder_of_anor 0.1.4 → 0.2.0

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: 9626aa4470f392fc2bb5d6f5b78ac5a17803534b
4
- data.tar.gz: a1faa9db138dfbe8b0312adcb5eee72af2e3eec0
3
+ metadata.gz: 8e81b84a6c048c63ce41ab46da269c437a9f445e
4
+ data.tar.gz: c20ed30930612574987a785d152bba685f77b0df
5
5
  SHA512:
6
- metadata.gz: d5a6a2686a03f5c6efd1ee812626ea29f2bb9747225ee052619dda0c32b510d5a23a69788b45dbdad36a48ec4fa1658e3b1642c0e29cd872236a5d0a7481b471
7
- data.tar.gz: 8cd091785f1f61401c5adfe60d86e328fdc34b29b30a7be5298fe10129c06f885c9ec9600c58d902626730288e1b173ff4c00244e3772000808c676b84c83fdd
6
+ metadata.gz: c5d78de14210e53eb2dd42995f1da520a227a67a3e51f25a5d432492dfa808bb1ca0346809ef8bdea6df52944b8c7e35d74365bcdea7bbf9127239c9ab063070
7
+ data.tar.gz: 054d920d3f19e9930f8cfa818c3be97f8849f26940c49f098d549d50efd1db2b912bd8109595c8fa65a9da3de91f4c0ff7d2d857a7d2a53221265e40851f1d8a
data/README.md CHANGED
@@ -33,17 +33,15 @@ Ahem. Sorry.
33
33
  So. If you need to prevent anything in your code from making it past your dev
34
34
  environment and need a reliable way to do this, use Wielder of Anor.
35
35
 
36
- ## Setup
37
- Setup is simple! Just download Wielder of Anor to the location of your choosing
38
- and then run it!
36
+ ## Installation
37
+ Installation is simple! Just run a `gem install wielder_of_anor`, then run
38
+ `wielder_of_anor` and follow the instructions. You're now good to go!
39
39
 
40
40
  ## Use/What It Does
41
41
  To use Wielder of Anor, just run it *from within the code directory you want to
42
- run the forbidden words checks against* (this is important). A note: it does not
43
- *and should not* actually be *in* your code directory. From your code directory,
44
- just type `ruby full_path_to_wielder_of_anon.rb` followed by the arguments. I
45
- have personally made an alias for doing this. Feel free to do that or type the
46
- full path each time as you desire. You can pass in a couple of arguments here.
42
+ run the forbidden words checks against* (this is important). From your code
43
+ directory, just type `wielder_of_anor` followed by your arguments. You can pass
44
+ in a couple of arguments here.
47
45
 
48
46
  The first argument can be:
49
47
 
@@ -55,6 +53,8 @@ The first argument can be:
55
53
  * 'config' - This will re-run the configuration process. IF YOU SET ANY OF YOUR
56
54
  FILE LOCATIONS TO POINT TO PREVIOUSLY EXISTING FILES, THOSE FILES *WILL* BE
57
55
  OVERWRITTEN.
56
+ * 'words' - This will spit out all of the forbidden words that you currently
57
+ are checking for.
58
58
 
59
59
  There is currently only one option for the second argument:
60
60
 
@@ -79,7 +79,7 @@ every one it finds.
79
79
  If it found none (or if you've skipped the search and are forcing a commit), you
80
80
  are good to go and can tell the app to then run the git commit command, if
81
81
  you've opted to allow it to do so. At this point, Wielder of Anor will run a
82
- `git commit -m ` followed by your commit message (your first argument when
82
+ `git commit -m` followed by your commit message (your first argument when
83
83
  running the app). Once it prints out "COMMITTED.", execution will end. Don't
84
84
  forget to run your git push!
85
85
 
data/bin/wielder_of_anor CHANGED
@@ -10,6 +10,8 @@ woa.first_run if ARGV[0] == 'config'
10
10
 
11
11
  woa.output_forbidden_words if ARGV[0] == 'words'
12
12
 
13
+ woa.add_forbidden_word(ARGV[1]) if ARGV[0] == 'add'
14
+
13
15
  woa.prepare(ARGV[0], ARGV[1])
14
16
 
15
17
  woa.wielder_of_anor
@@ -222,6 +222,32 @@ module WielderOfAnor
222
222
  forbidden_words_file.close
223
223
  end
224
224
 
225
+ def add_forbidden_word(word)
226
+ set_app_directory
227
+ config = YAML.load_file("#{@app_directory}/lib/config.yaml")
228
+ forbidden_words_file = File.open(config['forbidden_words_file_location'], 'a')
229
+ get_forbidden_words(config['forbidden_words_file_location'])
230
+
231
+ if word.nil?
232
+ lines_pretty_print Rainbow('Please submit your word as a second parameter.').red
233
+
234
+ abort
235
+ end
236
+
237
+ if @forbidden_words.include?(word)
238
+ lines_pretty_print Rainbow("''#{word}'' is already a forbidden word!").red
239
+
240
+ abort
241
+ end
242
+
243
+ forbidden_words_file.puts word
244
+ forbidden_words_file.close
245
+
246
+ lines_pretty_print 'Added!'
247
+
248
+ abort
249
+ end
250
+
225
251
  def wielder_of_anor
226
252
  found_forbidden = false
227
253
 
@@ -1,3 +1,3 @@
1
1
  module WielderOfAnor
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wielder_of_anor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Sellek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-16 00:00:00.000000000 Z
11
+ date: 2016-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow