Class: AtticCleanup::Utility
- Inherits:
-
Thor
- Object
- Thor
- AtticCleanup::Utility
- Includes:
- Thor::Actions
- Defined in:
- lib/attic-cleanup/utility.rb
Instance Method Summary collapse
- #default(input) ⇒ Object
- #ignore(input) ⇒ Object
- #new ⇒ Object
-
#shortcuts ⇒ Object
Show all the availible shortcuts from the custom_paths.txt file.
- #store(location = "", destination = "") ⇒ Object
Instance Method Details
#default(input) ⇒ Object
64 65 66 67 68 |
# File 'lib/attic-cleanup/utility.rb', line 64 def default(input) c = AtticCleanup::Path::Custom.new input = c.check_shortcut(input) AtticCleanup::Path::Custom.set_default(input) end |
#ignore(input) ⇒ Object
71 72 73 |
# File 'lib/attic-cleanup/utility.rb', line 71 def ignore(input) AtticCleanup::Path::Custom.set_ignore(input) end |
#new ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/attic-cleanup/utility.rb', line 50 def new if [:path] != "path" && [:path] && [:name] != "name" && [:name] c = AtticCleanup::Path::Custom.new # Sets name and path, adds it to the custom_paths.txt file c.name = [:name] c.path = [:path] c.file = MyAttic::CUSTOM c.write else puts "Please enter a path and name" end end |
#shortcuts ⇒ Object
Show all the availible shortcuts from the custom_paths.txt file
77 78 79 80 81 |
# File 'lib/attic-cleanup/utility.rb', line 77 def shortcuts MyAttic::SHORTCUTS.each do |s| puts s end end |
#store(location = "", destination = "") ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/attic-cleanup/utility.rb', line 16 def store(location="", destination="") # Checks if the options are set if [:a] a = true end if [:f] f = true end # The input is the location, if the input had an @ sign # at the beginning, the custom path will be stored in input variable c = AtticCleanup::Path::Custom.new s = AtticCleanup::Storage::StoreFiles.new if destination != nil && destination != "" destination = c.check_shortcut(destination) s.destination = destination s.check = destination else destination = MyAttic::TODAY s.destination = destination s.check = s.destination end location = c.check_shortcut(location) s.location = location location = s.location s.check = location s.store(a, f) end |