rubybuntu-gedit 11.09.30 → 11.10.18

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.
@@ -18,6 +18,10 @@ Either checkout the sub-repositories (in the data directory) and install each on
18
18
 
19
19
  gem install rubybuntu-gedit
20
20
  rubybuntu-gedit install
21
+
22
+ For gedit 3, replace the last line with:
23
+
24
+ rubybuntu-gedit install -3
21
25
 
22
26
  Want to tweak parts of the source to your needs? Try this one in the project dir:
23
27
 
@@ -25,9 +25,11 @@ if ARGV.shift != 'install'
25
25
  end
26
26
 
27
27
  @sudo = false # auto sudo
28
+ @gedit = 3
28
29
 
29
- if ARGV.empty?
30
+ if ARGV.reject{|e| e[0] == '-' }.empty?
30
31
  @todo = [:specs, :mime, :styles, :snippets]
32
+ ARGV.clear
31
33
  else
32
34
  @todo = []
33
35
  while arg = ARGV.shift
@@ -42,6 +44,8 @@ else
42
44
  @todo << :styles
43
45
  when /snippets/
44
46
  @todo << :snippets
47
+ when "-3"
48
+ @gedit = 3
45
49
  end
46
50
  end
47
51
  end
@@ -67,19 +71,19 @@ end
67
71
  # language specs
68
72
  def specs
69
73
  puts Paint["\nLet's start with copying the language specs\n", :underline]
70
- print "Q] Do you want to install the languages specs as sudo [/usr/share/gtksourceview-2.0/language-specs]\n" \
71
- " or in your home directory [~/.local/share/gtksourceview-2.0/language-specs]? [Sh] "
74
+ print "Q] Do you want to install the languages specs as sudo [/usr/share/gtksourceview-#@gedit.0/language-specs]\n" \
75
+ " or in your home directory [~/.local/share/gtksourceview-#@gedit.0/language-specs]? [Sh] "
72
76
  if @sudo || gets.chop =~ /^s?$/i
73
- action "sudo cp #@data/language-specs/*.lang /usr/share/gtksourceview-2.0/language-specs"
77
+ action "sudo cp #@data/language-specs/*.lang /usr/share/gtksourceview-#@gedit.0/language-specs"
74
78
  else
75
- action "mkdir -p ~/.local/share/gtksourceview-2.0/language-specs\n" \
76
- " cp #@data/language-specs/*.lang ~/.local/share/gtksourceview-2.0/language-specs"
79
+ action "mkdir -p ~/.local/share/gtksourceview-#@gedit.0/language-specs\n" \
80
+ " cp #@data/language-specs/*.lang ~/.local/share/gtksourceview-#@gedit.0/language-specs"
77
81
  end
78
82
 
79
- check_existence '/usr/share/gtksourceview-2.0/language-specs/rhtml.lang', true
80
- check_existence '/usr/share/gtksourceview-2.0/language-specs/ruby_on_rails.lang', true
81
- check_existence '~/.local/share/gtksourceview-2.0/language-specs/rhtml.lang', false
82
- check_existence '~/.local/share/gtksourceview-2.0/language-specs/ruby_on_rails.lang', false
83
+ check_existence '/usr/share/gtksourceview-#@gedit.0/language-specs/rhtml.lang', true
84
+ check_existence '/usr/share/gtksourceview-#@gedit.0/language-specs/ruby_on_rails.lang', true
85
+ check_existence '~/.local/share/gtksourceview-#@gedit.0/language-specs/rhtml.lang', false
86
+ check_existence '~/.local/share/gtksourceview-#@gedit.0/language-specs/ruby_on_rails.lang', false
83
87
  end
84
88
 
85
89
  # # #
@@ -87,7 +91,7 @@ end
87
91
  def mime
88
92
  puts Paint["\nNow the mime types should be updated\n", :underline]
89
93
  print "Q] Do you want to install the mime types as sudo [/usr/share/mime/packages]\n" \
90
- " or in your home directory [~/.local/share/gtksourceview-2.0/language-specs]? [Sh] "
94
+ " or in your home directory [~/.local/share/gtksourceview-#@gedit.0/language-specs]? [Sh] "
91
95
  if @sudo || gets.chop =~ /^s?$/i
92
96
  action "sudo cp #@data/mime/*.xml /usr/share/mime/packages\n" \
93
97
  " sudo update-mime-database /usr/share/mime"
@@ -105,13 +109,13 @@ end
105
109
  # styles
106
110
  def styles
107
111
  puts Paint["\nNow, some styles get copied that use the new language specs :)\n", :underline]
