rmthemegen 0.0.39 → 0.0.40

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,8 +21,6 @@
21
21
  require File.expand_path("../../lib/rmthemegen/token_list",__FILE__)
22
22
  require File.expand_path('../../lib/rmthemegen/color/color',__FILE__)
23
23
  require File.expand_path("../../lib/rmthemegen/xmlsimple.rb",__FILE__)
24
- #require File.dirname(__FILE__)#+'./lib/rmthemegen/color/color'
25
- #require File.dirname(__FILE__)#+'./lib/rmthemegen/xmlsimple.rb'
26
24
 
27
25
  module RMThemeGen
28
26
  class GeanyFixer < RMThemeParent
@@ -30,7 +28,6 @@ module RMThemeGen
30
28
  attr_reader :xmlout #a huge structure of xml that can be given to XmlSimple.xml_out() to create that actual color theme file
31
29
 
32
30
  def initialize
33
- # @rand = Random.new
34
31
  @iterations = 0
35
32
  @iterations = ARGV[0].to_s.to_i
36
33
 
@@ -43,19 +40,14 @@ module RMThemeGen
43
40
  begin
44
41
  @dir = (File.expand_path "~/.config/geany/filedefs/")
45
42
  @filelist = Dir.glob(@dir+"/filetypes.*")
46
- # puts @dir+"filetypes.*"
47
- # puts @filelist.inspect
48
- t =Time.now
49
- @extstring = t.year.to_s+t.month.to_s+t.day.to_s+t.sec.to_s
50
- # rescue
51
- # raise "Sorry. There was trouble accessing the files in " + @dir
43
+ @extstring = Time.now.strftime("%Y-%m-%d-%M.%S")
52
44
  end
53
45
 
54
46
 
55
47
  @italic_candidates = ["STRING", "SYMBOL", "REQUIRE"]
56
48
 
57
49
  @bold_candidates = ["KEYWORD","RUBY_SPECIFIC_CALL", "CONSTANT", "COMMA", "PAREN","RUBY_ATTR_ACCESSOR_CALL", "RUBY_ATTR_READER_CALL" ,"RUBY_ATTR_WRITER_CALL", "IDENTIFIER"]
58
- # with code inspections we don't color the text, we just put a line or something under it .
50
+ # with code inspections we don't color the text, we just put a line or something under it .
59
51
  @code_inspections = ["ERROR","WARNING_ATTRIBUTES","DEPRECATED", "TYPO","WARNING_ATTRIBUTES", "BAD_CHARACTER",
60
52
  "CUSTOM_INVALID_STRING_ESCAPE_ATTRIBUTES","ERRORS_ATTRIBUTES", "MATCHED_BRACE_ATTRIBUTES"]
61
53
  @cross_out = ["DEPRECATED_ATTRIBUTES" ]
@@ -66,11 +58,11 @@ module RMThemeGen
66
58
  @bold_chance = 0.4
67
59
  @underline_chance = 0.3
68
60
  @bright_median = 0.85
69
- @min_bright = @bright_median * 0.65
70
- @max_bright = [@bright_median * 1.35,1.0].max
61
+ @min_bright = @bright_median * 0.65
62
+ @max_bright = [@bright_median * 1.35,1.0].max
71
63
 
72
- @min_bright = 0.0
73
- @max_bright = 1.0
64
+ @min_bright = 0.0
65
+ @max_bright = 1.0
74
66
 
75
67
  # if we avoid any notion of "brightness", which is an absolute quality, then we
76
68
  # can make our background any color we want !
@@ -83,22 +75,16 @@ module RMThemeGen
83
75
  #broad contrast spec
84
76
  @min_cont = 0.32
85
77
  @max_cont = 1.0
86
-
87
78
  @schemeversion = 1
88
79
  @background_max_brightness = 0.16
89
80
  @background_grey = true #if false, allows background to be any color, as long as it meets brightness parameter
90
- # @foreground_min_brightness = 0.4
91
-
92
-
93
81
  @backgroundcolor= randcolor( :shade_of_grey=>@background_grey, :max_bright=>@background_max_brightness)# "0"
94
-
95
82
  end #initialize
96
83
 
97
84
  def randthemename
98
85
  out = " "
99
86
  while out.include? " " do
100
87
  out = @@adjectives[rand * @@adjectives.size]+"_"+@@nouns[rand * @@nouns.size]
101
-
102
88
  end
103
89
  return out
104
90
  end
@@ -137,13 +123,8 @@ module RMThemeGen
137
123
  b = (df[:b] || rand*256)%256
138
124
  g = b = r if df[:shade_of_grey] == true
139
125
  color = Color::RGB.new(r,g,b)
140
- #puts "bg" + @backgroundcolor if df[:bg_rgb]
141
- #puts "color "+color.html
142
- #puts "contrast "+color.contrast(df[:bg_rgb]).to_s if df[:bg_rgb]
143
126
  contok = df[:bg_rgb] ? (df[:min_cont]..df[:max_cont]).include?( color.contrast(df[:bg_rgb]) ) : true
144
- #puts "contok "+contok.to_s
145
127
  brightok = (df[:min_bright]..df[:max_bright]).include?( color.to_hsl.brightness )
146
- #puts "brightok "+brightok.to_s
147
128
  end
148
129
 
149
130
  cn = color.html
@@ -154,13 +135,11 @@ module RMThemeGen
154
135
  def go_fix_geany
155
136
  #goes into the geany directory and kicks some ass. it replaces every single color definition with
156
137
  #something random, of course with a consistent background.
157
-
138
+ @backup_dir = @dir+'/_backup_'+@extstring
139
+ `mkdir #{@backup_dir}`
158
140
  @filelist.each do |f|
