-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
192 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
--color | ||
--format d | ||
--order random | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Metrics: | ||
Enabled: false | ||
|
||
Style/AccessModifierIndentation: | ||
EnforcedStyle: outdent | ||
|
||
Style/SafeNavigation: | ||
Enabled: false | ||
|
||
Style/StringLiterals: | ||
EnforcedStyle: double_quotes | ||
|
||
Style/TrailingCommaInArguments: | ||
EnforcedStyleForMultiline: comma | ||
|
||
Style/TrailingCommaInLiteral: | ||
EnforcedStyleForMultiline: comma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
source 'https://rubygems.org' | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
# Specify your gem's dependencies in imap_guard.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
# More info at https://github.com/guard/guard#readme | ||
|
||
guard 'rspec' do | ||
guard "rspec" do | ||
watch(%r{^spec/.+_spec\.rb$}) | ||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | ||
watch(%r{^lib/(.+)/(.+)\.rb$}) { |m| "spec/#{m[1]}/#{m[2]}_spec.rb" } | ||
watch('spec/spec_helper.rb') { "spec" } | ||
watch("spec/spec_helper.rb") { "spec" } | ||
watch(%r{^spec/support/.+\.rb$}) { "spec" } | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
require "bundler/gem_tasks" | ||
require "rspec/core/rake_task" | ||
require "rubocop/rake_task" | ||
|
||
RSpec::Core::RakeTask.new(:spec) do |t| | ||
t.ruby_opts = '-w' | ||
t.ruby_opts = "-w" | ||
end | ||
|
||
task default: :spec | ||
RuboCop::RakeTask.new(:rubocop) | ||
|
||
task default: [:spec, :rubocop] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,45 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'imap_guard' | ||
# frozen_string_literal: true | ||
# rubocop:disable all | ||
|
||
require "imap_guard" | ||
|
||
SETTINGS = { | ||
host: 'imap.googlemail.com', | ||
host: "imap.googlemail.com", | ||
port: 993, | ||
username: 'you@gmail.com', | ||
password: 'your_pass', | ||
} | ||
username: "you@gmail.com", | ||
password: "your_pass", | ||
}.freeze | ||
|
||
settings = SETTINGS.merge({ read_only: false }) | ||
settings = SETTINGS.merge(read_only: false) | ||
base_query = ImapGuard::Query.new.unflagged.unanswered.freeze | ||
guard = ImapGuard::Guard.new settings | ||
# guard.debug = ->(mail) { print "#{mail.subject}: " } | ||
guard.login | ||
|
||
guard.select 'INBOX' | ||
guard.select "INBOX" | ||
|
||
# Github | ||
%w(github.com notifications@travis-ci.org app@gemnasium.com).map do |from| | ||
base_query.dup.from(from) | ||
end.each do |query| | ||
guard.move query, 'INBOX.Github' | ||
guard.move query, "INBOX.Github" | ||
end | ||
|
||
# To Do | ||
guard.move base_query.dup.from("me").to("me"), 'INBOX.TODO' | ||
guard.move base_query.dup.from("me").to("me"), "INBOX.TODO" | ||
|
||
# Ops | ||
guard.select 'INBOX.Ops' | ||
guard.select "INBOX.Ops" | ||
query = base_query.dup.seen | ||
guard.delete query.dup.subject("monit alert -- ").before(7) | ||
guard.delete query.dup.subject("CRON-APT completed on ").before(3) | ||
guard.delete query.dup.subject("Logwatch for ").before(7) | ||
guard.select 'INBOX' | ||
guard.select "INBOX" | ||
|
||
# Uni | ||
guard.move base_query.dup.or.from("uni.tld").to("uni.tld"), 'INBOX.Uni' | ||
guard.move base_query.dup.or.from("uni.tld").to("uni.tld"), "INBOX.Uni" | ||
|
||
# Bye! | ||
guard.disconnect | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
# coding: utf-8 | ||
lib = File.expand_path('../lib', __FILE__) | ||
# frozen_string_literal: true | ||
|
||
lib = File.expand_path("../lib", __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "imap_guard" | ||
spec.version = "1.0.0" | ||
spec.version = "1.1.0" | ||
spec.authors = ["Cédric Félizard"] | ||
spec.email = ["cedric@felizard.fr"] | ||
spec.description = %q{A guard for your IMAP server} | ||
spec.description = "A guard for your IMAP server" | ||
spec.summary = spec.description | ||
spec.homepage = "https://github.com/infertux/imap_guard" | ||
spec.license = "MIT" | ||
|
||
spec.files = `git ls-files`.split($/) | ||
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) | ||
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } | ||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) | ||
spec.require_paths = ["lib"] | ||
|
||
spec.add_dependency 'mail', '>= 2.5.3' | ||
spec.add_dependency 'term-ansicolor', '>= 1.2.2' | ||
spec.add_dependency "mail", ">= 2.5.3" | ||
spec.add_dependency "term-ansicolor", ">= 1.2.2" | ||
|
||
spec.add_development_dependency 'bundler', '>= 1.3' | ||
spec.add_development_dependency 'rake' | ||
spec.add_development_dependency 'simplecov' | ||
spec.add_development_dependency 'rspec' | ||
spec.add_development_dependency 'guard-rspec' | ||
spec.add_development_dependency 'rb-inotify' | ||
spec.add_development_dependency 'cane' | ||
spec.add_development_dependency 'yard' | ||
spec.add_development_dependency 'redcarpet' # for yardoc | ||
spec.add_development_dependency "bundler", ">= 1.3" | ||
spec.add_development_dependency "rake" | ||
spec.add_development_dependency "rubocop" | ||
spec.add_development_dependency "simplecov" | ||
spec.add_development_dependency "rspec" | ||
spec.add_development_dependency "cane" | ||
spec.add_development_dependency "yard" | ||
spec.add_development_dependency "redcarpet" # for yardoc | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require "imap_guard/guard" | ||
require "imap_guard/query" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.