108
- print "Q] Do you want to install the styles as sudo [/usr/share/gtksourceview-2.0/styles]\n" \
109
- " or in your home directory [~/.local/share/gtksourceview-2.0/styles]? [Sh] "
112
+ print "Q] Do you want to install the styles as sudo [/usr/share/gtksourceview-#@gedit.0/styles]\n" \
113
+ " or in your home directory [~/.local/share/gtksourceview-#@gedit.0/styles]? [Sh] "
110
114
  if @sudo || gets.chop =~ /^s?$/i
111
- action "sudo cp #@data/styles/*.xml /usr/share/gtksourceview-2.0/styles"
115
+ action "sudo cp #@data/styles/*.xml /usr/share/gtksourceview-#@gedit.0/styles"
112
116
  else
113
- action "mkdir -p ~/.local/share/gtksourceview-2.0/styles\n" \
114
- " cp #@data/styles/*.xml ~/.local/share/gtksourceview-2.0/styles"
117
+ action "mkdir -p ~/.local/share/gtksourceview-#@gedit.0/styles\n" \
118
+ " cp #@data/styles/*.xml ~/.local/share/gtksourceview-#@gedit.0/styles"
115
119
  end
116
120
  end
117
121
 
@@ -0,0 +1,148 @@
1
+ #!/usr/bin/env ruby
2
+ # The installer was done as fast as possible, so
3
+ # TODO use dry and maintainable ruby code :D
4
+
5
+ # # #
6
+ # enable colors if possible
7
+ begin
8
+ require 'paint'
9
+ rescue LoadError
10
+ end
11
+
12
+ unless defined? Paint
13
+ module Paint
14
+ def self.[](*args)
15
+ args[0]
16
+ end
17
+ end
18
+ end
19
+
20
+ # # #
21
+ # parse command line stuff
22
+ if ARGV.shift != 'install'
23
+ warn 'Currently, only "rubybuntu-gedit install" is supported. Quitting...'
24
+ exit
25
+ end
26
+
27
+ @sudo = false # auto sudo
28
+ @gedit = 3
29
+
30
+ if ARGV.reject{|e| e[0] == '-' }.empty?
31
+ @todo = [:specs, :mime, :styles, :snippets]
32
+ else
33
+ @todo = []
34
+ while arg = ARGV.shift
35
+ case arg
36
+ when "--sudo"
37
+ @sudo = true
38
+ when /specs/
39
+ @todo << :specs
40
+ when /mime/
41
+ @todo << :mime
42
+ when /styles/
43
+ @todo << :styles
44
+ when /snippets/
45
+ @todo << :snippets
46
+ when "-3"
47
+ @gedit = 3
48
+ end
49
+ end
50
+ end
51
+
52
+ # # #
53
+ # helper methods
54
+ def action(what)
55
+ if what && !what.empty?
56
+ puts Paint["x] #{what}", :yellow]
57
+ system what
58
+ end
59
+ end
60
+
61
+ def check_existence(what, sudo = true)
62
+ if File.exists?(what)
63
+ print "Q] The installer found an outdated file at \"#{what}\"\n" \
64
+ " It's recommended to remove it. Do you want to remove it? [Yn] "
65
+ action("sudo rm -f #{what}") if gets.chop =~ /^y?$/i
66
+ end
67
+ end
68
+
69
+ # # #
70
+ # language specs
71
+ def specs
72
+ puts Paint["\nLet's start with copying the language specs\n", :underline]
73
+ print "Q] Do you want to install the languages specs as sudo [/usr/share/gtksourceview-#@gedit.0/language-specs]\n" \
74
+ " or in your home directory [~/.local/share/gtksourceview-#@gedit.0/language-specs]? [Sh] "
75
+ if @sudo || gets.chop =~ /^s?$/i
76
+ action "sudo cp #@data/language-specs/*.lang /usr/share/gtksourceview-#@gedit.0/language-specs"
77
+ else
78
+ action "mkdir -p ~/.local/share/gtksourceview-#@gedit.0/language-specs\n" \
79
+ " cp #@data/language-specs/*.lang ~/.local/share/gtksourceview-#@gedit.0/language-specs"
80
+ end
81
+
82
+ check_existence '/usr/share/gtksourceview-#@gedit.0/language-specs/rhtml.lang', true
83
+ check_existence '/usr/share/gtksourceview-#@gedit.0/language-specs/ruby_on_rails.lang', true
84
+ check_existence '~/.local/share/gtksourceview-#@gedit.0/language-specs/rhtml.lang', false
85
+ check_existence '~/.local/share/gtksourceview-#@gedit.0/language-specs/ruby_on_rails.lang', false
86
+ end
87
+
88
+ # # #
89
+ # mime
90
+ def mime
91
+ puts Paint["\nNow the mime types should be updated\n", :underline]
92
+ print "Q] Do you want to install the mime types as sudo [/usr/share/mime/packages]\n" \
93
+ " or in your home directory [~/.local/share/gtksourceview-#@gedit.0/language-specs]? [Sh] "
94
+ if @sudo || gets.chop =~ /^s?$/i
95
+ action "sudo cp #@data/mime/*.xml /usr/share/mime/packages\n" \
96
+ " sudo update-mime-database /usr/share/mime"
97
+ else
98
+ action "mkdir -p ~/.local/share/mime/packages\n" \
99
+ " cp #@data/mime/*.xml ~/.local/share/mime/packages" \
100
+ " update-mime-database ~/.local/share/mime"
101
+ end
102
+
103
+ check_existence '/usr/share/mime/rails.xml', true
104
+ check_existence '~/.local/share/mime/rails.xml', false
105
+ end
106
+
107
+ # # #
108
+ # styles
109
+ def styles
110
+ puts Paint["\nNow, some styles get copied that use the new language specs :)\n", :underline]
111
+ print "Q] Do you want to install the styles as sudo [/usr/share/gtksourceview-#@gedit.0/styles]\n" \
112
+ " or in your home directory [~/.local/share/gtksourceview-#@gedit.0/styles]? [Sh] "
113
+ if @sudo || gets.chop =~ /^s?$/i
114
+ action "sudo cp #@data/styles/*.xml /usr/share/gtksourceview-#@gedit.0/styles"
115
+ else
116
+ action "mkdir -p ~/.local/share/gtksourceview-#@gedit.0/styles\n" \
117
+ " cp #@data/styles/*.xml ~/.local/share/gtksourceview-#@gedit.0/styles"
118
+ end
119
+ end
120
+
121
+ # # #
122
+ # snippets
123
+ def snippets
124
+ puts Paint["\nSorry, currently, the snippets cannot installed via this installer\n", :underline]
125
+ puts "...\n"
126
+ end
127
+
128
+
129
+ # # #
130
+ # run
131
+ @data = File.dirname(__FILE__) + "/../data"
132
+
133
+ puts
134
+ puts Paint["Welcome to the rubybuntu-gedit installer :D", :green]
135
+ puts 'Before each action I\'ll tell you what I am going to do'
136
+ puts Paint['Please note: ', :bold] + 'I am pretty untested and might destroy your computer'
137
+
138
+ @todo.each{|todo| send todo }
139
+
140
+ puts
141
+ puts Paint["Congratulations! You've updated your gedit stuff! (if everything worked correctly)", :green]
142
+ puts
143
+ puts "If not, please install manually and open an issue on github"
144
+ puts 'Don\'t forget to change your gedit style to "RubyBuntu One" to really use the new features.'
145
+ puts
146
+ puts " J-_-L"
147
+ puts
148
+
@@ -117,40 +117,14 @@
117
117
  <define-regex id="alnum">[^&amp;&gt;&lt;!?"'`@$%/()=\\{\[\]}*+~#|;,:.\-\^\s]</define-regex>
118
118
  <define-regex id="no_method_prefix">(?&lt;![\w\.\:])</define-regex>
119
119
  <define-regex id="no_method_suffix">(?!(\%{alnum}|[?!]))</define-regex>
120
+ <define-regex id="keywords" extended="true"><!-- TODO also change at array+hash stuff -->
121
+ BEGIN | END | alias | begin | break | case | class | do | else | elsif |
122
+ end | ensure | for | if | in | module | next | redo | rescue | retry |
123
+ return | super | then | undef | unless | until | when | while | yield
124
+ </define-regex>
120
125
 
121
126
  <context id="keywords" style-ref="keyword">
122
- <prefix>\%{no_method_prefix}</prefix>
123
- <suffix>\%{no_method_suffix}</suffix>
124
- <!-- only put here if not already used at another place -->
125
- <keyword>BEGIN</keyword>
126
- <keyword>END</keyword>
127
- <keyword>alias</keyword>
128
- <keyword>begin</keyword>
129
- <keyword>break</keyword>
130
- <keyword>case</keyword>
131
- <keyword>class</keyword>
132
- <keyword>do</keyword>
133
- <keyword>else</keyword>
134
- <keyword>elsif</keyword>
135
- <keyword>end</keyword>
136
- <keyword>ensure</keyword>
137
- <keyword>for</keyword>
138
- <keyword>if</keyword>
139
- <keyword>in</keyword>
140
- <keyword>module</keyword>
141
- <keyword>next</keyword>
142
- <keyword>redo</keyword>
143
- <keyword>rescue</keyword>
144
- <keyword>retry</keyword>
145
- <keyword>return</keyword>
146
- <keyword>super</keyword>
147
- <keyword>then</keyword>
148
- <keyword>undef</keyword>
149
- <keyword>unless</keyword>
150
- <keyword>until</keyword>
151
- <keyword>when</keyword>
152
- <keyword>while</keyword>
153
- <keyword>yield</keyword>
127
+ <match>\%{no_method_prefix}\%{keywords}\%{no_method_suffix}</match>
154
128
  </context>
155
129
 
156
130
  <context id="important-methods" style-ref="important-method">
@@ -960,7 +934,7 @@
960
934
  <context where="end" sub-pattern="0" style-ref="string-delimiter"/>
961
935
  </include>
962
936
  </context>
963
-
937
+
964
938
  <context id="heredoc-backtick-quoted-string" style-ref="system">
965
939
  <start>\%{start-heredoc}(`(\w+)`)</start>
966
940
  <end>^\%{4@start}$</end>
@@ -973,7 +947,7 @@
973
947
  <context where="end" sub-pattern="0" style-ref="system-delimiter"/>
974
948
  </include>
975
949
  </context>
976
-
950
+
977
951
  <context id="heredoc-single-quoted-indented-string" style-ref="string">
978
952
  <start>\%{start-heredoc}(-'(\w+)')</start>
979
953
  <end>^\s*\%{4@start}$</end>
@@ -997,7 +971,7 @@
997
971
  <context where="end" sub-pattern="0" style-ref="string-delimiter"/>
998
972
  </include>
999
973
  </context>
1000
-
974
+
1001
975
  <context id="heredoc-backtick-quoted-indented-string" style-ref="system">
1002
976
  <start>\%{start-heredoc}(-`(\w+)`)</start>
1003
977
  <end>^\s*\%{4@start}$</end>
@@ -1009,7 +983,7 @@
1009
983
  <context where="end" sub-pattern="0" style-ref="system-delimiter"/>
1010
984
  </include>
1011
985
  </context>
1012
-
986
+
1013
987
  <define-regex id="regex-options">([mixo]*[neus]?[mixo]*)</define-regex>
1014
988
 
1015
989
  <context id="regex" style-ref="regex">
@@ -1146,7 +1120,7 @@
1146
1120
  <context where="end" sub-pattern="0" style-ref="symbol-delimiter"/>
1147
1121
  </include>
1148
1122
  </context>
1149
-
1123
+
1150
1124
  <!-- %s{Hello world} -->
1151
1125
  <context id="single-quoted-symbol-curly" style-ref="symbol">
1152
1126
  <start>%s\{</start>
@@ -1189,7 +1163,7 @@
1189
1163
  <context where="end" sub-pattern="0" style-ref="symbol-delimiter"/>
1190
1164
  </include>
1191
1165
  </context>
1192
-
1166
+
1193
1167
  <!-- %s-Hello world- %s+Hello world+ %s*Hello world* and so on... -->
1194
1168
  <context id="single-quoted-symbol-generic" style-ref="symbol">
1195
1169
  <start>%s([[:print:]])(?&lt;![[:alnum:]])</start>
@@ -1253,7 +1227,15 @@
1253
1227
  <start extended="true">
1254
1228
  (?: (?&lt;= \%{alnum}[!?] )
1255
1229
  | (?&lt;= \%{alnum} | [})\]] )
