salesforce_certification_calculator 0.2.1 → 0.2.2

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
  SHA256:
3
- metadata.gz: ef5a9b0381b8fa4e0bc2bec71b5095410c1d204e14894d4fe1bb3920b38813c5
4
- data.tar.gz: 2792ca40ed89823d99e38498d0866a2fda1761ed3700e991e8e5f0a491d97531
3
+ metadata.gz: c567ac0623c7dd10af68535253e5e41940c3bb95a40f4d4bf949db7ab66c6fdc
4
+ data.tar.gz: 5199c2d3b10aa5be6ee0f8d4c7a017b074cd273895af7998a173dd338dc67480
5
5
  SHA512:
6
- metadata.gz: 71b256254c6f6af442ddcc5b1913d27a9d07686f97409c3530294b347b68fb4c0982cf4b7d82d8a4750c24831861da89fc2ce15ea658080b885110de767c4c7c
7
- data.tar.gz: 3b6dbfd4b6e2035f618eda5bebd96319c895e2a2d02ded544383a8693860eb5b8a2c3ae08739374d960d9d7c31b5ced62155413acc1838e2ad0bf07c88d3db20
6
+ metadata.gz: 9958c6e030202ee90903b6305bbf0279d87e0ed98e8c24c9c8d398b3ac6913bc2bd21cd9fdb3f4c0be41cb9b59c419565ad19a21de39a9811a4d1a2de970f084
7
+ data.tar.gz: 4d4b26d5210bb43bc701302579205897e654eeab15324d0429fa985ea9550845171b1961d16171f0442024e648b8810e55be37dbf1dbe7593f7cc7ac74a1e83d
data/README.md CHANGED
@@ -39,16 +39,19 @@ I've taken a few Salesforce certification exams in my day, and I was always anno
39
39
  ### Set Up Environment
40
40
 
41
41
  1. Install `rbenv` via Homebrew: `brew install rbenv`
42
- 2. Update your `.zshrc` config file:
43
- > `export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.1.0/bin:$PATH"`
44
- > `eval "$(rbenv init - zsh)"`
45
- > `export PATH=$HOME/.rbenv/shims:$PATH`
46
- > `export GEM_HOME=$HOME/gems`
47
- > `export PATH=$HOME/gems/bin:$PATH`
42
+ 2. Add the code block below these steps to your `.zshrc` config file
48
43
  3. Install latest version of Ruby via the `rbenv` package: `rbenv install 3.1.2`
49
44
  4. Set global version of Ruby via the `rbenv` package: `rbenv global 3.1.2`
50
45
  5. Fix `racc` version: `gem pristine racc --version 1.6.0`
51
46
 
47
+ ```bash
48
+ export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.1.0/bin:$PATH"
49
+ eval "$(rbenv init - zsh)"
50
+ export PATH=$HOME/.rbenv/shims:$PATH
51
+ export GEM_HOME=$HOME/gems
52
+ export PATH=$HOME/gems/bin:$PATH
53
+ ```
54
+
52
55
  ### Download Package
53
56
 
54
57
  ```
@@ -62,11 +65,11 @@ If you have trouble downloading the package or just want to play around with the
62
65
  1. Fork this repository
63
66
  2. Clone it to your local computer
64
67
  3. From within your local version of the directory, build the module: `gem build salesforce_certification_calculator.gemspec`
65
- 4. Then install that built module: `gem install ./salesforce_certification_calculator-0.2.1.gem`
68
+ 4. Then install that built module: `gem install ./salesforce_certification_calculator-0.2.2.gem`
66
69
  5. Open a Ruby environment to use the module: `irb`
67
70
  6. Execute any of the recently installed methods
68
71
 
69
- You may need to update the specific version of the build as later releases come out (e.g., `-0.2.1.gem` may need to become `-0.3.0.gem`).
72
+ You may need to update the specific version of the build as later releases come out (e.g., `-0.2.2.gem` may need to become `-0.3.0.gem`).
70
73
 
71
74
  ## Usage
72
75
 
@@ -1,19 +1,15 @@
1
1
  class SalesforceCertificationCalculator::FileReader
2
2
  SFC = SalesforceCertificationCalculator
3
3
 
4
- # Gets list of all exams in the database, including their names and file paths
4
+ # Creates FileReader object by establishing a base path
5
5
  #
6
- # @example Retrieve Exams
7
- # >> reader = FileReader.new
8
- # >> exams = reader.generate_exams_list
9
- # => [<SalesforceCertificationCalculator::Exam 0x000987>, <SalesforceCertificationCalculator::Exam 0x000988>]
10
- #
11
- # @return [Array] collection of Exam objects
12
- def generate_exams_list
13
- exams = []
6
+ # @example Create FileReader Object
7
+ # >> fr = FileReader.new
8
+ def initialize
9
+ sfc_gems = []
10
+
14
11
  gems_path = ENV["HOME"] + "/gems/gems"
15
12
  all_gems = Dir.children(gems_path)
16
- sfc_gems = []
17
13
 
18
14
  all_gems.each do |gem|
19
15
  if gem.include? "salesforce_certification_calculator"
@@ -23,12 +19,25 @@ class SalesforceCertificationCalculator::FileReader
23
19
 
24
20
  sfc_gems.sort
25
21
  latest_sfc = sfc_gems[sfc_gems.length - 1]
26
- base_path = gems_path + "/" + latest_sfc
27
- files = Dir.glob("data/*xml", base: base_path)
22
+
23
+ @base_path = gems_path + "/" + latest_sfc
24
+ end
25
+
26
+ # Gets list of all exams in the database, including their names and file paths
27
+ #
28
+ # @example Retrieve Exams
29
+ # >> reader = FileReader.new
30
+ # >> exams = reader.generate_exams_list
31
+ # => [<SalesforceCertificationCalculator::Exam 0x000987>, <SalesforceCertificationCalculator::Exam 0x000988>]
32
+ #
33
+ # @return [Array] collection of Exam objects
34
+ def generate_exams_list
35
+ exams = []
36
+ files = Dir.glob("data/*xml", base: @base_path)
28
37
 
29
38
  files.each do |file|
30
39
  exam = SFC::Exam.new
31
- file_path = base_path + "/" + file
40
+ file_path = @base_path + "/" + file
32
41
  doc = File.open(file_path) { |f| Nokogiri::XML(f) }
33
42
  title = doc.at_xpath("//title")
34
43
  exam.title = title.content
@@ -51,7 +60,8 @@ class SalesforceCertificationCalculator::FileReader
51
60
  #
52
61
  # @return [Exam] object with not only name and file, but also all sections, with their names and weights
53
62
  def extract_initial_exam_data(exam)
54
- doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
63
+ file_path = @base_path + "/" + exam.file
64
+ doc = File.open(file_path) { |f| Nokogiri::XML(f) }
55
65
  names = doc.xpath("//name")
56
66
  weights = doc.xpath("//weight")
57
67
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesforce_certification_calculator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jackson Reeves