pry-theme 1.1.0 → 1.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: 915606c125b12d2db78eb2fbcc80a733abb5d97e
4
- data.tar.gz: c74ffb434932c0e71a84d9892e677b88398ac169
3
+ metadata.gz: 188f6b205f68db1fd9447846a4cc3a57a341db8a
4
+ data.tar.gz: 0c5dbc3a6ba7b80985b7e2681d6ac51f78eec12c
5
5
  SHA512:
6
- metadata.gz: 8b85ec4855ee1e104b5c0df4ab64d470e8678112ca6b5ceef3087befed492010bb7b6f117c20cf93b9ccfcb8e35e4eeef8b7e55d2301893cdf7499a405d67360
7
- data.tar.gz: b7b7f6c96befaeb1ffc5ad4d642b45fc204bd0cf76033075b2976e2c168465ddc31dcf0030fd7f3cbfe76324729d8e71573ddef57a46d27923eaf1368b417383
6
+ metadata.gz: 94225f995a114b537297163a0a5830c2ee88b9ecb4cfd5925e573c3b954647993373f0a9676a204a9c745779e9fc7199f96e0a8ae74284a90cf4d2829fff5cc3
7
+ data.tar.gz: 9b47e162fb0583da740e50534131fdae076eb9452161b879f78ac0d72d8f1ab154f1b7c7ef26613d79fde36402f883b6e7f235405418703a1bc1aec320e0d75c
data/.rubocop.yml ADDED
@@ -0,0 +1 @@
1
+ inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,303 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2014-06-14 18:01:49 +0300 using RuboCop version 0.23.0.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 3
9
+ Lint/AmbiguousOperator:
10
+ Enabled: false
11
+
12
+ # Offense count: 18
13
+ Lint/AmbiguousRegexpLiteral:
14
+ Enabled: false
15
+
16
+ # Offense count: 44
17
+ Lint/BlockAlignment:
18
+ Enabled: false
19
+
20
+ # Offense count: 1
21
+ # Configuration parameters: AlignWith, SupportedStyles.
22
+ Lint/EndAlignment:
23
+ Enabled: false
24
+
25
+ # Offense count: 1
26
+ Lint/InvalidCharacterLiteral:
27
+ Enabled: false
28
+
29
+ # Offense count: 1
30
+ Lint/ShadowingOuterLocalVariable:
31
+ Enabled: false
32
+
33
+ # Offense count: 3
34
+ # Cop supports --auto-correct.
35
+ Lint/StringConversionInInterpolation:
36
+ Enabled: false
37
+
38
+ # Offense count: 7
39
+ # Cop supports --auto-correct.
40
+ Lint/UnusedBlockArgument:
41
+ Enabled: false
42
+
43
+ # Offense count: 4
44
+ # Cop supports --auto-correct.
45
+ Lint/UnusedMethodArgument:
46
+ Enabled: false
47
+
48
+ # Offense count: 215
49
+ Lint/Void:
50
+ Enabled: false
51
+
52
+ # Offense count: 1
53
+ Style/AccessorMethodName:
54
+ Enabled: false
55
+
56
+ # Offense count: 16
57
+ # Cop supports --auto-correct.
58
+ # Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
59
+ Style/AlignHash:
60
+ Enabled: false
61
+
62
+ # Offense count: 8
63
+ # Cop supports --auto-correct.
64
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
65
+ Style/AlignParameters:
66
+ Enabled: false
67
+
68
+ # Offense count: 1
69
+ # Cop supports --auto-correct.
70
+ Style/AndOr:
71
+ Enabled: false
72
+
73
+ # Offense count: 78
74
+ # Cop supports --auto-correct.
75
+ Style/Blocks:
76
+ Enabled: false
77
+
78
+ # Offense count: 1
79
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
80
+ Style/ClassAndModuleChildren:
81
+ Enabled: false
82
+
83
+ # Offense count: 3
84
+ # Configuration parameters: CountComments.
85
+ Style/ClassLength:
86
+ Max: 400
87
+
88
+ # Offense count: 1
89
+ Style/ClassVars:
90
+ Enabled: false
91
+
92
+ # Offense count: 1
93
+ # Cop supports --auto-correct.
94
+ # Configuration parameters: PreferredMethods.
95
+ Style/CollectionMethods:
96
+ Enabled: false
97
+
98
+ # Offense count: 14
99
+ # Cop supports --auto-correct.
100
+ Style/CommentIndentation:
101
+ Enabled: false
102
+
103
+ # Offense count: 2
104
+ Style/CyclomaticComplexity:
105
+ Max: 10
106
+
107
+ # Offense count: 2
108
+ # Cop supports --auto-correct.
109
+ Style/DeprecatedHashMethods:
110
+ Enabled: false
111
+
112
+ # Offense count: 15
113
+ Style/Documentation:
114
+ Enabled: false
115
+
116
+ # Offense count: 37
117
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
118
+ Style/DotPosition:
119
+ Enabled: false
120
+
121
+ # Offense count: 3
122
+ Style/DoubleNegation:
123
+ Enabled: false
124
+
125
+ # Offense count: 1
126
+ Style/EachWithObject:
127
+ Enabled: false
128
+
129
+ # Offense count: 3
130
+ # Cop supports --auto-correct.
131
+ # Configuration parameters: AllowAdjacentOneLineDefs.
132
+ Style/EmptyLineBetweenDefs:
133
+ Enabled: false
134
+
135
+ # Offense count: 1
136
+ # Cop supports --auto-correct.
137
+ Style/EmptyLines:
138
+ Enabled: false
139
+
140
+ # Offense count: 32
141
+ # Cop supports --auto-correct.
142
+ Style/EmptyLinesAroundBody:
143
+ Enabled: false
144
+
145
+ # Offense count: 19
146
+ # Configuration parameters: Exclude.
147
+ Style/FileName:
148
+ Enabled: false
149
+
150
+ # Offense count: 1
151
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
152
+ Style/For:
153
+ Enabled: false
154
+
155
+ # Offense count: 3
156
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
157
+ Style/FormatString:
158
+ Enabled: false
159
+
160
+ # Offense count: 5
161
+ # Configuration parameters: MinBodyLength.
162
+ Style/GuardClause:
163
+ Enabled: false
164
+
165
+ # Offense count: 416
166
+ # Cop supports --auto-correct.
167
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
168
+ Style/HashSyntax:
169
+ Enabled: false
170
+
171
+ # Offense count: 1
172
+ # Configuration parameters: MaxLineLength.
173
+ Style/IfUnlessModifier:
174
+ Enabled: false
175
+
176
+ # Offense count: 3
177
+ # Cop supports --auto-correct.
178
+ Style/IndentationWidth:
179
+ Enabled: false
180
+
181
+ # Offense count: 36
182
+ Style/Lambda:
183
+ Enabled: false
184
+
185
+ # Offense count: 26
186
+ # Cop supports --auto-correct.
187
+ Style/LeadingCommentSpace:
188
+ Enabled: false
189
+
190
+ # Offense count: 2
191
+ # Cop supports --auto-correct.
192
+ Style/LineEndConcatenation:
193
+ Enabled: false
194
+
195
+ # Offense count: 25
196
+ Style/LineLength:
197
+ Max: 80
198
+
199
+ # Offense count: 20
200
+ # Configuration parameters: CountComments.
201
+ Style/MethodLength:
202
+ Max: 45
203
+
204
+ # Offense count: 1
205
+ Style/ModuleFunction:
206
+ Enabled: false
207
+
208
+ # Offense count: 1
209
+ Style/MultilineTernaryOperator:
210
+ Enabled: false
211
+
212
+ # Offense count: 1
213
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
214
+ Style/Next:
215
+ Enabled: false
216
+
217
+ # Offense count: 11
218
+ # Cop supports --auto-correct.
219
+ # Configuration parameters: PreferredDelimiters.
220
+ Style/PercentLiteralDelimiters:
221
+ Enabled: false
222
+
223
+ # Offense count: 2
224
+ # Cop supports --auto-correct.
225
+ # Configuration parameters: AllowAsExpressionSeparator.
226
+ Style/Semicolon:
227
+ Enabled: false
228
+
229
+ # Offense count: 17
230
+ # Cop supports --auto-correct.
231
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
232
+ Style/SignalException:
233
+ Enabled: false
234
+
235
+ # Offense count: 1
236
+ # Configuration parameters: Methods.
237
+ Style/SingleLineBlockParams:
238
+ Enabled: false
239
+
240
+ # Offense count: 3
241
+ # Cop supports --auto-correct.
242
+ # Configuration parameters: AllowIfMethodIsEmpty.
243
+ Style/SingleLineMethods:
244
+ Enabled: false
245
+
246
+ # Offense count: 1
247
+ # Cop supports --auto-correct.
248
+ Style/SpaceAfterColon:
249
+ Enabled: false
250
+
251
+ # Offense count: 2
252
+ # Cop supports --auto-correct.
253
+ Style/SpaceAroundOperators:
254
+ Enabled: false
255
+
256
+ # Offense count: 47
257
+ # Cop supports --auto-correct.
258
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
259
+ Style/SpaceBeforeBlockBraces:
260
+ Enabled: false
261
+
262
+ # Offense count: 4
263
+ # Cop supports --auto-correct.
264
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
265
+ Style/SpaceInsideBlockBraces:
266
+ Enabled: false
267
+
268
+ # Offense count: 79
269
+ # Cop supports --auto-correct.
270
+ Style/SpaceInsideBrackets:
271
+ Enabled: false
272
+
273
+ # Offense count: 6
274
+ # Cop supports --auto-correct.
275
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
276
+ Style/SpaceInsideHashLiteralBraces:
277
+ Enabled: false
278
+
279
+ # Offense count: 235
280
+ # Cop supports --auto-correct.
281
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
282
+ Style/StringLiterals:
283
+ Enabled: false
284
+
285
+ # Offense count: 1
286
+ # Cop supports --auto-correct.
287
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
288
+ Style/TrailingBlankLines:
289
+ Enabled: false
290
+
291
+ # Offense count: 11
292
+ # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
293
+ Style/TrailingComma:
294
+ Enabled: false
295
+
296
+ # Offense count: 1
297
+ Style/UnlessElse:
298
+ Enabled: false
299
+
300
+ # Offense count: 3
301
+ # Cop supports --auto-correct.
302
+ Style/VariableInterpolation:
303
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Pry Theme changelog
2
2
  ===================