1256
- ) \s*(\[)
1230
+ )
1231
+
1232
+ (?&lt;! \%{no_method_prefix}
1233
+ BEGIN | END | alias | begin | break | case | class | do | else | elsif |
1234
+ end | ensure | for | if | in | module | next | redo | rescue | retry |
1235
+ return | super | then | undef | unless | until | when | while | yield
1236
+ )
1237
+
1238
+ \s* (\[)
1257
1239
  </start>
1258
1240
  <end>\]</end>
1259
1241
  <include>
@@ -1262,11 +1244,19 @@
1262
1244
  <context ref="ruby:*"/>
1263
1245
  </include>
1264
1246
  </context>
1265
- <context id="curly-brackets"><!--(?&lt;= [)\w\]] ) -->
1247
+ <context id="curly-brackets"><!--(?&lt;= [)\w\]] ) --><!-- TODO why does keyword ref not work? -->
1266
1248
  <start extended="true">
1267
1249
  (?: (?&lt;= -> | \%{alnum}[!?] )
1268
- | (?&lt;= \%{alnum} | [)\]] )
1269
- ) \s*(\{)
1250
+ | (?&lt;= \%{alnum} | [)\]] )
1251
+ )
1252
+
1253
+ (?&lt;! \%{no_method_prefix}
1254
+ BEGIN | END | alias | begin | break | case | class | do | else | elsif |
1255
+ end | ensure | for | if | in | module | next | redo | rescue | retry |
1256
+ return | super | then | undef | unless | until | when | while | yield
1257
+ )
1258
+
1259
+ \s* (\{)
1270
1260
  </start>
1271
1261
  <end>\}</end>
