Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi! I cleaned up your code for you! #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Copyright 2008-2009 Jérôme Bousquié
Copyright 2009 Montana State University

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
20 changes: 10 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# -*- ruby -*-

require 'rubygems'
require 'hoe'
require "spec/rake/spectask"
require './lib/gdata'

class Hoe
def extra_deps; @extra_deps.reject { |x| Array(x).first == "hoe" } end
end # copied from the Rakefile of the sup project

Hoe.new('gdata2', "0.1") do |p|
p.rubyforge_name = 'gdata2'
p.author = 'Ivan R. Judson'
Expand All @@ -19,8 +19,8 @@ Hoe.new('gdata2', "0.1") do |p|
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
p.remote_rdoc_dir = ''
end


RDOC_OPTS = [
'--quiet',
'--title', 'gdata2 APIs',
Expand All @@ -30,7 +30,7 @@ RDOC_OPTS = [
'--tab-width', '2',
'--line-numbers',
]

Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'doc/'
rdoc.options = RDOC_OPTS
Expand All @@ -42,21 +42,21 @@ Rake::RDocTask.new do |rdoc|
'lib/**/*.rb'
]
end

# desc "Run all specs"
# Spec::Rake::SpecTask.new do |t|
# t.spec_files = FileList["spec/**/*_spec.rb"]
# t.spec_opts = ["--options", "spec/spec.opts"]
# end
#
#
# desc "Run all specs and get coverage statistics"
# Spec::Rake::SpecTask.new('spec:rcov') do |t|
# t.spec_files = FileList["spec/**/*_spec.rb"]
# t.rcov = true
# t.spec_opts = ["--options", "spec/spec.opts"]
# end
#
#
# Rake::Task[:default].prerequisites.clear
# task :default => :spec

# vim: syntax=Ruby
2 changes: 1 addition & 1 deletion bin/createish
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
in order to provision a person you need to set the google enabled flag
in ~/rosterdb.sqlite and what campus you want them to be affiliated with

