autostart 1.0.20

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f97737cfede85b97e6383c658e538070388eed65b8ba926918de09eca4b52531
4
+ data.tar.gz: 02517dd90b45aebf37d5e2f3ca37020d5e5167e2926a73c7bdb7fbb9998f3eae
5
+ SHA512:
6
+ metadata.gz: 7f5594455710d344ac1688a41408ae7bc03564138ef4f1ffe0b964f2379a57544b7869ca27bdb5e314c885d8a39fb24f1f00116d09096a733c029365d843f890
7
+ data.tar.gz: 1f8ccad56776d00ffeb703bfe3443fd861c952e17c7c6b173a62f65d794e116f18ed546c1f3c15a864b1b6785bd1249662b8a23ba490fe5f97412b7b0f78fed1
@@ -0,0 +1,43 @@
1
+ # =========================================================================== #
2
+ # Gemspec for Project Autostart.
3
+ # =========================================================================== #
4
+ require 'autostart/version/version.rb'
5
+
6
+ Gem::Specification.new { |s|
7
+
8
+ s.name = 'autostart'
9
+ s.version = Autostart::VERSION
10
+ s.date = Time.now.strftime('%Y-%m-%d')
11
+
12
+ DESCRIPTION = <<-EOF
13
+
14
+ This tiny project just tries to create some autostart-related
15
+ files. I dont think it will be too useful for others though.
16
+
17
+ If you have specific suggestions to make this gem more
18
+ useful for others, please drop me an email at:
19
+
20
+ shevegen@gmail.com
21
+
22
+ Thank you.
23
+ EOF
24
+
25
+ s.summary = DESCRIPTION
26
+ s.description = DESCRIPTION
27
+
28
+ s.extra_rdoc_files = %w()
29
+
30
+ s.authors = ['Robert A. Heiler']
31
+ s.email = 'shevegen@gmail.com'
32
+ s.license = 'GPL-2.0'
33
+ s.files = Dir['**/*']
34
+ s.homepage = 'http://rubygems.org/gems/autostart'
35
+
36
+ s.required_ruby_version = '>= '+RUBY_VERSION
37
+ s.required_rubygems_version = '>= '+Gem::VERSION
38
+ s.rubygems_version = '>= '+Gem::VERSION
39
+
40
+ s.add_dependency 'colours'
41
+ s.add_dependency 'opn'
42
+
43
+ }
@@ -0,0 +1,7 @@
1
+ #!/System/Index/bin/ruby -w
2
+ # Encoding: ISO-8859-1
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'autostart'
6
+
7
+ Autostart.run(ARGV)
@@ -0,0 +1 @@
1
+ require 'autostart/autostart.rb'
@@ -0,0 +1,291 @@
1
+ #!/System/Index/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === Autostart
6
+ #
7
+ # This class will autogenerate some files.
8
+ #
9
+ # It can be used i.e. as replacement for xfce_autostart.
10
+ # =========================================================================== #
11
+ # require 'autostart'
12
+ # =========================================================================== #
13
+ require 'fileutils'
14
+ require 'opn'
15
+ begin
16
+ require 'colours'
17
+ rescue LoadError; end
18
+ require 'convert_global_env'
19
+ require 'autostart/constants.rb'
20
+ require 'autostart/version/version.rb'
21
+
22
+ begin
23
+ require 'roebe/classes/create_desktop_file.rb'
24
+ rescue LoadError; end # bl $ROEBE/classes/create_desktop_file.rb
25
+
26
+ class Autostart # Autostart.new
27
+
28
+ include Colours
29
+
30
+ # ========================================================================= #
31
+ # === initialize
32
+ # ========================================================================= #
33
+ def initialize(
34
+ what = 'default'
35
+ )
36
+ reset
37
+ autostart_what(what) if what
38
+ end
39
+
40
+ # ========================================================================= #
41
+ # === reset
42
+ # ========================================================================= #
43
+ def reset
44
+ @array_these_symlinks_were_not_found = []
45
+ @be_verbose = true
46
+ end
47
+
48
+ # ========================================================================= #
49
+ # === consider_reporting_missing_entries_to_the_user
50
+ # ========================================================================= #
51
+ def consider_reporting_missing_entries_to_the_user
52
+ unless @array_these_symlinks_were_not_found.empty?
53
+ e; opn; e 'We did find some missing entries. Perhaps you '\
54
+ 'may wish to correct these:'
55
+ e
56
+ @array_these_symlinks_were_not_found.each {|entry|
57
+ e simp(" #{entry}")
58
+ }; e
59
+ end
60
+ end
61
+
62
+ # ========================================================================= #
63
+ # === mkdir
64
+ # ========================================================================= #
65
+ def mkdir(i)
66
+ i = File.expand_path(i) if i.include? '~' # If includes ~, use File.expand_path
67
+ FileUtils.mkdir_p(i) unless File.exist?(i)
68
+ end; alias ensure_that_this_directory_exists mkdir # === ensure_that_this_directory_exists
69
+
70
+ # ========================================================================= #
71
+ # === remove_file
72
+ # ========================================================================= #
73
+ def remove_file(i)
74
+ opn; e red+'Removing file '+sfile(i)+red+' now.' if File.exist?(i)
75
+ File.delete(i) if File.file?(i)
76
+ end
77
+
78
+ # ========================================================================= #
79
+ # === red
80
+ # ========================================================================= #
81
+ def red
82
+ Colours::RED
83
+ end
84
+
85
+ # ========================================================================= #
86
+ # === copy
87
+ # ========================================================================= #
88
+ def copy(from, to)
89
+ from = ConvertGlobalEnv[from] if from.include? '$'
90
+ to = ConvertGlobalEnv[to] if to.include? '$'
91
+ from = File.expand_path(from)
92
+ to = File.expand_path(to)
93
+ FileUtils.copy(from, to)
94
+ end
95
+
96
+ # ========================================================================= #
97
+ # === symlink
98
+ #
99
+ # This method accepts only one argument and will split it based on ' '.
100
+ # File.symlink(real_existing_location, new_location)
101
+ # ========================================================================= #
102
+ def symlink(i) # Expects string input.
103
+ real_existing_location, new_location = i.split ' '
104
+ if real_existing_location.include? '$'
105
+ # We solve this very simply without regex.
106
+ last_position = real_existing_location.index('/')
107
+ real_value = ENV[real_existing_location[1, last_position-1]].dup
108
+ real_existing_location = real_value+real_existing_location[last_position..-1]
109
+ end
110
+ if new_location.include? '$'
111
+ new_location = ConvertGlobalEnv.convert new_location
112
+ end
113
+ new_location = File.expand_path(new_location) if new_location.include? '~'
114
+ filename = File.basename(real_existing_location)
115
+ new_location << '/'+filename
116
+ if File.symlink?(new_location)
117
+ readlink = File.readlink(new_location)
118
+ remove_file(readlink) unless File.exist?(readlink)
119
+ end
120
+ remove_file(new_location) if File.exist? new_location
121
+ if File.exist?(real_existing_location)
122
+ opn; e 'Trying to symlink '+sfile(real_existing_location)+
123
+ ' to '+sfile(new_location)+' now.'
124
+ unless File.exist? new_location
125
+ File.symlink(real_existing_location, new_location)
126
+ else
127
+ opn; e 'Can not symlink because '+sfile(new_location)+' does not exist.'
128
+ end
129
+ else
130
+ if @be_verbose
131
+ opn; e 'Trying to symlink '+sfile(real_existing_location)+
132
+ ' to '+sfile(new_location)
133
+ opn; e 'but the file '+sfile(real_existing_location)+' does not '\
134
+ 'exist, thus we skip this action.'
135
+ @array_these_symlinks_were_not_found << real_existing_location
136
+ end
137
+ end
138
+ end
139
+
140
+ # ========================================================================= #
141
+ # === show_header
142
+ # ========================================================================= #
143
+ def show_header(
144
+ for_this_program = :xfce
145
+ )
146
+ case for_this_program
147
+ when :xfce
148
+ for_this_program = 'XFCE'
149
+ when :kde
150
+ for_this_program = 'KDE'
151
+ end
152
+ output_header
153
+ opn; e "Autostart for #{orange(for_this_program)}."
154
+ output_header
155
+ end
156
+
157
+ # ========================================================================= #
158
+ # === output_header (cliner tag, liner tag)
159
+ # ========================================================================= #
160
+ def output_header
161
+ e '=' * 80
162
+ end
163
+
164
+ # ========================================================================= #
165
+ # === show_help
166
+ # ========================================================================= #
167
+ def show_help
168
+ e 'This class (class Autostart) allows you to "autostart" some '\
169
+ 'applications in different DE/WMs.'
170
+ e
171
+ e 'Available autostart actions are:'
172
+ e
173
+ e ' - xfce'
174
+ e ' - kde'
175
+ e ' - mate'
176
+ e
177
+ end
178
+
179
+ # ========================================================================= #
180
+ # === autostart_kde (kde tag)
181
+ #
182
+ # To invoke this method, do:
183
+ # autostart --kde
184
+ # ========================================================================= #
185
+ def autostart_kde
186
+ show_header :kde
187
+ # mkdir HSS['KDE_AUTOSTART']
188
+ ensure_that_this_directory_exists KDE_AUTOSTART
189
+ mkdir '~/.kde/share/config/'
190
+ copy '$LINUX/KDE/konsolerc','~/.kde/share/config/'
191
+ ARRAY_SYMLINK_THESE_ENTRIES_FOR_KDE.each {|entry|
192
+ symlink(entry+' $KDE_AUTOSTART')
193
+ }
194
+ end
195
+
196
+ # ========================================================================= #
197
+ # === autostart_mate
198
+ # ========================================================================= #
199
+ def autostart_mate(
200
+ use_these_programs = YAML.load_file(
201
+ '/Users/x/DATA/PROGRAMMING_LANGUAGES/RUBY/src/roebe/lib/roebe/yaml/'\
202
+ 'autostart_these_programs.yml'
203
+ )
204
+ )
205
+ show_header :mate
206
+ home_dir = HOME_DIR+'.config/autostart'
207
+ mkdir home_dir
208
+ use_these_programs.each {|this_file|
209
+ Roebe::CreateDesktopFile.new(this_file)
210
+ }
211
+ end
212
+
213
+ # ========================================================================= #
214
+ # === autostart_xfce (xfce tag)
215
+ #
216
+ # This will usually default to programs such as:
217
+ # xchat, bluefish, konsole and mrxvt.
218
+ # ========================================================================= #
219
+ def autostart_xfce(
220
+ i = ARRAY_SYMLINK_THESE_ENTRIES_FOR_XFCE
221
+ )
222
+ show_header :xfce
223
+ # home_dir = '~/.config/autostart'
224
+ home_dir = HOME_DIR+'.config/autostart'
225
+ mkdir home_dir
226
+ i.each {|entry|
227
+ symlink(entry+' '+home_dir)
228
+ }
229
+ end
230
+
231
+ # ========================================================================= #
232
+ # === autostart_what
233
+ # ========================================================================= #
234
+ def autostart_what(i = DEFAULT_INPUT)
235
+ i = DEFAULT_INPUT if i.nil?
236
+ i = i.first if i.is_a? Array # Fetch first entry if it is an Array.
237
+ case i.to_s # case tag
238
+ # ======================================================================= #
239
+ # === autostart help
240
+ # ======================================================================= #
241
+ when /^-?-?help/
242
+ show_help
243
+ exit
244
+ # ======================================================================= #
245
+ # === autostart mate
246
+ # ======================================================================= #
247
+ when /^-?-?mate$/
248
+ autostart_mate
249
+ # ======================================================================= #
250
+ # === autostart xfce
251
+ # ======================================================================= #
252
+ when /^-?-?xfce$/,'default','' # This is the default since August 2013.
253
+ autostart_xfce
254
+ # ======================================================================= #
255
+ # === autostart kde
256
+ # ======================================================================= #
257
+ when /^-?-?kde$/
258
+ autostart_kde
259
+ else
260
+ opn; e 'Not found `'+simp(i)+'` in the list of available entries.'
261
+ opn; e 'It is probably not registered.'
262
+ end
263
+ consider_reporting_missing_entries_to_the_user
264
+ end; alias run autostart_what # === run
265
+
266
+ # ========================================================================= #
267
+ # === orange
268
+ # ========================================================================= #
269
+ def orange(i)
270
+ Colours.orange(i)
271
+ end
272
+
273
+ # ========================================================================= #
274
+ # === Autostart.autostart_kde
275
+ # ========================================================================= #
276
+ def self.autostart_kde
277
+ self.new(:kde)
278
+ end
279
+
280
+ # ========================================================================= #
281
+ # === Autostart.run
282
+ # ========================================================================= #
283
+ def self.run(i = ARGV)
284
+ self.new(i)
285
+ end
286
+
287
+ end
288
+
289
+ if __FILE__ == $PROGRAM_NAME
290
+ Autostart.new(ARGV.first)
291
+ end # autostart xfce
@@ -0,0 +1,77 @@
1
+ #!/System/Index/bin/ruby -w
2
+ # Encoding: ISO-8859-1
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ class Autostart
6
+
7
+ # ========================================================================= #
8
+ # === DEFAULT_INPUT
9
+ # ========================================================================= #
10
+ DEFAULT_INPUT = 'xfce'
11
+
12
+ # ========================================================================= #
13
+ # === DEFAULT_COLOUR
14
+ # ========================================================================= #
15
+ DEFAULT_COLOUR = Colours::GREEN
16
+
17
+ # ========================================================================= #
18
+ # === HOME_DIR
19
+ # ========================================================================= #
20
+ HOME_DIR = "#{ENV['HOME']}/" # /home/debug/
21
+
22
+ # ========================================================================= #
23
+ # === KDE_AUTOSTART
24
+ # ========================================================================= #
25
+ KDE_AUTOSTART = '~/.kde/Autostart/'
26
+
27
+ # ========================================================================= #
28
+ # === LINUX
29
+ # ========================================================================= #
30
+ LINUX = ENV['LINUX'].to_s
31
+
32
+ # ========================================================================= #
33
+ # === SYSBIN
34
+ # ========================================================================= #
35
+ SYSBIN = ENV['MY_SYSBIN'].to_s
36
+
37
+ # ========================================================================= #
38
+ # === SOFFICE_BINARY
39
+ #
40
+ # For libreoffice.
41
+ # ========================================================================= #
42
+ SOFFICE_BINARY = '/opt/libreoffice/program/soffice'
43
+
44
+ # ========================================================================= #
45
+ # === FIREFOX_BINARY
46
+ # ========================================================================= #
47
+ FIREFOX_BINARY = '/Programs/Firefox/Current/firefox'
48
+
49
+ # ========================================================================= #
50
+ # === ARRAY_SYMLINK_THESE_ENTRIES_FOR_KDE
51
+ #
52
+ # Which entries should be symlinked for KDE.
53
+ #
54
+ # If you do not want to have this entry, simply remove it from the
55
+ # constant.
56
+ # ========================================================================= #
57
+ ARRAY_SYMLINK_THESE_ENTRIES_FOR_KDE = [
58
+ FIREFOX_BINARY,
59
+ "#{LINUX}/SHELL/SCRIPTS/konsole.sh",
60
+ SYSBIN+'/bluefish',
61
+ SYSBIN+'/pidgin',
62
+ SOFFICE_BINARY,
63
+ ] # SYSBIN+'/xchat',
64
+
65
+ # ========================================================================= #
66
+ # === ARRAY_SYMLINK_THESE_ENTRIES_FOR_XFCE
67
+ #
68
+ # Use xchat, bluefish, konsole and mrxvt.
69
+ # ========================================================================= #
70
+ ARRAY_SYMLINK_THESE_ENTRIES_FOR_XFCE = %w(
71
+ $SYSBIN/xchat
72
+ $SYSBIN/bluefish
73
+ $SYSBIN/konsole
74
+ $SYSBIN/mrxvt
75
+ ) << FIREFOX_BINARY # And append the missing firefox binary here. This line works fine.
76
+
77
+ end
@@ -0,0 +1,14 @@
1
+ #!/System/Index/bin/ruby -w
2
+ # Encoding: ISO-8859-1
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'autostart/version/version.rb'
6
+ # =========================================================================== #
7
+ class Autostart
8
+
9
+ # ========================================================================= #
10
+ # === Autostart::VERSION
11
+ # ========================================================================= #
12
+ VERSION = '1.0.20'
13
+
14
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: autostart
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.20
5
+ platform: ruby
6
+ authors:
7
+ - Robert A. Heiler
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-05-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colours
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: opn
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: |2
42
+
43
+ This tiny project just tries to create some autostart-related
44
+ files. I dont think it will be too useful for others though.
45
+
46
+ If you have specific suggestions to make this gem more
47
+ useful for others, please drop me an email at:
48
+
49
+ shevegen@gmail.com
50
+
51
+ Thank you.
52
+ email: shevegen@gmail.com
53
+ executables: []
54
+ extensions: []
55
+ extra_rdoc_files: []
56
+ files:
57
+ - autostart.gemspec
58
+ - bin/autostart
59
+ - lib/autostart.rb
60
+ - lib/autostart/autostart.rb
61
+ - lib/autostart/constants.rb
62
+ - lib/autostart/version/version.rb
63
+ homepage: http://rubygems.org/gems/autostart
64
+ licenses:
65
+ - GPL-2.0
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 2.6.3
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 3.0.3
81
+ requirements: []
82
+ rubygems_version: 3.0.3
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: 'This tiny project just tries to create some autostart-related files. I dont
86
+ think it will be too useful for others though. If you have specific suggestions
87
+ to make this gem more useful for others, please drop me an email at: shevegen@gmail.com Thank
88
+ you.'
89
+ test_files: []