tender_summary 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
@@ -0,0 +1,33 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ tender_summary (1.1.0)
5
+ actionmailer (~> 2.3.5)
6
+ addressable (~> 2.1.1)
7
+ httparty (~> 0.4.5)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ actionmailer (2.3.10)
13
+ actionpack (= 2.3.10)
14
+ actionpack (2.3.10)
15
+ activesupport (= 2.3.10)
16
+ rack (~> 1.1.0)
17
+ activesupport (2.3.10)
18
+ addressable (2.1.2)
19
+ crack (0.1.8)
20
+ httparty (0.4.5)
21
+ crack (>= 0.1.1)
22
+ rack (1.1.0)
23
+ shoulda (2.11.3)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ actionmailer (~> 2.3.5)
30
+ addressable (~> 2.1.1)
31
+ httparty (~> 0.4.5)
32
+ shoulda
33
+ tender_summary!
@@ -1,4 +1,4 @@
1
- = Tender Summary
1
+ # Tender Summary
2
2
 
3
3
  Use this with cron or launchd to send summary emails of your Tender
4
4
  discussions.
@@ -6,36 +6,36 @@ discussions.
6
6
  It will include all pending discussions in the email.
7
7
 
8
8
 
9
- == Installation
9
+ ## Installation
10
10
 
11
11
  To install, just run:
12
12
 
13
- $ sudo gem install tender_summary
13
+ $ sudo gem install tender_summary
14
14
 
15
15
 
16
- == Usage
16
+ ## Usage
17
17
 
18
18
  An example crontab entry:
19
19
 
20
- 0 9 * * * tender_summary -s tenderaccount -u robot@tenderaccount.com -p XXXX6zxY7b -t eric@tenderaccount.com -f 'Support <support@tenderaccount.com>'
20
+ 0 9 * * * tender_summary -s tenderaccount -u robot@tenderaccount.com -p XXXX6zxY7b -t eric@tenderaccount.com -f 'Support <support@tenderaccount.com>'
21
21
 
22
22
  Note: The password for the account will be visible in the system process
23
23
  table when the program is running.
24
24
 
25
25
 
26
- == Inspiration
26
+ ## Inspiration
27
27
 
28
28
  The styling used and inspiration was taken from the