159
141
  begin
160
- # puts f+" -->"+@dir+"_old_"+@extstring+File.basename(f)
161
- # IO.copy_stream(f,@dir+"_old_"+@extstring+File.basename(f))
162
- copystring="cp #{f} #{@dir+"/_old_"+@extstring+File.basename(f)}"
163
- # puts(copystring)
142
+ copystring="cp #{f} #{@backup_dir}"
164
143
  `#{copystring}`
165
144
  rescue
166
145
  backup_problem = true
@@ -173,7 +152,6 @@ module RMThemeGen
173
152
  ##########################################
174
153
  @@geany_file_contents.each_key do |key|
175
154
  filename=@dir+'/filetypes.'+key.to_s
176
- # puts filename
177
155
  @fout1 = File.open(filename,"w+")
178
156
  @@geany_file_contents[key].each do |c|
179
157
  @fout1.puts c
@@ -183,18 +161,14 @@ module RMThemeGen
183
161
 
184
162
  @filelist = Dir.glob(@dir+"/filetypes.*")
185
163
  @filelist.each do |f|
186
- # puts f.inspect
187
164
  @fin = File.open(f,"r+")
188
165
  @fout = File.open(@dir+"/tmp_out_"+rand.to_s,"w+")
189
- # puts @fin.inspect
190
166
 
191
167
  while !@fin.eof? do
192
168
  curpos = @fin.pos
193
169
  line = @fin.readline
194
170
  if line[0] != "#" && line.include?("=") && line.include?("0x") then
195
171
  # go in and root out the color and give it a new one.
196
- # puts "here is the line I'm working on -- "
197
- # puts line
198
172
  r1 = randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>@min_cont, :max_cont=>@max_cont).upcase
199
173
  r2 = @backgroundcolor.upcase
200
174
  token = line.split("=")[0]
@@ -260,8 +234,6 @@ module RMThemeGen
260
234
  end
261
235
  end
262
236
  if @fout then
263
- # puts "wanting to delete "+@fin.path.to_s
264
- # puts "wanting to copy this file onto it:"+@fout.path.to_s
265
237
  File.delete(@fin.path.to_s)
266
238
  File.rename(@fout.path.to_s, @fin.path.to_s )
267
239
  else puts "there was a problem writing to the new file #{@fout.path.to_s} so I left the old one in place"
File without changes
File without changes
@@ -2215,11 +2215,11 @@ singlestring=0x66ff00;0x000000;false;false
2215
2215
  attribute=0x99cc99;0x000000;false;false
2216
2216
  value=0xffffff;0x000000;false;false
2217
2217
  id=0x339999;0x000000;true;false
2218
- #identifier2=0x996699;0x000000;true;false # not in np++
2218
+ identifier2=0x996699;0x000000;true;false # not in np++
2219
2219
  identifier2=0x999966;0x000000;true;false
2220
2220
  important=0x99cc99;0x000000;true;false
2221
2221
  directive=0x339999;0x000000;false;true
2222
- #identifier3=0x669999;0x000000;true;false # not in np++
2222
+ identifier3=0x669999;0x000000;true;false # not in np++
2223
2223
  identifier2=0x999966;0x000000;true;false
2224
2224
  pseudoelement=0xff8000;0x000000;true;true # not in np++
2225
2225
  extended_identifier=0x99cc99;0x000000;true;false # not in np++
data/rmthemegen.gemspec CHANGED
@@ -4,13 +4,13 @@ require "rmthemegen/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "rmthemegen"
7
- s.version = "0.0.39"
7
+ s.version = "0.0.40"
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["David Heitzman"]
10
10
  s.email = ["evolvemeans@gmail.com"]
11
11
  s.homepage = "http://aptifuge.com"
12
12
  s.summary = %q{Generates RubyMine >= 3.0 editor color themes}
13
- s.description = %q{}
13
+ s.description = %q{replace your geany editor's color scheme with a new dark one with geany_fix}
14
14
  s.rubyforge_project = "rmthemegen"
15
15
 
16
16
  s.required_ruby_version = '>= 1.8.7'
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.add_dependency('rake')
25
25
  s.bindir = "bin"
26
- s.executables = ['bin/generate_themes.rb','bin/geanyfy.rb','bin/geanyfix.rb']
26
+ s.executables = ['bin/generate_themes','bin/geany_fix']
27
27
 
28
28
  s.files = `git ls-files`.split("\n")
29
29
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmthemegen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 81
4
+ hash: 79
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 39
10
- version: 0.0.39
9
+ - 40
10
+ version: 0.0.40
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Heitzman
@@ -111,13 +111,13 @@ dependencies:
111
111
  version: "0"
112
112
  type: :runtime
113
113
  version_requirements: *id006
114
- description: ""
114
+ description: replace your geany editor's color scheme with a new dark one with geany_fix
115
115
  email:
116
116
  - evolvemeans@gmail.com
117
117
  executables:
118
- - geany_fix.rb
119
- - geanyfy.rb
120
- - generate_themes.rb
118
+ - geany_fix
119
+ - geanyfy
120
+ - generate_themes
121
121
  extensions: []
122
122
 
123
123
  extra_rdoc_files: []
@@ -128,9 +128,9 @@ files:
128
128
  - Gemfile
129
129
  - README
130
130
  - Rakefile
131
- - bin/geany_fix.rb
132
- - bin/geanyfy.rb
133
- - bin/generate_themes.rb
131
+ - bin/geany_fix
132
+ - bin/geanyfy
133
+ - bin/generate_themes
134
134
  - lib/rmthemegen.rb
135
135
  - lib/rmthemegen/basis_theme.tmTheme
136
136
  - lib/rmthemegen/color/color.rb