Class: Capuchin::Shell
- Inherits:
-
Object
- Object
- Capuchin::Shell
- Defined in:
- lib/capuchin/shell.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #create(subject) ⇒ Object
-
#initialize(options = {}) ⇒ Shell
constructor
A new instance of Shell.
- #scaffold(path) ⇒ Object
- #schedule(path) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Shell
Returns a new instance of Shell.
5 6 7 |
# File 'lib/capuchin/shell.rb', line 5 def initialize( = {}) = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/capuchin/shell.rb', line 3 def end |
Instance Method Details
#create(subject) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/capuchin/shell.rb', line 27 def create(subject) slug = slugify(subject) filename = "#{Time.now.strftime('%Y-%m-%d')}-#{slug}.md" File.open(File.join("_emails", filename), 'w') do |f| f.write "---\nsubject: \"\#{subject}\"\n---\n\nWrite your kick-ass content here!\n" end puts "Created _emails/#{filename}" end |
#scaffold(path) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/capuchin/shell.rb', line 18 def scaffold(path) directory_path = File.(path, Dir.pwd) FileUtils.mkdir_p(directory_path) FileUtils.cp_r sample_directory + '/.', directory_path puts "Capuchin directory structure created in #{directory_path}" end |
#schedule(path) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/capuchin/shell.rb', line 9 def schedule(path) dir = File.dirname(path) filename = File.basename(path) email = Capuchin::Email.new(dir, filename) puts Capuchin::Scheduler.new(email, ).schedule end |