fix-steam-font 0.1.0 → 0.1.1

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: b71c9966da4f06eb1b32c32df944ce2844fbd8ea
4
- data.tar.gz: 6e642af3f8d0d67e8165594b7419c2958c440ba1
3
+ metadata.gz: 431a4faf704ece87f654aaffd01e636c8063af17
4
+ data.tar.gz: 7bad3857c891b78c5c87bfebab709af93fbbe5a7
5
5
  SHA512:
6
- metadata.gz: 96282e2bb9d85deae1cb08d3add0e8e73801316fbdc6076959cbfee13da846a397db31f96e76f2bd809e6eda0a1e2889601359df958c5fc5a693e24a9c19f538
7
- data.tar.gz: 799090892097dbbb27026331b4d29d58704d4b689f7c4a4c22b7a4293f5e72743c0ac6883232a6b8326675455b885be8d85cbc35a1d147515986bcf91d2c6c0f
6
+ metadata.gz: f6f9b52795ce6ea5cd859f0f491cc2a84e0a4c582e591d3497e7ff15b22c3442495daadd83e47deed7d7427acfc8ac1b2370077e53ad7f561e78080b69a1d5a8
7
+ data.tar.gz: cc8b7c254398b122a563005ec41d2859dc16d4f548c5c64891a1250e5c7667e020e4a943cd8732d578b0ad2ad52b2135c735b97cd63fbf496567d90763dce5b8
@@ -31,60 +31,6 @@
31
31
  # THE SOFTWARE.
32
32
  # ----------------------------------------------------------------------
33
33
 
34
- @sections_to_change = [
35
- #'console_text_error',
36
- #'console_text',
37
- 'friends_chat_text',
38
- 'friends_chat_text_self',
39
- 'friends_chat_history',
40
- 'friends_chat_event',
41
- 'friends_chat_bright_event',
42
- 'friends_chat_url',
43
- 'friends_chat_name_ingame',
44
- 'friends_chat_self',
45
- 'friends_chat_name',
46
- 'friends_chat_accountid',
47
- 'friends_chat_securitylink'
48
- ]
34
+ require 'fix-steam-font'
49
35
 