3
3
 
4
+ ### v1.1.1 (June 14, 2014)
5
+
6
+ * Fixed error message when `theme_options` is not set at
7
+ allff. [→](https://github.com/kyrylo/pry-theme/issues/40)
8
+
4
9
  ### v1.1.0 (June 13, 2014)
5
10
 
6
11
  * Added `theme_options` config hash. It is a general config for Pry Theme
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  group :development, :test do
5
- gem 'pry', '0.10.0rc1'
5
+ gem 'pry', '~> 0.10'
6
6
  end
7
7
 
8
8
  group :development do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
@@ -1,18 +1,24 @@
1
1
  module PryTheme
2
+ # @since 1.1.0
3
+ # @api private
4
+ #
5
+ # Does what the +Pry.config.theme_options+ hash orders. Currently, it
6
+ # supports only boolean values.
2
7
  class Config
8
+ # Responsible for actions that are defined in +theme_options+.
3
9
  class Executor
4
10
  # @note The method amends the default behaviour of CodeRay.
5
11
  #
6
- # Sets the colour of the key token to the colour of the symbol token (akin to
7
- # Pygments).
12
+ # Sets the colour of the key token to the colour of the symbol token (akin
13
+ # to Pygments).
8
14
  # @example
9
15
  # {foo: 1, :bar => 2}
10
16
  # # ^ ^
11
17
  # # | |
12
18
  # # key symbol
13
- # Without this patch keys and symbols have generally different colours. It's
14
- # impossible to set the colour of the key token, but with help of this method
15
- # you can make it look like a symbol.
19
+ # Without this patch keys and symbols have generally different colours.
20
+ # It's impossible to set the colour of the key token, but with help of
21
+ # this method you can make it look like a symbol.
16
22
  # @return [void]
17
23
  # @see https://github.com/kyrylo/pry-theme/issues/30
18
24
  def paint_key_as_symbol
data/lib/pry-theme/hex.rb CHANGED
@@ -67,7 +67,7 @@ module PryTheme
67
67
  raise TypeError, "can't convert #{ value.class } into PryTheme::HEX"
68
68
  end
69
69
  if value !~ PryTheme::HEX::PATTERN
70
- raise ArgumentError, %|invalid value for PryTheme::HEX#new(): "#{ value }"|
70
+ fail ArgumentError, %|invalid value for PryTheme::HEX#new(): "#{value}"|
71
71
  end
72
72
  true
73
73
  end
@@ -1,6 +1,8 @@
1
1
  module PryTheme
2
+ # This is a hook to Pry. It executes upon Pry's launch. The hook is
3
+ # responsible for bootstrapping Pry Theme.
2
4
  class WhenStartedHook
3
- def call(target, options, _pry_)
5
+ def call(_, _, _)
4
6
  recreate_user_themes_from_default_ones
5
7
  load_themes
6
8
 
@@ -17,20 +19,20 @@ module PryTheme
17
19
  private
18
20
 
19
21
  def apply_config
22
+ Pry.config.theme_options ||= {}
20
23
  PryTheme::Config.new(Pry.config.theme_options).apply
21
24
  end
22
25
 
23
26
  # Copy a default theme to theme directory, but only if it isn't there yet.
24
27
  def recreate_user_themes_from_default_ones
25
28
  FileUtils.mkdir_p(USER_THEMES_DIR) unless File.exist?(USER_THEMES_DIR)
26
- default_themes = Dir.entries(DEF_THEMES_DIR) - %w{. ..}
29
+ default_themes = Dir.entries(DEF_THEMES_DIR) - %w(. ..)
27
30
 
28
31
  default_themes.each do |theme|
29
32
  user_theme_path = File.join(USER_THEMES_DIR, theme)
30
- unless File.exist?(user_theme_path)
31
- def_theme_path = File.join(DEF_THEMES_DIR, theme)
32
- FileUtils.cp(def_theme_path, USER_THEMES_DIR)
33
- end
33
+ next if File.exist?(user_theme_path)
34
+ def_theme_path = File.join(DEF_THEMES_DIR, theme)
35
+ FileUtils.cp(def_theme_path, USER_THEMES_DIR)
34
36
  end
35
37
  end
36
38
 
@@ -46,9 +48,9 @@ module PryTheme
46
48
  end
47
49
 
48
50
  def display_warning(pry)
49
- pry.output.puts 'Pry Theme Warning: Pry.config.theme is set to ' +
50
- "\"#{ Pry.config.theme }\". There's no such a theme in your system. " +
51
- "All installed themes live inside #{ USER_THEMES_DIR }. Falling back " +
51
+ pry.output.puts 'Pry Theme Warning: Pry.config.theme is set to ' \
52
+ "\"#{ Pry.config.theme }\". There's no such a theme in your system. " \
53
+ "All installed themes live inside #{ USER_THEMES_DIR }. Falling back " \
52
54
  'to the default theme for now.'
53
55
  end
54
56
  end
data/spec/color_table.rb CHANGED
@@ -30,7 +30,7 @@ describe PryTheme::ColorTable do
30
30
  table = PryTheme::ColorTable.t256
31
31
  table.should =~ /Color model 256/
32
32
  table.should =~ /\e\[7;38;5;147m147\e\[0m:\e\[38;5;147mwisteria02\e\[0m/
33
- table.should =~ /\n \e\[7;38;5;24m24\e\[0m:\e\[38;5;24mcerulean_grey01\e\[0m/
33
+ table.should =~ /\e\[7;38;5;24m24\e\[0m:\e\[38;5;24mcerulean_grey01\e\[0m/
34
34
  table.should =~ /\e\[7;38;5;0m0\e\[0m:\e\[38;5;0mblack\e\[0m/
35
35
  end
36
36
 
@@ -85,7 +85,11 @@ describe PryTheme::Color256 do
85
85
  end
86
86
 
87
87
  it "can be used with the default colour" do
88
- color = Color256.new(:bold => true, :italic => true, :underline => true)
88
+ color = Color256.new(
89
+ :bold => true,
90
+ :italic => true,
91
+ :underline => true
92
+ )
89
93
  color.bold?.should == true
90
94
  color.underline?.should == true
91
95
  color.italic?.should == true
@@ -295,7 +299,11 @@ describe PryTheme::Color256 do
295
299
  end
296
300
 
297
301
  it "sets background and foreground properly" do
298
- color = Color256.new(:from => :term, :foreground => 4, :background => 84)
302
+ color = Color256.new(
303
+ :from => :term,
304
+ :foreground => 4,
305
+ :background => 84
306
+ )
299
307
  color.foreground.should == 4
300
308
  color.foreground(true).should == 'navy_blue'
301
309
  color.background.should == 84
@@ -56,14 +56,15 @@ describe PryTheme::Command::PryTheme do
56
56
  pry_eval('pry-theme try sick').should == "Using \"sick\" theme\n"
57
57
  PryTheme::ThemeList.current_theme.name.should == 'sick'
58
58
 
59
- pry_eval('pry-theme try wholesome').should == "Using \"wholesome\" theme\n"
59
+ pry_eval('pry-theme try wholesome')
60
+ .should == "Using \"wholesome\" theme\n"
60
61
  PryTheme::ThemeList.current_theme.name.should == 'wholesome'
61
62
  end
62
63
 
63
64
  it "displays error message if can't find the given theme" do
64
65
  cur = PryTheme::ThemeList.current_theme.name
65
- pry_eval('pry-theme try g-system').
66
- should == %|Cannot find "g-system" amongst themes in #{PryTheme::USER_THEMES_DIR}\n|
66
+ pry_eval('pry-theme try g-system')
67
+ .should =~ /Cannot find "g-system" amongst themes in/
67
68
  PryTheme::ThemeList.current_theme.name.should == cur
68
69
  end
69
70
  end
@@ -193,13 +194,14 @@ describe PryTheme::Command::PryTheme do
193
194
  end
194
195
  end
195
196
 
196
- describe "error handling" do
197
- it "outputs the error message if colour model was specified without a colour" do
197
+ describe "displaying of error messages" do
198
+ it "if colour model was specified without a colour" do
198
199
  pry_eval('pry-theme convert -m 8').should =~ /Provide a color value/
199
200
  end
200
201
 
201
- it "outputs the error message if colour model is invalid" do
202
- pry_eval('pry-theme convert -m 23 -t 32').should =~ /Unknown color model/
202
+ it "if colour model is invalid" do
203
+ pry_eval('pry-theme convert -m 23 -t 32')
204
+ .should =~ /Unknown color model/
203
205
  end
204
206
  end
205
207
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyrylo Silin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-13 00:00:00.000000000 Z
11
+ date: 2014-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -59,6 +59,8 @@ extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
61
  - ".gitignore"
62
+ - ".rubocop.yml"
63
+ - ".rubocop_todo.yml"
62
64
  - ".travis.yml"
63
65
  - CHANGELOG.md
64
66
  - Gemfile