29
- {Basecamp}[http://www.basecamphq.com] daily summary emails. They look
29
+ [Basecamp][http://www.basecamphq.com] daily summary emails. They look
30
30
  really nice.
31
31
 
32
32
 
33
- == TODO
33
+ ## TODO
34
34
 
35
35
  * Add command line option for customized view
36
36
 
37
37
 
38
- == Note on Patches/Pull Requests
38
+ ## Note on Patches/Pull Requests
39
39
 
40
40
  * Fork the project.
41
41
  * Make your feature addition or bug fix.
@@ -46,6 +46,6 @@ really nice.
46
46
  * Send me a pull request. Bonus points for topic branches.
47
47
 
48
48
 
49
- == Copyright
49
+ ## Copyright
50
50
 
51
51
  Copyright (c) 2009 Eric Lindvall. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,28 +1,50 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
+ require 'date'
3
4
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "tender_summary"
8
- gem.summary = %Q{A simple tool to email your pending Tender discussions}
9
- gem.description = %Q{A simple tool to email your pending Tender discussions.}
10
- gem.email = "eric@sevenscale.com"
11
- gem.homepage = "http://github.com/eric/tender_summary"
12
- gem.authors = ["Eric Lindvall"]
13
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
- gem.add_development_dependency "yard", ">= 0"
15
- gem.add_dependency 'httparty', '~> 0.4.5'
16
- gem.add_dependency 'addressable', '~> 2.1.1'
17
- gem.add_dependency 'actionmailer', '~> 2.3.5'
18
-
19
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
20
- end
21
- Jeweler::GemcutterTasks.new
22
- rescue LoadError
23
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
5
+ #############################################################################
6
+ #
7
+ # Helper functions
8
+ #
9
+ #############################################################################
10
+
11
+ def name
12
+ @name ||= Dir['*.gemspec'].first.split('.').first
13
+ end
14
+
15
+ def version
16
+ line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
17
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
18
+ end
19
+
20
+ def date
21
+ Date.today.to_s
22
+ end
23
+
24
+ def rubyforge_project
25
+ name
26
+ end
27
+
28
+ def gemspec_file
29
+ "#{name}.gemspec"
30
+ end
31
+
32
+ def gem_file
33
+ "#{name}-#{version}.gem"
34
+ end
35
+
36
+ def replace_header(head, header_name)
37
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
24
38
  end
25
39
 
40
+ #############################################################################
41
+ #
42
+ # Standard tasks
43
+ #
44
+ #############################################################################
45
+
46
+ task :default => :test
47
+
26
48
  require 'rake/testtask'
27
49
  Rake::TestTask.new(:test) do |test|
28
50
  test.libs << 'lib' << 'test'
@@ -30,28 +52,99 @@ Rake::TestTask.new(:test) do |test|
30
52
  test.verbose = true
31
53
  end
32
54
 
33
- begin
34
- require 'rcov/rcovtask'
35
- Rcov::RcovTask.new do |test|
36
- test.libs << 'test'
37
- test.pattern = 'test/**/test_*.rb'
38
- test.verbose = true
39
- end
40
- rescue LoadError
41
- task :rcov do
42
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
55
+ desc "Generate RCov test coverage and open in your browser"
56
+ task :coverage do
57
+ require 'rcov'
58
+ sh "rm -fr coverage"
59
+ sh "rcov test/test_*.rb"
60
+ sh "open coverage/index.html"
61
+ end
62
+
63
+ require 'rake/rdoctask'
64
+ Rake::RDocTask.new do |rdoc|
65
+ rdoc.rdoc_dir = 'rdoc'
66
+ rdoc.title = "#{name} #{version}"
67
+ rdoc.rdoc_files.include('README*')
68
+ rdoc.rdoc_files.include('lib/**/*.rb')
69
+ end
70
+
71
+ desc "Open an irb session preloaded with this library"
72
+ task :console do
73
+ sh "irb -rubygems -r ./lib/#{name}.rb"
74
+ end
75
+
76
+ #############################################################################
77
+ #
78
+ # Custom tasks (add your own tasks here)
79
+ #
80
+ #############################################################################
81
+
82
+
83
+
84
+ #############################################################################
85
+ #
86
+ # Packaging tasks
87
+ #
88
+ #############################################################################
89
+
90
+ desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
91
+ task :release => :build do
92
+ unless `git branch` =~ /^\* master$/
93
+ puts "You must be on the master branch to release!"
94
+ exit!
43
95
  end
96
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
97
+ sh "git tag v#{version}"
98
+ sh "git push origin master"
99
+ sh "git push origin v#{version}"
100
+ sh "gem push pkg/#{name}-#{version}.gem"
101
+ end
102
+
103
+ desc "Build #{gem_file} into the pkg directory"
104
+ task :build => :gemspec do
105
+ sh "mkdir -p pkg"
106
+ sh "gem build #{gemspec_file}"
107
+ sh "mv #{gem_file} pkg"
44
108
  end
45
109
 
46
- task :test => :check_dependencies
110
+ desc "Generate #{gemspec_file}"
111
+ task :gemspec => :validate do
112
+ # read spec file and split out manifest section
113
+ spec = File.read(gemspec_file)
114
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
47
115
 
48
- task :default => :test
116
+ # replace name version and date
117
+ replace_header(head, :name)
118
+ replace_header(head, :version)
119
+ replace_header(head, :date)
120
+ #comment this out if your rubyforge_project has a different name
121
+ replace_header(head, :rubyforge_project)
49
122
 
50
- begin
51
- require 'yard'
52
- YARD::Rake::YardocTask.new
53
- rescue LoadError
54
- task :yardoc do
55
- abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
123
+ # determine file list from git ls-files
124
+ files = `git ls-files`.
125
+ split("\n").
126
+ sort.
127
+ reject { |file| file =~ /^\./ }.
128
+ reject { |file| file =~ /^(rdoc|pkg)/ }.
129
+ map { |file| " #{file}" }.
130
+ join("\n")
131
+
132
+ # piece file back together and write
133
+ manifest = " s.files = %w[\n#{files}\n ]\n"
134
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
135
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
136
+ puts "Updated #{gemspec_file}"
137
+ end
138
+
139
+ desc "Validate #{gemspec_file}"
140
+ task :validate do
141
+ libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
142
+ unless libfiles.empty?
143
+ puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
144
+ exit!
145
+ end
146
+ unless Dir['VERSION*'].empty?
147
+ puts "A `VERSION` file at root level violates Gem best practices."
148
+ exit!
56
149
  end
57
150
  end
@@ -5,4 +5,8 @@ require 'httparty'
5
5
  require 'optparse'
6
6
  require 'tender_summary/cli'
7
7
  require 'tender_summary/tender_api'
8
- require 'tender_summary/mailer'
8
+ require 'tender_summary/mailer'
9
+
10
+ module TenderSummary
11
+ VERSION = '1.2.0'
12
+ end
@@ -1,7 +1,7 @@
1
1
 
2
2
  module TenderSummary
3
3
  class Cli
4
- attr_accessor :to, :from
4
+ attr_accessor :to, :from, :output
5
5
 
6
6
  def initialize(argv)
7
7
  @argv = argv.dup
@@ -10,7 +10,14 @@ module TenderSummary
10
10
  def run
11
11
  self.parse
12
12
 
13
- TenderSummary::Mailer.deliver_pending(self.to, self.from)
13
+ if output.present?
14
+ mail = TenderSummary::Mailer.create_pending(self.to, self.from)
15
+ open(output, 'w') do |io|
16
+ io << mail.parts.first.body
17
+ end
18
+ else
19
+ TenderSummary::Mailer.deliver_pending(self.to, self.from)
20
+ end
14
21
  end
15
22
 
16
23
  def parse
@@ -40,6 +47,10 @@ module TenderSummary
40
47
  self.from = n
41
48
  end
42
49
 
50
+ opts.on("-o", "--output FILE", "Output HTML to file instead of sending") do |n|
51
+ self.output = n
52
+ end
53
+
43
54
  opts.separator " "
44
55
  opts.separator "Common options:"
45
56
 
@@ -26,13 +26,22 @@
26
26
  <tbody><tr>
27
27
  <td style="padding-left: 20px;">
28
28
 
29
- <%- @discussions.each do |discussion| -%>
30
- <p style="font-weight: normal; font-size: 14px; color: rgb(0, 0, 0); margin-bottom: 2px; padding-bottom: 0pt;">
29
+ <%- @discussions.reverse.each do |discussion| -%>
30
+ <p style="font-weight: normal; font-size: 14px; color: #000; margin-bottom: 2px; padding-bottom: 0pt;">
31
31
  <span style="margin:0 3px; padding:2px 7px 3px 7px; font-size:10px; font-weight:normal; background:#eee; color:#666; text-transform:uppercase; -webkit-border-radius:3px; -moz-border-radius:2px; white-space:nowrap;">
32
32
  <%= discussion['state'] %>
33
33
  </span>
34
34
 
35
- <a target="_blank" href="<%= discussion.href(:html) %>"><%= discussion["title"] %></a>
35
+ <%- if discussion['last_updated_at'] < 1.day.ago -%>
36
+ <a target="_blank" style="color: rgb(204, 51, 51);" href="<%= discussion.href(:html) %>">
37
+ <%- else -%>
38
+ <a target="_blank" href="<%= discussion.href(:html) %>">
39
+ <%- end -%>
40
+
41
+ <% if discussion['unread'] %><strong><% end %>
42
+ <%= discussion["title"] %>
43
+ <% if discussion['unread'] %></strong><% end %>
44
+ </a>
36
45
  </p>
37
46
  <table>
38
47
  <tbody><tr>
@@ -0,0 +1,80 @@
1
+ ## This is the rakegem gemspec template. Make sure you read and understand
2
+ ## all of the comments. Some sections require modification, and others can
3
+ ## be deleted if you don't need them. Once you understand the contents of
4
+ ## this file, feel free to delete any comments that begin with two hash marks.
5
+ ## You can find comprehensive Gem::Specification documentation, at
6
+ ## http://docs.rubygems.org/read/chapter/20
7
+ Gem::Specification.new do |s|
8
+ s.specification_version = 2 if s.respond_to? :specification_version=
9
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.rubygems_version = '1.3.5'
11
+
12
+ ## Leave these as is they will be modified for you by the rake gemspec task.
13
+ ## If your rubyforge_project name is different, then edit it and comment out
14
+ ## the sub! line in the Rakefile
15
+ s.name = 'tender_summary'
16
+ s.version = '1.2.0'
17
+ s.date = '2010-12-09'
18
+ s.rubyforge_project = 'tender_summary'
19
+
20
+ ## Make sure your summary is short. The description may be as long
21
+ ## as you like.
22
+ s.summary = "A simple tool to email your pending Tender discussions"
23
+ s.description = "A simple tool to email your pending Tender discussions"
24
+
25
+ ## List the primary authors. If there are a bunch of authors, it's probably
26
+ ## better to set the email to an email list or something. If you don't have
27
+ ## a custom homepage, consider using your GitHub URL or the like.
28
+ s.authors = ["Eric Lindvall"]
29
+ s.email = 'eric@5stops.com'
30
+ s.homepage = 'http://example.com/NAME'
31
+
32
+ ## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
33
+ ## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
34
+ s.require_paths = %w[lib]
35
+
36
+ ## If your gem includes any executables, list them here.
37
+ s.executables = ["tender_summary"]
38
+ s.default_executable = 'tender_summary'
39
+
40
+ ## Specify any RDoc options here. You'll want to add your README and
41
+ ## LICENSE files to the extra_rdoc_files list.
42
+ s.rdoc_options = ["--charset=UTF-8"]
43
+ s.extra_rdoc_files = %w[README.md LICENSE]
44
+
45
+ ## List your runtime dependencies here. Runtime dependencies are those
46
+ ## that are needed for an end user to actually USE your code.
47
+ s.add_dependency('httparty', '~> 0.4.5')
48
+ s.add_dependency('addressable', '~> 2.1.1')
49
+ s.add_dependency('actionmailer', '~> 2.3.5')
50
+
51
+ ## List your development dependencies here. Development dependencies are
52
+ ## those that are only needed during development
53
+ s.add_development_dependency('shoulda')
54
+
55
+ ## Leave this section as-is. It will be automatically generated from the
56
+ ## contents of your Git repository via the gemspec task. DO NOT REMOVE
57
+ ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
58
+ # = MANIFEST =
59
+ s.files = %w[
60
+ Gemfile
61
+ Gemfile.lock
62
+ LICENSE
63
+ README.md
64
+ Rakefile
65
+ bin/tender_summary
66
+ lib/tender_summary.rb
67
+ lib/tender_summary/cli.rb
68
+ lib/tender_summary/mailer.rb
69
+ lib/tender_summary/templates/mailer/pending.text.html.erb
70
+ lib/tender_summary/tender_api.rb
71
+ tender_summary.gemspec
72
+ test/helper.rb
73
+ test/test_tender_summary.rb
74
+ ]
75
+ # = MANIFEST =
76
+
77
+ ## Test files will be grabbed from the file list. Make sure the path glob
78
+ ## matches what you actually use.
79
+ s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
80
+ end
@@ -4,7 +4,7 @@ require 'shoulda'
4
4
 
5
5
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
6
  $LOAD_PATH.unshift(File.dirname(__FILE__))
7
- require 'tender-summary'
7
+ require 'tender_summary'
8
8
 
9
9
  class Test::Unit::TestCase
10
10
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tender_summary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 2
9
+ - 0
10
+ version: 1.2.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Eric Lindvall
@@ -9,85 +15,97 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-12-19 00:00:00 -08:00
18
+ date: 2010-12-09 00:00:00 -08:00
13
19
  default_executable: tender_summary
14
20
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: thoughtbot-shoulda
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: yard
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
21
  - !ruby/object:Gem::Dependency
36
22
  name: httparty
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
40
26
  requirements:
41
27
  - - ~>
42
28
  - !ruby/object:Gem::Version
29
+ hash: 5
30
+ segments:
31
+ - 0
32
+ - 4
33
+ - 5
43
34
  version: 0.4.5
44
- version:
35
+ type: :runtime
36
+ version_requirements: *id001
45
37
  - !ruby/object:Gem::Dependency
46
38
  name: addressable
47
- type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
50
42
  requirements:
51
43
  - - ~>
52
44
  - !ruby/object:Gem::Version
45
+ hash: 9
46
+ segments:
47
+ - 2
48
+ - 1
49
+ - 1
53
50
  version: 2.1.1
54
- version:
51
+ type: :runtime
52
+ version_requirements: *id002
55
53
  - !ruby/object:Gem::Dependency
56
54
  name: actionmailer
57
- type: :runtime
58
- version_requirement:
59
- version_requirements: !ruby/object:Gem::Requirement
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
60
58
  requirements:
61
59
  - - ~>
62
60
  - !ruby/object:Gem::Version
61
+ hash: 9
62
+ segments:
63
+ - 2
64
+ - 3
65
+ - 5
63
66
  version: 2.3.5
64
- version:
65
- description: A simple tool to email your pending Tender discussions.
66
- email: eric@sevenscale.com
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: shoulda
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 3
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ type: :development
82
+ version_requirements: *id004
83
+ description: A simple tool to email your pending Tender discussions
84
+ email: eric@5stops.com
67
85
  executables:
68
86
  - tender_summary
69
87
  extensions: []
70
88
 
71
89
  extra_rdoc_files:
90
+ - README.md
72
91
  - LICENSE
73
- - README.rdoc
74
92
  files:
75
- - .document
76
- - .gitignore
93
+ - Gemfile
94
+ - Gemfile.lock
77
95
  - LICENSE
78
- - README.rdoc
96
+ - README.md
79
97
  - Rakefile
80
- - VERSION
81
98
  - bin/tender_summary
82
99
  - lib/tender_summary.rb
83
100
  - lib/tender_summary/cli.rb
84
101
  - lib/tender_summary/mailer.rb
85
102
  - lib/tender_summary/templates/mailer/pending.text.html.erb
86
103
  - lib/tender_summary/tender_api.rb
104
+ - tender_summary.gemspec
87
105
  - test/helper.rb
88
- - test/test_tender-summary.rb
106
+ - test/test_tender_summary.rb
89
107
  has_rdoc: true
90
- homepage: http://github.com/eric/tender_summary
108
+ homepage: http://example.com/NAME
91
109
  licenses: []
92
110
 
93
111
  post_install_message:
@@ -96,24 +114,29 @@ rdoc_options:
96
114
  require_paths:
97
115
  - lib
98
116
  required_ruby_version: !ruby/object:Gem::Requirement
117
+ none: false
99
118
  requirements:
100
119
  - - ">="
101
120
  - !ruby/object:Gem::Version
121
+ hash: 3
122
+ segments:
123
+ - 0
102
124
  version: "0"
103
- version:
104
125
  required_rubygems_version: !ruby/object:Gem::Requirement
126
+ none: false
105
127
  requirements:
106
128
  - - ">="
107
129
  - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
108
133
  version: "0"
109
- version:
110
134
  requirements: []
111
135
 
112
- rubyforge_project:
113
- rubygems_version: 1.3.5
136
+ rubyforge_project: tender_summary
137
+ rubygems_version: 1.3.7
114
138
  signing_key:
115
- specification_version: 3
139
+ specification_version: 2
116
140
  summary: A simple tool to email your pending Tender discussions
117
141
  test_files:
118
- - test/helper.rb
119
- - test/test_tender-summary.rb
142
+ - test/test_tender_summary.rb
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.1.0