50
- styles = File.open('steam.styles').read
51
-
52
- new_styles = ''
53
- processing_section = false
54
-
55
- styles.each_line do |line|
56
- processing_section = line.strip if @sections_to_change.include? line.strip
57
- processing_section = false if line.strip == '}'
58
-
59
- # Only change font-size inside of the target sections.
60
- unless processing_section and line.include?('font-size')
61
- new_styles << line
62
- next
63
- end
64
-
65
- # The console_text sections behave a little differently.
66
- # If the first font-size line is changed, Steam regenerates the file.
67
- # It is the font-size line with [$OSX] that should be changed.
68
- if processing_section.include? 'console_text'
69
-
70
- if line.include? 'OSX]'
71
- # The spaces before \t are required or Steam will replace
72
- # the .styles file with the default.
73
- new_styles << " \tfont-size=14 [$OSX]\n"
74
- else
75
- new_styles << line
76
- end
77
-
78
- next
79
- end
80
-
81
- # Handle all other font-size changes.
82
- new_styles << "\t\tfont-size=14\n"
83
- end
84
-
85
- # Save the changes.
86
- File.open('steam.styles', 'w') do |file|
87
- new_styles.each_line {|line| file << line}
88
- end
89
-
90
- puts 'Done.'
36
+ FixSteamFont.run
@@ -0,0 +1,257 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class FixSteamFont - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+
47
+
48
+ <div id="file-metadata">
49
+ <nav id="file-list-section" class="section">
50
+ <h3 class="section-header">Defined In</h3>
51
+ <ul>
52
+ <li>lib/fix-steam-font/fix_steam_font.rb
53
+ </ul>
54
+ </nav>
55
+
56
+
57
+ </div>
58
+
59
+ <div id="class-metadata">
60
+
61
+ <nav id="parent-class-section" class="section">
62
+ <h3 class="section-header">Parent</h3>
63
+
64
+ <p class="link">Object
65
+
66
+ </nav>
67
+
68
+
69
+
70
+ <!-- Method Quickref -->
71
+ <nav id="method-list-section" class="section">
72
+ <h3 class="section-header">Methods</h3>
73
+
74
+ <ul class="link-list">
75
+
76
+ <li ><a href="#method-c-run">::run</a>
77
+
78
+ </ul>
79
+ </nav>
80
+
81
+ </div>
82
+
83
+ <div id="project-metadata">
84
+
85
+ <nav id="classindex-section" class="section project-section">
86
+ <h3 class="section-header">Class and Module Index</h3>
87
+
88
+ <ul class="link-list">
89
+
90
+ <li><a href="./FixSteamFont.html">FixSteamFont</a>
91
+
92
+ <li><a href="./SteamPath.html">SteamPath</a>
93
+
94
+ </ul>
95
+ </nav>
96
+
97
+ </div>
98
+ </nav>
99
+
100
+ <div id="documentation">
101
+ <h1 class="class">class FixSteamFont</h1>
102
+
103
+ <div id="description" class="description">
104
+
105
+ </div><!-- description -->
106
+
107
+
108
+
109
+
110
+ <section id="5Buntitled-5D" class="documentation-section">
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ <!-- Methods -->
120
+
121
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
122
+ <h3 class="section-header">Public Class Methods</h3>
123
+
124
+
125
+ <div id="method-c-run" class="method-detail ">
126
+
127
+ <div class="method-heading">
128
+ <span class="method-name">run</span><span
129
+ class="method-args">()</span>
130
+
131
+ <span class="method-click-advice">click to toggle source</span>
132
+
133
+ </div>
134
+
135
+
136
+ <div class="method-description">
137
+
138
+
139
+
140
+
141
+
142
+
143
+ <div class="method-source-code" id="run-source">
144
+ <pre><span class="ruby-comment"># File lib/fix-steam-font/fix_steam_font.rb, line 5</span>
145
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">run</span>
146
+ <span class="ruby-ivar">@sections_to_change</span> = [
147
+ <span class="ruby-comment">#&#39;console_text_error&#39;,</span>
148
+ <span class="ruby-comment">#&#39;console_text&#39;,</span>
149
+ <span class="ruby-string">&#39;friends_chat_text&#39;</span>,
150
+ <span class="ruby-string">&#39;friends_chat_text_self&#39;</span>,
151
+ <span class="ruby-string">&#39;friends_chat_history&#39;</span>,
152
+ <span class="ruby-string">&#39;friends_chat_event&#39;</span>,
153
+ <span class="ruby-string">&#39;friends_chat_bright_event&#39;</span>,
154
+ <span class="ruby-string">&#39;friends_chat_url&#39;</span>,
155
+ <span class="ruby-string">&#39;friends_chat_name_ingame&#39;</span>,
156
+ <span class="ruby-string">&#39;friends_chat_self&#39;</span>,
157
+ <span class="ruby-string">&#39;friends_chat_name&#39;</span>,
158
+ <span class="ruby-string">&#39;friends_chat_accountid&#39;</span>,
159
+ <span class="ruby-string">&#39;friends_chat_securitylink&#39;</span>
160
+ ]
161
+
162
+ <span class="ruby-comment"># Load configuration.</span>
163
+ <span class="ruby-ivar">@path</span> = <span class="ruby-constant">SteamPath</span>.<span class="ruby-identifier">new</span>
164
+
165
+ <span class="ruby-keyword">begin</span>
166
+ <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">load</span>
167
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
168
+ <span class="ruby-comment"># Config file doesn&#39;t exist.</span>
169
+ <span class="ruby-comment"># Do not implement - user will be prompted for path.</span>
170
+ <span class="ruby-keyword">end</span>
171
+
172
+ <span class="ruby-comment"># Prompt user for path to Steam.</span>
173
+ <span class="ruby-keyword">if</span> <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">empty?</span>
174
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Enter path to Steam:&quot;</span>
175
+ <span class="ruby-identifier">user_path</span> = <span class="ruby-identifier">gets</span>
176
+
177
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">user_path</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">empty?</span>
178
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;Aborted.&#39;</span>
179
+ <span class="ruby-identifier">exit</span>
180
+ <span class="ruby-keyword">end</span>
181
+
182
+ <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">save</span> <span class="ruby-identifier">user_path</span>.<span class="ruby-identifier">strip</span>
183
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-string">&#39;Could not write config file.&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">exists?</span>
184
+
185
+ <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">load</span>
186
+ <span class="ruby-keyword">end</span>
187
+
188
+ <span class="ruby-comment"># Load Steam style.</span>
189
+ <span class="ruby-identifier">styles_path</span> = <span class="ruby-node">&quot;#{@path}/resource/styles/steam.styles&quot;</span>
190
+
191
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-node">&quot;Could not find steam.styles at:\n#{styles_path}&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-identifier">styles_path</span>
192
+
193
+ <span class="ruby-identifier">styles</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">styles_path</span>).<span class="ruby-identifier">read</span>
194
+
195
+ <span class="ruby-identifier">new_styles</span> = <span class="ruby-string">&#39;&#39;</span>
196
+ <span class="ruby-identifier">processing_section</span> = <span class="ruby-keyword">false</span>
197
+
198
+ <span class="ruby-identifier">styles</span>.<span class="ruby-identifier">each_line</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
199
+ <span class="ruby-identifier">processing_section</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@sections_to_change</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">strip</span>
200
+ <span class="ruby-identifier">processing_section</span> = <span class="ruby-keyword">false</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">strip</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;}&#39;</span>
201
+
202
+ <span class="ruby-comment"># Only change font-size inside of the target sections.</span>
203
+ <span class="ruby-keyword">unless</span> <span class="ruby-identifier">processing_section</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&#39;font-size&#39;</span>)
204
+ <span class="ruby-identifier">new_styles</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">line</span>
205
+ <span class="ruby-keyword">next</span>
206
+ <span class="ruby-keyword">end</span>
207
+
208
+ <span class="ruby-comment"># The console_text sections behave a little differently.</span>
209
+ <span class="ruby-comment"># If the first font-size line is changed, Steam regenerates the file.</span>
210
+ <span class="ruby-comment"># It is the font-size line with [$OSX] that should be changed.</span>
211
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">processing_section</span>.<span class="ruby-identifier">include?</span> <span class="ruby-string">&#39;console_text&#39;</span>
212
+
213
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">include?</span> <span class="ruby-string">&#39;OSX]&#39;</span>
214
+ <span class="ruby-comment"># The spaces before \t are required or Steam will replace</span>
215
+ <span class="ruby-comment"># the .styles file with the default.</span>
216
+ <span class="ruby-identifier">new_styles</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot; \tfont-size=14 [$OSX]\n&quot;</span>
217
+ <span class="ruby-keyword">else</span>
218
+ <span class="ruby-identifier">new_styles</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">line</span>
219
+ <span class="ruby-keyword">end</span>
220
+
221
+ <span class="ruby-keyword">next</span>
222
+ <span class="ruby-keyword">end</span>
223
+
224
+ <span class="ruby-comment"># Handle all other font-size changes.</span>
225
+ <span class="ruby-identifier">new_styles</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;\t\tfont-size=14\n&quot;</span>
226
+ <span class="ruby-keyword">end</span>
227
+
228
+ <span class="ruby-comment"># Save the changes.</span>
229
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">styles_path</span>, <span class="ruby-string">&#39;w&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
230
+ <span class="ruby-identifier">new_styles</span>.<span class="ruby-identifier">each_line</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-identifier">file</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">line</span>}
231
+ <span class="ruby-keyword">end</span>
232
+
233
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;Done.&#39;</span>
234
+ <span class="ruby-keyword">end</span></pre>
235
+ </div><!-- run-source -->
236
+
237
+ </div>
238
+
239
+
240
+
241
+
242
+ </div><!-- run-method -->
243
+
244
+
245
+ </section><!-- public-class-method-details -->
246
+
247
+ </section><!-- 5Buntitled-5D -->
248
+
249
+ </div><!-- documentation -->
250
+
251
+
252
+ <footer id="validator-badges">
253
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
254
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.1.
255
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
256
+ </footer>
257
+
@@ -0,0 +1,376 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class SteamPath - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+
47
+
48
+ <div id="file-metadata">
49
+ <nav id="file-list-section" class="section">
50
+ <h3 class="section-header">Defined In</h3>
51
+ <ul>
52
+ <li>lib/fix-steam-font/steam_path.rb
53
+ </ul>
54
+ </nav>
55
+
56
+
57
+ </div>
58
+
59
+ <div id="class-metadata">
60
+
61
+ <nav id="parent-class-section" class="section">
62
+ <h3 class="section-header">Parent</h3>
63
+
64
+ <p class="link">Object
65
+
66
+ </nav>
67
+
68
+
69
+
70
+ <!-- Method Quickref -->
71
+ <nav id="method-list-section" class="section">
72
+ <h3 class="section-header">Methods</h3>
73
+
74
+ <ul class="link-list">
75
+
76
+ <li ><a href="#method-c-new">::new</a>
77
+
78
+ <li ><a href="#method-i-empty-3F">#empty?</a>
79
+
80
+ <li ><a href="#method-i-exists-3F">#exists?</a>
81
+
82
+ <li ><a href="#method-i-load">#load</a>
83
+
84
+ <li ><a href="#method-i-save">#save</a>
85
+
86
+ <li ><a href="#method-i-to_s">#to_s</a>
87
+
88
+ </ul>
89
+ </nav>
90
+
91
+ </div>
92
+
93
+ <div id="project-metadata">
94
+
95
+ <nav id="classindex-section" class="section project-section">
96
+ <h3 class="section-header">Class and Module Index</h3>
97
+
98
+ <ul class="link-list">
99
+
100
+ <li><a href="./FixSteamFont.html">FixSteamFont</a>
101
+
102
+ <li><a href="./SteamPath.html">SteamPath</a>
103
+
104
+ </ul>
105
+ </nav>
106
+
107
+ </div>
108
+ </nav>
109
+
110
+ <div id="documentation">
111
+ <h1 class="class">class SteamPath</h1>
112
+
113
+ <div id="description" class="description">
114
+
115
+ <p>Represents a path to the Steam installation.</p>
116
+
117
+ </div><!-- description -->
118
+
119
+
120
+
121
+
122
+ <section id="5Buntitled-5D" class="documentation-section">
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+ <!-- Attributes -->
131
+ <section id="attribute-method-details" class="method-section section">
132
+ <h3 class="section-header">Attributes</h3>
133
+
134
+
135
+ <div id="attribute-i-config_path" class="method-detail">
136
+ <div class="method-heading attribute-method-heading">
137
+ <span class="method-name">config_path</span><span
138
+ class="attribute-access-type">[R]</span>
139
+ </div>
140
+
141
+ <div class="method-description">
142
+
143
+
144
+
145
+ </div>
146
+ </div>
147
+
148
+ </section><!-- attribute-method-details -->
149
+
150
+
151
+ <!-- Methods -->
152
+
153
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
154
+ <h3 class="section-header">Public Class Methods</h3>
155
+
156
+
157
+ <div id="method-c-new" class="method-detail ">
158
+
159
+ <div class="method-heading">
160
+ <span class="method-name">new</span><span
161
+ class="method-args">()</span>
162
+
163
+ <span class="method-click-advice">click to toggle source</span>
164
+
165
+ </div>
166
+
167
+
168
+ <div class="method-description">
169
+
170
+
171
+
172
+
173
+
174
+
175
+ <div class="method-source-code" id="new-source">
176
+ <pre><span class="ruby-comment"># File lib/fix-steam-font/steam_path.rb, line 7</span>
177
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
178
+ <span class="ruby-ivar">@path</span> = <span class="ruby-keyword">nil</span>
179
+ <span class="ruby-ivar">@config_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">&#39;~&#39;</span>), <span class="ruby-string">&#39;fix-steam-font.yaml&#39;</span>
180
+ <span class="ruby-keyword">end</span></pre>
181
+ </div><!-- new-source -->
182
+
183
+ </div>
184
+
185
+
186
+
187
+
188
+ </div><!-- new-method -->
189
+
190
+
191
+ </section><!-- public-class-method-details -->
192
+
193
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
194
+ <h3 class="section-header">Public Instance Methods</h3>
195
+
196
+
197
+ <div id="method-i-empty-3F" class="method-detail ">
198
+
199
+ <div class="method-heading">
200
+ <span class="method-name">empty?</span><span
201
+ class="method-args">()</span>
202
+
203
+ <span class="method-click-advice">click to toggle source</span>
204
+
205
+ </div>
206
+
207
+
208
+ <div class="method-description">
209
+
210
+
211
+
212
+
213
+
214
+
215
+ <div class="method-source-code" id="empty-3F-source">
216
+ <pre><span class="ruby-comment"># File lib/fix-steam-font/steam_path.rb, line 16</span>
217
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">empty?</span>
218
+ <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">empty?</span>
219
+ <span class="ruby-keyword">end</span></pre>
220
+ </div><!-- empty-3F-source -->
221
+
222
+ </div>
223
+
224
+
225
+
226
+
227
+ </div><!-- empty-3F-method -->
228
+
229
+
230
+ <div id="method-i-exists-3F" class="method-detail ">
231
+
232
+ <div class="method-heading">
233
+ <span class="method-name">exists?</span><span
234
+ class="method-args">()</span>
235
+
236
+ <span class="method-click-advice">click to toggle source</span>
237
+
238
+ </div>
239
+
240
+
241
+ <div class="method-description">
242
+
243
+
244
+
245
+
246
+
247
+
248
+ <div class="method-source-code" id="exists-3F-source">
249
+ <pre><span class="ruby-comment"># File lib/fix-steam-font/steam_path.rb, line 20</span>
250
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">exists?</span>
251
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-ivar">@path</span>
252
+ <span class="ruby-keyword">end</span></pre>
253
+ </div><!-- exists-3F-source -->
254
+
255
+ </div>
256
+
257
+
258
+
259
+
260
+ </div><!-- exists-3F-method -->
261
+
262
+
263
+ <div id="method-i-load" class="method-detail ">
264
+
265
+ <div class="method-heading">
266
+ <span class="method-name">load</span><span
267
+ class="method-args">()</span>
268
+
269
+ <span class="method-click-advice">click to toggle source</span>
270
+
271
+ </div>
272
+
273
+
274
+ <div class="method-description">
275
+
276
+ <p>Load path from configuration file.</p>
277
+
278
+
279
+
280
+
281
+ <div class="method-source-code" id="load-source">
282
+ <pre><span class="ruby-comment"># File lib/fix-steam-font/steam_path.rb, line 25</span>
283
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">load</span>
284
+ <span class="ruby-identifier">config</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load_file</span> <span class="ruby-ivar">@config_path</span>
285
+ <span class="ruby-ivar">@path</span> = <span class="ruby-identifier">config</span>[<span class="ruby-string">&#39;steam&#39;</span>]
286
+ <span class="ruby-keyword">end</span></pre>
287
+ </div><!-- load-source -->
288
+
289
+ </div>
290
+
291
+
292
+
293
+
294
+ </div><!-- load-method -->
295
+
296
+
297
+ <div id="method-i-save" class="method-detail ">
298
+
299
+ <div class="method-heading">
300
+ <span class="method-name">save</span><span
301
+ class="method-args">(path)</span>
302
+
303
+ <span class="method-click-advice">click to toggle source</span>
304
+
305
+ </div>
306
+
307
+
308
+ <div class="method-description">
309
+
310
+
311
+
312
+
313
+
314
+
315
+ <div class="method-source-code" id="save-source">
316
+ <pre><span class="ruby-comment"># File lib/fix-steam-font/steam_path.rb, line 30</span>
317
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">save</span>(<span class="ruby-identifier">path</span>)
318
+ <span class="ruby-ivar">@path</span> = <span class="ruby-identifier">path</span>
319
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-ivar">@config_path</span>, <span class="ruby-string">&#39;w&#39;</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> <span class="ruby-identifier">file</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;steam: #{@path}&quot;</span>}
320
+ <span class="ruby-keyword">end</span></pre>
321
+ </div><!-- save-source -->
322
+
323
+ </div>
324
+
325
+
326
+
327
+
328
+ </div><!-- save-method -->
329
+
330
+
331
+ <div id="method-i-to_s" class="method-detail ">
332
+
333
+ <div class="method-heading">
334
+ <span class="method-name">to_s</span><span
335
+ class="method-args">()</span>
336
+
337
+ <span class="method-click-advice">click to toggle source</span>
338
+
339
+ </div>
340
+
341
+
342
+ <div class="method-description">
343
+
344
+
345
+
346
+
347
+
348
+
349
+ <div class="method-source-code" id="to_s-source">
350
+ <pre><span class="ruby-comment"># File lib/fix-steam-font/steam_path.rb, line 12</span>
351
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
352
+ <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">to_s</span>
353
+ <span class="ruby-keyword">end</span></pre>
354
+ </div><!-- to_s-source -->
355
+
356
+ </div>
357
+
358
+
359
+
360
+
361
+ </div><!-- to_s-method -->
362
+
363
+
364
+ </section><!-- public-instance-method-details -->
365
+
366
+ </section><!-- 5Buntitled-5D -->
367
+
368
+ </div><!-- documentation -->
369
+
370
+
371
+ <footer id="validator-badges">
372
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
373
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.1.
374
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
375
+ </footer>
376
+
@@ -1,2 +1,4 @@
1
- Sun, 14 Jul 2013 18:16:36 -0700
2
- lib/fix-steam-font.rb Thu, 04 Jul 2013 09:36:35 -0700
1
+ Mon, 15 Jul 2013 00:00:47 -0700
2
+ lib/fix-steam-font.rb Sun, 14 Jul 2013 23:11:24 -0700
3
+ lib/fix-steam-font/fix_steam_font.rb Mon, 15 Jul 2013 00:00:29 -0700
4
+ lib/fix-steam-font/steam_path.rb Sun, 14 Jul 2013 23:33:24 -0700
@@ -50,6 +50,10 @@
50
50
 
51
51
  <ul class="link-list">
52
52
 
53
+ <li><a href="./FixSteamFont.html">FixSteamFont</a>
54
+
55
+ <li><a href="./SteamPath.html">SteamPath</a>
56
+
53
57
  </ul>
54
58
  </nav>
55
59
 
@@ -1 +1 @@
1
- var search_data = {"index":{"searchIndex":[],"longSearchIndex":[],"info":[]}}
1
+ var search_data = {"index":{"searchIndex":["fixsteamfont","steampath","empty?()","exists?()","load()","new()","run()","save()","to_s()"],"longSearchIndex":["fixsteamfont","steampath","steampath#empty?()","steampath#exists?()","steampath#load()","steampath::new()","fixsteamfont::run()","steampath#save()","steampath#to_s()"],"info":[["FixSteamFont","","FixSteamFont.html","",""],["SteamPath","","SteamPath.html","","<p>Represents a path to the Steam installation.\n"],["empty?","SteamPath","SteamPath.html#method-i-empty-3F","()",""],["exists?","SteamPath","SteamPath.html#method-i-exists-3F","()",""],["load","SteamPath","SteamPath.html#method-i-load","()","<p>Load path from configuration file.\n"],["new","SteamPath","SteamPath.html#method-c-new","()",""],["run","FixSteamFont","FixSteamFont.html#method-c-run","()",""],["save","SteamPath","SteamPath.html#method-i-save","(path)",""],["to_s","SteamPath","SteamPath.html#method-i-to_s","()",""]]}}
@@ -26,12 +26,32 @@
26
26
 
27
27
  <h2 id="classes">Classes/Modules</h2>
28
28
  <ul>
29
-
29
+ <li class="class">
30
+ <a href="FixSteamFont.html">FixSteamFont</a>
31
+ </li>
32
+ <li class="class">
33
+ <a href="SteamPath.html">SteamPath</a>
34
+ </li>
35
+
30
36
  </ul>
31
37
 
32
38
  <h2 id="methods">Methods</h2>
33
39
  <ul>
34
40
 
41
+ <li class="method"><a href="SteamPath.html#method-c-new">::new &mdash; SteamPath</a>
42
+
43
+ <li class="method"><a href="FixSteamFont.html#method-c-run">::run &mdash; FixSteamFont</a>
44
+
45
+ <li class="method"><a href="SteamPath.html#method-i-empty-3F">#empty? &mdash; SteamPath</a>
46
+
47
+ <li class="method"><a href="SteamPath.html#method-i-exists-3F">#exists? &mdash; SteamPath</a>
48
+
49
+ <li class="method"><a href="SteamPath.html#method-i-load">#load &mdash; SteamPath</a>
50
+
51
+ <li class="method"><a href="SteamPath.html#method-i-save">#save &mdash; SteamPath</a>
52
+
53
+ <li class="method"><a href="SteamPath.html#method-i-to_s">#to_s &mdash; SteamPath</a>
54
+
35
55
  </ul>
36
56
 
37
57
 
@@ -0,0 +1 @@
1
+ require 'fix-steam-font/fix_steam_font'
@@ -0,0 +1,97 @@
1
+ require 'fix-steam-font/steam_path'
2
+
3
+ class FixSteamFont
4
+ class << self
5
+ def run
6
+ @sections_to_change = [
7
+ #'console_text_error',
8
+ #'console_text',
9
+ 'friends_chat_text',
10
+ 'friends_chat_text_self',
11
+ 'friends_chat_history',
12
+ 'friends_chat_event',
13
+ 'friends_chat_bright_event',
14
+ 'friends_chat_url',
15
+ 'friends_chat_name_ingame',
16
+ 'friends_chat_self',
17
+ 'friends_chat_name',
18
+ 'friends_chat_accountid',
19
+ 'friends_chat_securitylink'
20
+ ]
21
+
22
+ # Load configuration.
23
+ @path = SteamPath.new
24
+
25
+ begin
26
+ @path.load
27
+ rescue Errno::ENOENT => e
28
+ # Config file doesn't exist.
29
+ # Do not implement - user will be prompted for path.
30
+ end
31
+
32
+ # Prompt user for path to Steam.
33
+ if @path.empty?
34
+ puts "Enter path to Steam:"
35
+ user_path = gets
36
+
37
+ if user_path.strip.empty?
38
+ puts 'Aborted.'
39
+ exit
40
+ end
41
+
42
+ @path.save user_path.strip
43
+ raise StandardError, 'Could not write config file.' unless @path.exists?
44
+
45
+ @path.load
46
+ end
47
+
48
+ # Load Steam style.
49
+ styles_path = "#{@path}/resource/styles/steam.styles"
50
+
51
+ raise StandardError, "Could not find steam.styles at:\n#{styles_path}" \
52
+ unless File.exists? styles_path
53
+
54
+ styles = File.open(styles_path).read
55
+
56
+ new_styles = ''
57
+ processing_section = false
58
+
59
+ styles.each_line do |line|
60
+ processing_section = line.strip if @sections_to_change.include? line.strip
61
+ processing_section = false if line.strip == '}'
62
+
63
+ # Only change font-size inside of the target sections.
64
+ unless processing_section and line.include?('font-size')
65
+ new_styles << line
66
+ next
67
+ end
68
+
69
+ # The console_text sections behave a little differently.
70
+ # If the first font-size line is changed, Steam regenerates the file.
71
+ # It is the font-size line with [$OSX] that should be changed.
72
+ if processing_section.include? 'console_text'
73
+
74
+ if line.include? 'OSX]'
75
+ # The spaces before \t are required or Steam will replace
76
+ # the .styles file with the default.
77
+ new_styles << " \tfont-size=14 [$OSX]\n"
78
+ else
79
+ new_styles << line
80
+ end
81
+
82
+ next
83
+ end
84
+
85
+ # Handle all other font-size changes.
86
+ new_styles << "\t\tfont-size=14\n"
87
+ end
88
+
89
+ # Save the changes.
90
+ File.open(styles_path, 'w') do |file|
91
+ new_styles.each_line {|line| file << line}
92
+ end
93
+
94
+ puts 'Done.'
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,35 @@
1
+ require 'yaml'
2
+
3
+ # Represents a path to the Steam installation.
4
+ class SteamPath
5
+ attr_reader :config_path
6
+
7
+ def initialize
8
+ @path = nil
9
+ @config_path = File.join File.expand_path('~'), 'fix-steam-font.yaml'
10
+ end
11
+
12
+ def to_s
13
+ @path.to_s
14
+ end
15
+
16
+ def empty?
17
+ @path.to_s.empty?
18
+ end
19
+
20
+ def exists?
21
+ File.exists? @path
22
+ end
23
+
24
+ # Load path from configuration file.
25
+ def load
26
+ config = YAML.load_file @config_path
27
+ @path = config['steam']
28
+ end
29
+
30
+ def save(path)
31
+ @path = path
32
+ File.open(@config_path, 'w') {|file| file << "steam: #{@path}"}
33
+ end
34
+
35
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fix-steam-font
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McLain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-14 00:00:00.000000000 Z
11
+ date: 2013-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -63,6 +63,9 @@ files:
63
63
  - README.html
64
64
  - bin/fix-steam-font
65
65
  - lib/fix-steam-font.rb
66
+ - lib/fix-steam-font/steam_path.rb
67
+ - lib/fix-steam-font/fix_steam_font.rb
68
+ - doc/SteamPath.html
66
69
  - doc/images/page_green.png
67
70
  - doc/images/brick.png
68
71
  - doc/images/wrench.png
@@ -98,6 +101,7 @@ files:
98
101
  - doc/created.rid
99
102
  - doc/index.html
100
103
  - doc/rdoc.css
104
+ - doc/FixSteamFont.html
101
105
  homepage: https://bitbucket.org/amclain/fix-steam-font
102
106
  licenses:
103
107
  - MIT