sqlite3 ~/rosterdb.sqlite
update USERS set google=1,bz=1 where netid like "k67j798";
.exit
Expand Down
6 changes: 3 additions & 3 deletions gdata2.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ Gem::Specification.new do |s|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
s.rdoc_options = ["--main", "README.txt"]
s.remote_rdoc_dir = ''
s.files = ["CREDITS", "History.txt", "Manifest.txt", "README.txt",
"Rakefile", "TODO", "gdata2.gemspec", "lib/gdata.rb",
s.files = ["CREDITS", "History.txt", "Manifest.txt", "README.txt",
"Rakefile", "TODO", "gdata2.gemspec", "lib/gdata.rb",
"lib/gdata/apps/provisioning.rb"]
s.require_paths = ["lib"]
s.rubyforge_project = "gdata2"
s.rubygems_version = "1.3.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2
Expand Down
4 changes: 2 additions & 2 deletions lib/gdata/apps/email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def create_send_as(name, address, replyTo=nil, makeDefault=false)
if replyTo.nil?
replyTo = address
end

self.elements["atom:entry"].add_element "apps:property", { "name" => "name", "value" => name }
self.elements["atom:entry"].add_element "apps:property", { "name" => "address", "value" => address }
self.elements["atom:entry"].add_element "apps:property", { "name" => "address", "value" => address }
self.elements["atom:entry"].add_element "apps:property", { "name" => "replyTo", "value" => replyTo }
self.elements["atom:entry"].add_element "apps:property", { "name" => "makeDefault", "value" => makeDefault.to_s }
end
Expand Down
2 changes: 1 addition & 1 deletion lib/gdata/apps/provisioning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def retrieve_nickname(nickname)
# mynicks.each {|nick| puts nick.nickname }
def retrieve_nicknames(username)
xml_response = @apps.request(:nickname_retrieve_all_for_user, username, @headers)

nicknames_feed = Feed.new(xml_response.elements["feed"], NicknameEntry)
nicknames_feed = add_next_feeds(nicknames_feed, xml_response, NicknameEntry)
end
Expand Down
78 changes: 39 additions & 39 deletions lib/timestamp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,183 +32,183 @@ def time_stamp(time)
end


#
#
#
#
# RSPEC TESTS
# --
#
#
# describe "time_ago_or_time_stamp helper method" do
#
#
# it "should return '–' if time is nil" do
# time = nil
# time_distance_or_time_stamp(time).should =~ /–/
# end
#
#
# it "should return detailed timestamp if distance > 2880 minutes and options[:show_time] = true" do
# base_time = Time.utc(1966,"oct",25,05,35,0)
# time = base_time + (2881*60)
# time_distance_or_time_stamp(time, {:base_time => base_time, :show_time => true}).should =~ /Thu, 27 Oct 1966, 12:00am/
# end
#
#
# it "should not return detailed timestamp if distance > 2880 minutes and options[:show_time] = false" do
# base_time = Time.utc(1966,"oct",25,05,35,0)
# time = base_time + (2881*60)
# time_distance_or_time_stamp(time, {:base_time => base_time, :show_time => false}).should =~ /Thu, 27 Oct 1966/
# end
#
#
# it "should not return detailed timestamp if distance > 2880 minutes and options[:show_time] is not specified" do
# base_time = Time.utc(1966,"oct",25,05,35,0)
# time = base_time + (2881*60)
# time_distance_or_time_stamp(time, {:base_time => base_time}).should =~ /Thu, 27 Oct 1966/
# end
#
#
# it "should return '1 second ago' when 1 second ago" do
# time = 1.second.ago
# time_distance_or_time_stamp(time).should =~ /1 second ago/
# end
#
#
# it "should return '1 second from now' when 1 second from now" do
# time = 1.second.from_now
# time_distance_or_time_stamp(time).should =~ /1 second from now/
# end
#
#
# it "should return '59 second ago' when 59 seconds ago" do
# time = 59.seconds.ago
# time_distance_or_time_stamp(time).should =~ /59 seconds ago/
# end
#
#
# it "should return '59 second from now' when 59 seconds from now" do
# time = 59.seconds.from_now
# time_distance_or_time_stamp(time).should =~ /59 seconds from now/
# end
#
#
# it "should return '1 minute ago' when 1 minute ago" do
# time = 60.seconds.ago
# time_distance_or_time_stamp(time).should =~ /1 minute ago/
# end
#
#
# it "should return '1 minute from now' when 1 minute from now" do
# time = 60.seconds.from_now
# time_distance_or_time_stamp(time).should =~ /1 minute from now/
# end
#
#
# it "should return '2 minutes ago' when 2 minutes ago" do
# time = 2.minutes.ago
# time_distance_or_time_stamp(time).should =~ /2 minutes ago/
# end
#
#
# it "should return '2 minutes from now' when 2 minutes from now" do
# time = 2.minutes.from_now
# time_distance_or_time_stamp(time).should =~ /2 minutes from now/
# end
#
#
# it "should return '59 minutes ago' when 59 minutes ago" do
# time = 59.minutes.ago
# time_distance_or_time_stamp(time).should =~ /59 minutes ago/
# end
#
#
# it "should return '59 minutes from now' when 59 minutes from now" do
# time = 59.minutes.from_now
# time_distance_or_time_stamp(time).should =~ /59 minutes from now/
# end
#
#
# it "should return '1 hour ago' when 1 hour ago" do
# time = 1.hour.ago
# time_distance_or_time_stamp(time).should =~ /1 hour ago/
# end
#
#
# it "should return '1 hour from now' when 1 hour from now" do
# time = 1.hour.from_now
# time_distance_or_time_stamp(time).should =~ /1 hour from now/
# end
#
#
# it "should return '23 hour ago' when 23 hours ago" do
# time = 23.hours.ago
# time_distance_or_time_stamp(time).should =~ /23 hours ago/
# end
#
#
# it "should return '23 hour from now' when 23 hours from now" do
# time = 23.hours.from_now
# time_distance_or_time_stamp(time).should =~ /23 hours from now/
# end
#
#
# it "should return '24 hours ago' when 24 hours ago" do
# time = 24.hours.ago
# time_distance_or_time_stamp(time).should =~ /24 hours ago/
# end
#
#
# it "should return '24 hours from now' when 24 hours from now" do
# time = 24.hours.from_now
# time_distance_or_time_stamp(time).should =~ /24 hours from now/
# end
#
#
# it "should return '1 day ago' when 25 hours ago" do
# time = 25.hours.ago
# time_distance_or_time_stamp(time).should =~ /1 day ago/
# end
#
#
# it "should return '1 day from now' when 25 hours from now" do
# time = 25.hours.from_now
# time_distance_or_time_stamp(time).should =~ /1 day from now/
# end
#
#
# it "should return '1 day ago' when 36 hours ago" do
# time = 36.hours.ago
# time_distance_or_time_stamp(time).should =~ /1 day ago/
# end
#
#
# it "should return '1 day from now' when 36 hours from now" do
# time = 36.hours.from_now
# time_distance_or_time_stamp(time).should =~ /1 day from now/
# end
#
#
# it "should return '2 days ago' when 37 hours ago" do
# time = 37.hours.ago
# time_distance_or_time_stamp(time).should =~ /2 days ago/
# end
#
#
# it "should return '2 days from now' when 37 hours from now" do
# time = 37.hours.from_now
# time_distance_or_time_stamp(time).should =~ /2 days from now/
# end
#
#
# it "should return '2 days ago' when 48 hours ago" do
# time = 48.hours.ago
# time_distance_or_time_stamp(time).should =~ /2 days ago/
# end
#
#
# it "should return '2 days from now' when 48 hours from now" do
# time = 48.hours.from_now
# time_distance_or_time_stamp(time).should =~ /2 days from now/
# end
#
#
# it "should return time_stamp without 'ago' when 49+ hours ago" do
# time = 49.hours.ago
# time_distance_or_time_stamp(time).should_not =~ /ago/
# end
#
#
# it "should return time_stamp without 'from now' when 49+ hours from now" do
# time = 49.hours.from_now
# time_distance_or_time_stamp(time).should_not =~ /from now/
# end
#
#
# it "should return time_stamp with only day & date when 49+ hours ago" do
# time = Time.utc(1966,"oct",25,05,35,0)
# time_distance_or_time_stamp(time).should =~ /Tue, 25 Oct 1966/
# end
#
#
# it "should return time_stamp with only day & date when 49+ hours from now" do
# time = Time.utc(2020,"oct",25,05,35,0)
# time_distance_or_time_stamp(time).should =~ /Sun, 25 Oct 2020/
# end
#
#
# end
#
#
# describe "time_stamp helper method" do
#
#
# it "should return a properly formatted timestamp" do
# time = Time.utc(1966,"oct",25,05,35,0)
# time_stamp(time).should =~ /Tue, 25 Oct 1966, 5:35am/
# end
#
#
# end