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(input = "") ⇒ Object
Instance Method Details
#default(input) ⇒ Object
58 59 60 |
# File 'lib/attic-cleanup/utility.rb', line 58 def default(input) AtticCleanup::Path::Custom.set_default(input) end |
#ignore(input) ⇒ Object
63 64 65 |
# File 'lib/attic-cleanup/utility.rb', line 63 def ignore(input) AtticCleanup::Path::Custom.set_ignore(input) end |
#new ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/attic-cleanup/utility.rb', line 44 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
68 69 70 71 72 |
# File 'lib/attic-cleanup/utility.rb', line 68 def shortcuts MyAttic::SHORTCUTS.each do |s| puts s end end |
#store(input = "") ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/attic-cleanup/utility.rb', line 13 def store(input="") # Checks if the options are set if [:a] a = true end if [:f] f = true end # If the input for store has an "@" at the beginning # it's a shortcut. if input[0..0] == "@" c = AtticCleanup::Path::Custom.new # The input without the first character (the @ sign) c.name = input[1..-1] c.file = MyAttic::CUSTOM input = c.find_custom end # The input is the location, if the input had an @ sign # at the beginning, the custom path will be stored in input variable s = AtticCleanup::Storage::StoreFiles.new s.location = input s.check s.store(a, f) end |