1272
1262
  <include>
@@ -1278,10 +1268,16 @@
1278
1268
  </include>
1279
1269
  </context>
1280
1270
 
1281
- <context id="hash" extend-parent="false">
1271
+ <context id="hash">
1282
1272
  <start extended="true">
1283
- (?&lt;! -> | \%{alnum}[!?] )
1284
- (?&lt;! \%{alnum} | [)\]] )
1273
+ (?: (?&lt;= \%{no_method_prefix}
1274
+ BEGIN | END | alias | begin | break | case | class | do | else | elsif |
1275
+ end | ensure | for | if | in | module | next | redo | rescue | retry |
1276
+ return | super | then | undef | unless | until | when | while | yield
1277
+ )
1278
+ | (?&lt;! -> | \%{alnum}[!?] )
1279
+ (?&lt;! \%{alnum} | [)\]] )
1280
+ )
1285
1281
  (\{)
1286
1282
  </start>
1287
1283
  <end>\}</end>
@@ -1294,8 +1290,14 @@
1294
1290
 
1295
1291
  <context id="array">
1296
1292
  <start extended="true">
1297
- (?&lt;! \%{alnum}[!?] )
1298
- (?&lt;! \%{alnum} | [})\]] )
1293
+ (?: (?&lt;= \%{no_method_prefix}
1294
+ BEGIN | END | alias | begin | break | case | class | do | else | elsif |
1295
+ end | ensure | for | if | in | module | next | redo | rescue | retry |
1296
+ return | super | then | undef | unless | until | when | while | yield
1297
+ )
1298
+ | (?&lt;! \%{alnum}[!?] )
1299
+ (?&lt;! \%{alnum} | [})\]] )
1300
+ )
1299
1301
  (\[)
1300
1302
  </start>
1301
1303
  <end>\]</end>
