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
@@ -21,11 +21,6 @@ class Last < Base # === Open::Last
21
21
 
22
22
  require 'open/in_editor/in_editor.rb'
23
23
 
24
- # ========================================================================= #
25
- # === NAMESPACE
26
- # ========================================================================= #
27
- NAMESPACE = inspect
28
-
29
24
  # ========================================================================= #
30
25
  # === BY_DEFAULT_OPEN_N_FILES
31
26
  # ========================================================================= #
@@ -48,10 +43,7 @@ class Last < Base # === Open::Last
48
43
  # ========================================================================= #
49
44
  def reset
50
45
  super()
51
- # ======================================================================= #
52
- # === @namespace
53
- # ======================================================================= #
54
- @namespace = NAMESPACE
46
+ infer_the_namespace
55
47
  end
56
48
 
57
49
  # ========================================================================= #
@@ -84,12 +76,12 @@ class Last < Base # === Open::Last
84
76
  # === open_these_target_files
85
77
  # ========================================================================= #
86
78
  def open_these_target_files(
87
- i = @target_files
79
+ i = target_files?
88
80
  )
89
81
  if i.is_a? Array
90
82
  i.each {|entry| open_these_target_files(entry) }
91
83
  else
92
- opnn; e "Now opening `#{sfile(i)}`."
84
+ opne "Now opening `#{sfile(i)}`."
93
85
  Open.in_editor(i)
94
86
  end
95
87
  end
@@ -102,7 +94,7 @@ class Last < Base # === Open::Last
102
94
  # Sort by date next. Could also use a pure ruby implementation there.
103
95
  # ======================================================================= #
104
96
  result = `ls -tl --quoting-style=literal`.split("\n")
105
- result.reject! {|entry| entry.include? 'total' }
97
+ result.reject! {|entry| entry.include? 'total ' } # This skips the first row really.
106
98
  result.map! {|entry|
107
99
  if entry.include? ' '
108
100
  splitted = entry.split(' ')
@@ -115,11 +107,21 @@ class Last < Base # === Open::Last
115
107
  entry
116
108
  }
117
109
  result.select! {|entry| File.file? entry }
110
+ # ======================================================================= #
111
+ # Grab the first entry next - this is our most recently modified file:
112
+ # ======================================================================= #
118
113
  open_these_entries = result[0 .. (open_n_files?.to_i - 1) ]
119
114
  @target_files = open_these_entries
120
115
  open_these_target_files(@target_files)
121
116
  end
122
117
 
118
+ # ========================================================================= #
119
+ # === target_files?
120
+ # ========================================================================= #
121
+ def target_files?
122
+ @target_files
123
+ end
124
+
123
125
  # ========================================================================= #
124
126
  # === Open::Last[]
125
127
  # ========================================================================= #
@@ -47,10 +47,11 @@ class NanoOpen < Base # === Open::NanoOpen
47
47
  def run
48
48
  _ = first_argument?
49
49
  if is_on_roebe?
50
- require 'studium'
50
+ require 'studium/toplevel_methods/find_exam_topic_and_exam_title.rb'
51
51
  new_target = Studium.find_corresponding_exam_topic(_)
52
- unless new_target == _
53
- _ = Studium.directory_to_the_exam_topics+new_target
52
+ possible_new_target = "#{Studium.directory_to_the_exam_topics}#{new_target}"
53
+ if File.exist?(possible_new_target)
54
+ _ = possible_new_target
54
55
  end
55
56
  end
56
57
  ::Open.in_editor {{