pfrpg_skills 0.0.1 → 0.1.0

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: 76fd2ac592d50372fbb5a919a6600680a820c1b4
4
- data.tar.gz: 6033ccf44e330b5271ad9cc602c47b6759c92ff1
3
+ metadata.gz: 3640f0b5e8617b50a13327dcdcf36c55c3681c3c
4
+ data.tar.gz: b43359dd154f4979ddca81ce128f874909c3cf9b
5
5
  SHA512:
6
- metadata.gz: 55c08cd8b2dcf15a71635762c50746c6b4104d5d2fb4e0af380fe051d0a01531049a20a14c3dc656541232b7f7184f82a09b39e45d6017b244f676c7885d4f91
7
- data.tar.gz: 64fe600bd50542332464278bfbbc9dadcec9024ea579dd33fec06e53ea0bac9cbbbdef98269f9714a36d2ff76606490b92aba206c0e8f6b7945eb0d9cd0c23bf
6
+ metadata.gz: 2145b860e1808fc7321c98406e0a02673031ea483712befa03e9d74a9bea20e0ce4e1c77edb5e13c170f21c9f60591b4fc982b87c6f85d1c49eaa23ad24bccc2
7
+ data.tar.gz: f44d7ac981d3f7a1c17b7101753d1862e591dd670c7911b04e14b2afbd37ca7a01d115b7ee308e9894b33b4ce51144583afbf4b4b8b938c69cad00c07f6f56a0
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ The MIT License (MIT)
2
+ [OSI Approved License]
3
+ The MIT License (MIT)
4
+
5
+ Copyright (c) 2014 HeroSheets, LLC
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs.push "lib"
5
+ t.test_files = FileList['test/*_test.rb']
6
+ t.verbose = true
7
+ end
data/lib/pfrpg_skills.rb CHANGED
@@ -1,6 +1,8 @@
1
- Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), 'pfrpg_core/')) + "/**/*.rb"].each do |file|
2
- require file
3
- end
4
-
5
1
  module PfrpgSkills
6
2
  end
3
+
4
+ require 'pfrpg_skills/skill'
5
+
6
+ Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), 'pfrpg_skills/')) + "/**/*.rb"].each do |file|
7
+ require file
8
+ end
@@ -60,7 +60,8 @@ module PfrpgSkills
60
60
  begin
61
61
  type = type_from_name(name)
62
62
  classname = class_from_name_with_type(name)
63
- skill = classname.constantize.new(type)
63
+ skill = self.constantize(classname).new(type)
64
+
64
65
  return skill if skill.supported_types.include?(type)
65
66
  rescue NameError => e
66
67
  end
@@ -70,7 +71,7 @@ module PfrpgSkills
70
71
  def self.typeless_class(name)
71
72
  begin
72
73
  classname = class_from_name(name)
73
- skill = classname.constantize.new
74
+ skill = self.constantize(classname).new
74
75
  return skill
75
76
  rescue NameError => e
76
77
  end
@@ -86,11 +87,44 @@ module PfrpgSkills
86
87
  end
87
88
 
88
89
  def self.class_from_name_with_type(name)
89
- "Skill::#{name.split(':')[0].gsub(/\s+/, "").camelize}"
90
+ "PfrpgSkills::Skill::#{self.camelize(name.split(':')[0].gsub(/\s+/, ""))}"
90
91
  end
91
92
 
92
93
  def self.class_from_name(name)
