salesforce_certification_calculator 0.2.1 → 0.2.2
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 +4 -4
- data/README.md +11 -8
- data/lib/salesforce_certification_calculator/file_reader.rb +24 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c567ac0623c7dd10af68535253e5e41940c3bb95a40f4d4bf949db7ab66c6fdc
|
4
|
+
data.tar.gz: 5199c2d3b10aa5be6ee0f8d4c7a017b074cd273895af7998a173dd338dc67480
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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.
|
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
|
-
#
|
4
|
+
# Creates FileReader object by establishing a base path
|
5
5
|
#
|
6
|
-
# @example
|
7
|
-
# >>
|
8
|
-
|
9
|
-
|
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
|
-
|
27
|
-
|
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
|
-
|
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
|
|