@@ -1310,8 +1312,12 @@
1310
1312
  <match>(=&gt;|,)</match>
1311
1313
  </context>
1312
1314
 
1315
+ <context id="lambdas" style-ref="syntax-char">
1316
+ <match>-&gt;</match>
1317
+ </context>
1318
+
1313
1319
  <context id="data" style-ref="string">
1314
- <start>^__END__</start>
1320
+ <start>^__END__$</start>
1315
1321
  <include>
1316
1322
  <context where="start" sub-pattern="0" style-ref="string-delimiter"/>
1317
1323
  </include>
@@ -1429,6 +1435,7 @@
1429
1435
  <context ref="errors"/>
1430
1436
 
1431
1437
  <context ref="collection-chars"/>
1438
+ <context ref="lambdas"/>
1432
1439
  <context ref="operators"/>
1433
1440
  <context ref="syntax-chars"/>
1434
1441
 
@@ -1440,4 +1447,3 @@
1440
1447
  </context>
1441
1448
  </definitions>
1442
1449
  </language>
1443
-
@@ -1,12 +1,20 @@
1
1
  # hashs
2
2
  {}
3
3
  {}
4
- {}
4
+ { hey{} }
5
5
  a={}
6
6
  a= {}
7
7
  a ?{} :{}
8
8
  !{}
9
9
 
10
+ {{} => {}}
11
+
12
+ 1 if {{} => {}}
13
+ 1 rescue{}
14
+
15
+ 1 if[]
16
+ 1 rescue []
17
+
10
18
  # arrays
11
19
  []
12
20
  []
@@ -55,6 +63,10 @@ a () []
55
63
  a[]{}
56
64
  a [] {}
57
65
  a[b]{}
58
- a [b] {}
66
+ a [b] {{}}
59
67
  a{}[]
60
- a {} []
68
+ a {} [[]]
69
+
70
+ ->{}
71
+ a -> () {}
72
+