93
- "Skill::#{name.gsub(/\s+/, "").camelize}"
94
+ "PfrpgSkills::Skill::#{self.camelize(name.gsub(/\s+/, ""))}"
95
+ end
96
+
97
+ # By default, +camelize+ converts strings to UpperCamelCase. If the argument
98
+ # to +camelize+ is set to <tt>:lower</tt> then +camelize+ produces
99
+ # lowerCamelCase.
100
+ #
101
+ # +camelize+ will also convert '/' to '::' which is useful for converting
102
+ # paths to namespaces.
103
+ #
104
+ # 'active_model'.camelize # => "ActiveModel"
105
+ # 'active_model'.camelize(:lower) # => "activeModel"
106
+ # 'active_model/errors'.camelize # => "ActiveModel::Errors"
107
+ # 'active_model/errors'.camelize(:lower) # => "activeModel::Errors"
108
+ #
109
+ # As a rule of thumb you can think of +camelize+ as the inverse of
110
+ # +underscore+, though there are cases where that does not hold:
111
+ #
112
+ # 'SSLError'.underscore.camelize # => "SslError"
113
+ def self.camelize(term, uppercase_first_letter = true)
114
+ string = term.to_s
115
+ string = string.sub(/^[a-z\d]*/) { $&.capitalize }
116
+ string.gsub(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }.gsub('/', '::')
117
+ end
118
+
119
+ def self.constantize(term) #:nodoc:
120
+ names = term.split('::')
121
+ names.shift if names.empty? || names.first.empty?
122
+
123
+ constant = Object
124
+ names.each do |name|
125
+ constant = constant.const_defined?(name, false) ? constant.const_get(name) : constant.const_missing(name)
126
+ end
127
+ constant
94
128
  end
95
129
 
96
130
  end
@@ -12,6 +12,6 @@ class PfrpgSkills::Skill::Acrobatics
12
12
  end
13
13
 
14
14
  def to_s
15
- Skill.stringify_skill("Acrobatics", attribute, ac_penalty?)
15
+ PfrpgSkills::Skill.stringify_skill("Acrobatics", attribute, ac_penalty?)
16
16
  end
17
17
  end
@@ -16,6 +16,6 @@ class PfrpgSkills::Skill::Bluff
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Bluff", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Bluff", attribute, ac_penalty?)
20
20
  end
21
21
  end
@@ -16,6 +16,6 @@ class PfrpgSkills::Skill::Climb
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Climb", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Climb", attribute, ac_penalty?)
20
20
  end
21
21
  end
@@ -24,7 +24,7 @@ class PfrpgSkills::Skill::Craft
24
24
  end
25
25
 
26
26
  def to_s
27
- Skill.stringify_skill("Craft #{@subject}", attribute, ac_penalty?)
27
+ PfrpgSkills::Skill.stringify_skill("Craft #{@subject}", attribute, ac_penalty?)
28
28
  end
29
29
 
30
30
  def supported_types
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::Diplomacy
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Diplomacy", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Diplomacy", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::DisableDevice
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Disable Device", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Disable Device", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::Disguise
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Disguise", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Disguise", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::EscapeArtist
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Escape Artist", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Escape Artist", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::Fly
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Fly", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Fly", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::HandleAnimal
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Handle Animal", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Handle Animal", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,6 +16,6 @@ class PfrpgSkills::Skill::Heal
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Heal", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Heal", attribute, ac_penalty?)
20
20
  end
21
21
  end
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::Intimidate
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Intimidate", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Intimidate", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -25,7 +25,7 @@ class PfrpgSkills::Skill::Knowledge
25
25
  end
26
26
 
27
27
  def to_s
28
- Skill.stringify_skill("Knowledge - #{@subject}", attribute, ac_penalty?)
28
+ PfrpgSkills::Skill.stringify_skill("Knowledge - #{@subject}", attribute, ac_penalty?)
29
29
  end
30
30
 
31
31
  def supported_types
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::Linguistics
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Linguistics", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Linguistics", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::Perception
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Perception", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Perception", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -25,7 +25,7 @@ class PfrpgSkills::Skill::Perform
25
25
  end
26
26
 
27
27
  def to_s
28
- Skill.stringify_skill("Perform - #{@subject}", attribute, ac_penalty?)
28
+ PfrpgSkills::Skill.stringify_skill("Perform - #{@subject}", attribute, ac_penalty?)
29
29
  end
30
30
 
31
31
  def supported_types
