open 0.1.30 → 0.2.13

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.

Potentially problematic release.


This version of open might be problematic. Click here for more details.

Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +73 -9
  3. data/bin/open +1 -1
  4. data/bin/open_in_browser +1 -1
  5. data/doc/README.gen +72 -8
  6. data/doc/deprecated_code/deprecated_code.md +26 -0
  7. data/img/open_logo.png +0 -0
  8. data/lib/open/base/base.rb +262 -122
  9. data/lib/open/books/README.md +8 -0
  10. data/lib/open/books/books.rb +99 -0
  11. data/lib/open/constants/constants.rb +85 -8
  12. data/lib/open/in_browser/in_browser.rb +476 -304
  13. data/lib/open/in_editor/in_editor.rb +348 -155
  14. data/lib/open/last/last.rb +14 -12
  15. data/lib/open/nano_open/nano_open.rb +4 -3
  16. data/lib/open/{open.rb → open/open.rb} +597 -653
  17. data/lib/open/project/project.rb +3 -2
  18. data/lib/open/requires/failsafe_require_of_beautiful_url.rb +9 -0
  19. data/lib/open/requires/require_the_project.rb +2 -2
  20. data/lib/open/requires/require_yaml.rb +13 -0
  21. data/lib/open/these_files/these_files.rb +1 -1
  22. data/lib/open/toplevel_methods/browser.rb +71 -0
  23. data/lib/open/toplevel_methods/delay.rb +23 -0
  24. data/lib/open/toplevel_methods/e.rb +14 -0
  25. data/lib/open/toplevel_methods/editor.rb +41 -0
  26. data/lib/open/toplevel_methods/host_os.rb +25 -0
  27. data/lib/open/toplevel_methods/is_on_roebe.rb +16 -0
  28. data/lib/open/toplevel_methods/is_on_windows.rb +26 -0
  29. data/lib/open/toplevel_methods/misc.rb +50 -0
  30. data/lib/open/version/version.rb +2 -2
  31. data/lib/open/with_delay/with_delay.rb +9 -11
  32. data/open.gemspec +1 -1
  33. data/test/testing_open.rb +1 -1
  34. data/test/testing_open_in_browser.rb +16 -0
  35. data/test/testing_open_via_launchy.rb +3 -0
  36. data/test/testing_shortcuts.rb +3 -0
  37. metadata +24 -8
  38. data/lib/open/toplevel_code/toplevel_code.rb +0 -189
@@ -40,7 +40,8 @@ module Open
40
40
  # ========================================================================= #
41
41
  # === MY_DATA
42
42
  #
43
- # This is functionality equivalent to the String '/home/x/data/'.
43
+ # This is functionality equivalent to the String '/home/x/data/'. It is
44
+ # only really useful for my own home setup.
44
45
  # ========================================================================= #
45
46
  MY_DATA = "#{HOME_DIRECTORY_OF_USER_X}data/"
46
47
  DATA_DIRECTORY_AT_HOME = MY_DATA # === DATA_DIRECTORY_AT_HOME
@@ -49,7 +50,8 @@ module Open
49
50
  # === N_DELAY
50
51
  #
51
52
  # This delay is specifically used for delaying before batch-opening
52
- # files via the Open.in_editor() functionality.
53
+ # files via the Open.in_editor() functionality. It does not apply
54
+ # to the Open.in_browser() functionality.
53
55
  # ========================================================================= #
54
56
  N_DELAY = 0.48
55
57
 
@@ -105,19 +107,94 @@ module Open
105
107
  # ========================================================================= #
106
108
  # === USE_THIS_BROWSER
107
109
  # ========================================================================= #
108
- if File.exist?(Dir.home+'/use_this_browser.yml') # First check the home directory of the user.
109
- USE_THIS_BROWSER = YAML.load_file(Dir.home+'/use_this_browser.yml')
110
+ if File.exist?("#{Dir.home}/use_this_browser.yml") # First check the home directory of the user.
111
+ USE_THIS_BROWSER = YAML.load_file("#{Dir.home}/use_this_browser.yml")
110
112
  elsif File.exist?(LOCATION_OF_BROWSER_YAML_FILE)
111
113
  USE_THIS_BROWSER = YAML.load_file(LOCATION_OF_BROWSER_YAML_FILE)
112
114
  else # else use a hardcoded default
113
115
  USE_THIS_BROWSER = 'firefox' # palemoon or chrome may be options too
114
116
  end
115
117
 
118
+ # ========================================================================= #
119
+ # === ARRAY_EXTENSIONS_THAT_CAN_BE_OPENED_IN_THE_EDITOR
120
+ #
121
+ # All extensions that can be opened in the editor should be registered
122
+ # in this constant.
123
+ #
124
+ # For example, "h" means ".h" aka a C or C++ header file.
125
+ # ========================================================================= #
126
+ ARRAY_EXTENSIONS_THAT_CAN_BE_OPENED_IN_THE_EDITOR = %w(
127
+ php
128
+ rb
129
+ txt
130
+ yaml
131
+ yml
132
+ cgi
133
+ md
134
+ gemspec
135
+ html
136
+ csv
137
+ py
138
+ conf
139
+ c
140
+ sh
141
+ js
142
+ log
143
+ css
144
+ cr
145
+ ascii
146
+ la
147
+ pl
148
+ perl
149
+ java
150
+ json
151
+ js
152
+ fasta
153
+ fa
154
+ m3u
155
+ cpp
156
+ go
157
+ gff
158
+ gff3
159
+ gen
160
+ h
161
+ erb
162
+ sinatra
163
+ sql
164
+ ).sort << '' # The last part is for files like "TODO" which lack an extension.
165
+
166
+ # ========================================================================= #
167
+ # === ARRAY_VIDEOS
168
+ # ========================================================================= #
169
+ ARRAY_VIDEOS = %w(
170
+ vob
171
+ avi
172
+ flv
173
+ mp3
174
+ mp4
175
+ )
176
+
177
+ # ========================================================================= #
178
+ # === ARRAY_IMAGES
179
+ #
180
+ # All file-extensions for images can be registered in this Array.
181
+ # ========================================================================= #
182
+ ARRAY_IMAGES = %w(
183
+ png
184
+ jpg
185
+ gif
186
+ jpeg
187
+ tiff
188
+ tif
189
+ bmp
190
+ )
191
+
116
192
  end
117
193
 
118
194
  if __FILE__ == $PROGRAM_NAME
119
- puts Open::MY_DATA
120
- puts Open::LOCATION_OF_BROWSER_YAML_FILE
121
- puts Open::USE_THIS_EDITOR
122
- puts Open::USE_THIS_BROWSER
195
+ alias e puts
196
+ e Open::MY_DATA
197
+ e Open::LOCATION_OF_BROWSER_YAML_FILE
198
+ e Open::USE_THIS_EDITOR
199
+ e Open::USE_THIS_BROWSER
123
200
  end