@@ -24,7 +24,7 @@ class PfrpgSkills::Skill::Profession
24
24
  end
25
25
 
26
26
  def to_s
27
- Skill.stringify_skill("Profession - #{@subject}", attribute, ac_penalty?)
27
+ PfrpgSkills::Skill.stringify_skill("Profession - #{@subject}", attribute, ac_penalty?)
28
28
  end
29
29
 
30
30
  def supported_types
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::Ride
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Ride", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Ride", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::SenseMotive
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Sense Motive", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Sense Motive", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::SleightOfHand
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Sleight of Hand", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Sleight of Hand", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::Spellcraft
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Spellcraft", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Spellcraft", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,6 +16,6 @@ class PfrpgSkills::Skill::Stealth
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Stealth", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Stealth", attribute, ac_penalty?)
20
20
  end
21
21
  end
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::Survival
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Survival", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Survival", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::Swim
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Swim", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Swim", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -16,7 +16,7 @@ class PfrpgSkills::Skill::UseMagicDevice
16
16
  end
17
17
 
18
18
  def to_s
19
- Skill.stringify_skill("Use Magic Device", attribute, ac_penalty?)
19
+ PfrpgSkills::Skill.stringify_skill("Use Magic Device", attribute, ac_penalty?)
20
20
  end
21
21
  end
22
22
 
@@ -1,3 +1,3 @@
1
1
  module PfrpgSkills
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,11 @@
1
+ require 'minitest/autorun'
2
+ require 'pfrpg_skills'
3
+
4
+ class SkillsTest < Minitest::Test
5
+
6
+ def test_all_skills
7
+ skills = PfrpgSkills::Skill.skill_list
8
+ assert skills
9
+ end
10
+
11
+ end
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pfrpg_skills
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan OMara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-11 00:00:00.000000000 Z
11
+ date: 2014-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 4.1.1
19
+ version: 4.1.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 4.1.1
27
- - !ruby/object:Gem::Dependency
28
- name: sqlite3
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
26
+ version: 4.1.7
41
27
  description: skills
42
28
  email:
43
29
  - jordan@herosheets.com
@@ -45,8 +31,6 @@ executables: []
45
31
  extensions: []
46
32
  extra_rdoc_files: []
47
33
  files:
48
- - lib/pfrpg_skills.rb
49
- - lib/pfrpg_skills/skill.rb
50
34
  - lib/pfrpg_skills/skill/acrobatics.rb
51
35
  - lib/pfrpg_skills/skill/appraise.rb
52
36
  - lib/pfrpg_skills/skill/bluff.rb
@@ -73,7 +57,12 @@ files:
73
57
  - lib/pfrpg_skills/skill/survival.rb
74
58
  - lib/pfrpg_skills/skill/swim.rb
75
59
  - lib/pfrpg_skills/skill/use_magic_device.rb
60
+ - lib/pfrpg_skills/skill.rb
76
61
  - lib/pfrpg_skills/version.rb
62
+ - lib/pfrpg_skills.rb
63
+ - LICENSE
64
+ - Rakefile
65
+ - test/skills_test.rb
77
66
  homepage: http://herosheets.com
78
67
  licenses: []
79
68
  metadata: {}
@@ -83,18 +72,19 @@ require_paths:
83
72
  - lib
84
73
  required_ruby_version: !ruby/object:Gem::Requirement
85
74
  requirements:
86
- - - ">="
75
+ - - '>='
87
76
  - !ruby/object:Gem::Version
88
77
  version: '0'
89
78
  required_rubygems_version: !ruby/object:Gem::Requirement
90
79
  requirements:
91
- - - ">="
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  requirements: []
95
84
  rubyforge_project:
96
- rubygems_version: 2.2.2
85
+ rubygems_version: 2.0.14
97
86
  signing_key:
98
87
  specification_version: 4
99
88
  summary: Generic PFRPG skills
100
- test_files: []
89
+ test_files:
90
+ - test/skills_test.rb