unfuddle 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ init.rb
2
+ install.rb
3
+ lib/tasks/unfuddle.rake
4
+ lib/unfuddle/account.rb
5
+ lib/unfuddle/changeset.rb
6
+ lib/unfuddle/message.rb
7
+ lib/unfuddle/milestone.rb
8
+ lib/unfuddle/notebook.rb
9
+ lib/unfuddle/person.rb
10
+ lib/unfuddle/project.rb
11
+ lib/unfuddle/repository.rb
12
+ lib/unfuddle/session.rb
13
+ lib/unfuddle/ticket.rb
14
+ lib/unfuddle/time_tracking.rb
15
+ lib/unfuddle.rb
16
+ lib/unfuddle_notifier.rb
17
+ Rakefile
18
+ README.rdoc
19
+ spec/lib/unfuddle/account_spec.rb
20
+ spec/lib/unfuddle/changeset_spec.rb
21
+ spec/lib/unfuddle/message_spec.rb
22
+ spec/lib/unfuddle/milestone_spec.rb
23
+ spec/lib/unfuddle/notebook_spec.rb
24
+ spec/lib/unfuddle/person_spec.rb
25
+ spec/lib/unfuddle/project_spec.rb
26
+ spec/lib/unfuddle/repository_spec.rb
27
+ spec/lib/unfuddle/session_spec.rb
28
+ spec/lib/unfuddle/ticket_spec.rb
29
+ spec/lib/unfuddle/time_tracking_spec.rb
30
+ spec/spec_helper.rb
31
+ views/ui/panel.html.erb
32
+ Manifest
@@ -0,0 +1,15 @@
1
+ INTRODUCTION:
2
+ The Unfuddle gem is designed to make it easy to integrate Unfuddle into your project.
3
+ There are many uses for this gem if you are using Unfuddle for project management.
4
+ You could even hook this gem into your tests and create tickets when one test fails.
5
+ The possibilities are endless.
6
+
7
+ USAGE:
8
+ Add this to your config/environment.rb file inside the Initializer block
9
+
10
+ Rails::Initializer.run do |config|
11
+ config.middleware.use "UnfuddleNotifier"
12
+ end
13
+
14
+ # run the rake task (rake unfuddle:setup) to create the configuration files
15
+
@@ -0,0 +1,14 @@
1
+ %w(rubygems rake echoe).each do |gem|
2
+ require gem
3
+ end
4
+
5
+ Echoe.new('unfuddle','0.1.1') do |p|
6
+ p.description = "Integrates your rails app with Unfuddle API and Rack"
7
+ p.url = "http://www.timmatheson.com"
8
+ p.author = "Tim Matheson"
9
+ p.email = "me@timmatheson.com"
10
+ p.ignore_pattern = ["tmp/*","script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/lib/tasks/*.rake"].sort.each { |ext| load ext }
data/init.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'active_resource'
3
+ require 'ostruct'
4
+ require 'lib/unfuddle'
5
+ require 'install'
@@ -0,0 +1,6 @@
1
+ if defined?(RAILS_ROOT)
2
+ rake_task_copy_path = File.join(RAILS_ROOT, "lib", "tasks", "unfuddle.rake")
3
+ unless File.exists?(rake_task_copy_path)
4
+ File.copy(File.join(File.dirname(__FILE__),"lib","tasks", "unfuddke.rake"), rake_task_copy_path)
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ namespace :unfuddle do
2
+ task :setup, :environment do
3
+ if defined?(RAILS_ROOT)
4
+ config_path = File.join(RAILS_ROOT, "config", "unfuddle.yml")
5
+ unless File.exists?(config_path)
6
+ config_file = File.new(config_path, "w")
7
+ config_file.write(File.read(config_file))
8
+ config_file.close
9
+ $stdout.puts "Added the config file template to config/unfuddle.yml"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,27 @@
1
+ # Author: Tim Matheson
2
+ # Website: http://www.timmatheson.com
3
+
4
+ module Unfuddle
5
+
6
+ def self.config_path
7
+ "config/unfuddle.yml"
8
+ end
9
+
10
+ def self.env
11
+ defined?(RAILS_ENV) ? RAILS_ENV : "test"
12
+ end
13
+
14
+ def self.config
15
+ if File.exists?(config_path)
16
+ return YAML.load_file(config_path)["#{env}"]
17
+ else
18
+ raise Exception, "Missing #{config_path} yaml file."
19
+ end
20
+ end
21
+
22
+ ActiveResource::Base.site = config["uri"]
23
+ ActiveResource::Base.user = config["username"]
24
+ ActiveResource::Base.password = config["password"]
25
+ end
26
+
27
+ (Dir.entries("lib/unfuddle/") - [".","..",".git",".svn"]).each{ |f| require "lib/unfuddle/" + f }
@@ -0,0 +1,8 @@
1
+ module Unfuddle
2
+ # Your account - configure it in config/unfuddle.yml
3
+ class Account < ActiveResource::Base
4
+ def self.current
5
+ find(:one, :from => "/api/v1/account.xml")
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module Unfuddle
2
+ class Changeset < ActiveResource::Base; end;
3
+ end
@@ -0,0 +1,3 @@
1
+ module Unfuddle
2
+ class Message < ActiveResource::Base; end;
3
+ end
@@ -0,0 +1,3 @@
1
+ module Unfuddle
2
+ class Milestone < ActiveResource::Base; end;
3
+ end
@@ -0,0 +1,3 @@
1
+ module Unfuddle
2
+ class Notebook < ActiveResource::Base; end;
3
+ end
@@ -0,0 +1,5 @@
1
+ module Unfuddle
2
+ class Person < ActiveResource::Base
3
+ self.prefix = "/people"
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ module Unfuddle
2
+ class Project < ActiveResource::Base
3
+ def tickets
4
+ Ticket.find(:all, :from => "/projects/#{id}/tickets")
5
+ end
6
+
7
+ def self.all
8
+ find(:all, :from => "/projects.xml")
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module Unfuddle
2
+ class Repository < ActiveResource::Base
3
+ self.prefix = "/repositories"
4
+ def projects
5
+ []
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,41 @@
1
+ module Unfuddle
2
+ class Session < ActiveResource::Base
3
+ cattr_accessor :site
4
+ cattr_accessor :protocol
5
+ attr_accessor :url, :account, :username, :password, :errors
6
+
7
+ self.protocol = "http"
8
+
9
+ def initialize
10
+ #file_path = File.join(RAILS_ROOT, "config", "unfuddle.yml")
11
+ file_path = File.join(File.dirname(__FILE__), "..", "unfuddle.yml")
12
+ @errors = []
13
+ if File.exists?(file_path)
14
+ config = YAML.load_file(file_path)["development"]
15
+ %W(account username password).each do |key|
16
+ if(config[key].nil? || config[key] == "")
17
+ @errors.push("Unfuddle Gem::Error Missing parameter #{key}")
18
+ end
19
+ end
20
+ raise Exception.new(@errors.join(", ")) unless errors.size == 0
21
+ self.account, self.username, self.password, self.url = config["account"], config["username"], config["password"], "#{config["account"]}.unfuddle.com"
22
+ else
23
+ $stdout.puts "Unfuddle Gem::Error Missing unfuddle yaml config file, please create it in config/"
24
+ end
25
+
26
+ ActiveResource::Base.site = URI.parse(site)
27
+ end
28
+
29
+ def errors
30
+ @errors.join(", ")
31
+ end
32
+
33
+ def account
34
+ Account.current
35
+ end
36
+
37
+ def site
38
+ "#{protocol}://#{username}:#{password}@#{url}/api/v1"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,5 @@
1
+ module Unfuddle
2
+ class Ticket < ActiveResource::Base
3
+ self.prefix = "/tickets"
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Unfuddle
2
+ class TimeTracking < ActiveResource::Base; end;
3
+ end
@@ -0,0 +1,16 @@
1
+ require 'rubygems'
2
+ require 'rack'
3
+ include Rack
4
+
5
+ class UnfuddleNotifier
6
+ TEMPLATE_PATH = File.dirname(__FILE__) + "/../views"
7
+
8
+ def initialize(app)
9
+ @app = app
10
+ end
11
+
12
+ def call(env)
13
+ status, headers, response = @app.call(env)
14
+ [status, headers, ERB.new(File.read("views/ui/panel.html.erb")).result + response.body]
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
+ describe Unfuddle::Account, " a valid account" do
3
+ it "should return the current account" do
4
+ Unfuddle::Account.current.should_not be_nil
5
+ end
6
+
7
+ it "should return the access key" do
8
+ account = Unfuddle::Account.current
9
+ account.access_key.should_not be_nil
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
+ describe Unfuddle::Changeset, " a valid changeset" do
3
+ end
@@ -0,0 +1,3 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
+ describe Unfuddle::Message, " a valid message" do
3
+ end
@@ -0,0 +1,3 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
+ describe Unfuddle::Milestone, " a valid milestone" do
3
+ end
@@ -0,0 +1,3 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
+ describe Unfuddle::Notebook, " a valid notebook" do
3
+ end
@@ -0,0 +1,3 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
+ describe Unfuddle::Person, " a valid person" do
3
+ end
@@ -0,0 +1,26 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
+ describe Unfuddle::Project, " a valid project" do
3
+ before(:each) do
4
+ @project = Unfuddle::Project.find(:first)
5
+ end
6
+
7
+ it "should return the project tickets" do
8
+ @project.tickets.class.should == Array
9
+ end
10
+
11
+ it "should have an account id" do
12
+ @project.account_id.should_not be_nil
13
+ end
14
+
15
+ it "should have an archived attribute" do
16
+ @project.archived.should_not be_nil
17
+ end
18
+
19
+ it "should have an 'assignee on resolve' attribute" do
20
+ @project.assignee_on_resolve.should_not be_nil
21
+ end
22
+
23
+ it "should have one of reporter, none, nochange value for 'assignee on resolve'" do
24
+ ["reporter","none","nochange"].include?(@project.assignee_on_resolve).should == true
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
+ describe Unfuddle::Repository, " a valid repository" do
3
+ end
@@ -0,0 +1,3 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
+ describe Unfuddle::Session, " a valid session" do
3
+ end
@@ -0,0 +1,16 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
+ describe Unfuddle::Ticket, " a valid ticket" do
3
+ before(:each) do
4
+ @project = Unfuddle::Project.find(:first)
5
+ end
6
+
7
+ it "should find a ticket" do
8
+ ticket = @project.tickets.first
9
+ ticket.should.class == Unfuddle::Ticket
10
+ end
11
+
12
+ it "should create a ticket" do
13
+ ticket = @project.tickets.create(:description => "test driven ticket")
14
+ ticket.should == ""
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
2
+ describe Unfuddle::TimeTracking, " a valid time tracking" do
3
+ end
@@ -0,0 +1,9 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+ require 'spec/autorun'
3
+ require 'rubygems'
4
+ require 'active_resource'
5
+ require 'ostruct'
6
+ require 'lib/unfuddle'
7
+ include Unfuddle
8
+ Spec::Runner.configure do |config|
9
+ end
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{unfuddle}
5
+ s.version = "0.1.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Tim Matheson"]
9
+ s.date = %q{2009-10-12}
10
+ s.description = %q{Integrates your rails app with Unfuddle API and Rack}
11
+ s.email = %q{me@timmatheson.com}
12
+ s.extra_rdoc_files = ["lib/tasks/unfuddle.rake", "lib/unfuddle/account.rb", "lib/unfuddle/changeset.rb", "lib/unfuddle/message.rb", "lib/unfuddle/milestone.rb", "lib/unfuddle/notebook.rb", "lib/unfuddle/person.rb", "lib/unfuddle/project.rb", "lib/unfuddle/repository.rb", "lib/unfuddle/session.rb", "lib/unfuddle/ticket.rb", "lib/unfuddle/time_tracking.rb", "lib/unfuddle.rb", "lib/unfuddle_notifier.rb", "README.rdoc"]
13
+ s.files = ["init.rb", "install.rb", "lib/tasks/unfuddle.rake", "lib/unfuddle/account.rb", "lib/unfuddle/changeset.rb", "lib/unfuddle/message.rb", "lib/unfuddle/milestone.rb", "lib/unfuddle/notebook.rb", "lib/unfuddle/person.rb", "lib/unfuddle/project.rb", "lib/unfuddle/repository.rb", "lib/unfuddle/session.rb", "lib/unfuddle/ticket.rb", "lib/unfuddle/time_tracking.rb", "lib/unfuddle.rb", "lib/unfuddle_notifier.rb", "Rakefile", "README.rdoc", "spec/lib/unfuddle/account_spec.rb", "spec/lib/unfuddle/changeset_spec.rb", "spec/lib/unfuddle/message_spec.rb", "spec/lib/unfuddle/milestone_spec.rb", "spec/lib/unfuddle/notebook_spec.rb", "spec/lib/unfuddle/person_spec.rb", "spec/lib/unfuddle/project_spec.rb", "spec/lib/unfuddle/repository_spec.rb", "spec/lib/unfuddle/session_spec.rb", "spec/lib/unfuddle/ticket_spec.rb", "spec/lib/unfuddle/time_tracking_spec.rb", "spec/spec_helper.rb", "views/ui/panel.html.erb", "Manifest", "unfuddle.gemspec"]
14
+ s.homepage = %q{http://www.timmatheson.com}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Unfuddle", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{unfuddle}
18
+ s.rubygems_version = %q{1.3.4}
19
+ s.summary = %q{Integrates your rails app with Unfuddle API and Rack}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
+ else
27
+ end
28
+ else
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ <div id="panel" style="color: #333; background: #AFC2E9;">
2
+ Unfuddle Gem: 0 Tickets
3
+ </div>
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: unfuddle
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Tim Matheson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-12 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Integrates your rails app with Unfuddle API and Rack
17
+ email: me@timmatheson.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - lib/tasks/unfuddle.rake
24
+ - lib/unfuddle/account.rb
25
+ - lib/unfuddle/changeset.rb
26
+ - lib/unfuddle/message.rb
27
+ - lib/unfuddle/milestone.rb
28
+ - lib/unfuddle/notebook.rb
29
+ - lib/unfuddle/person.rb
30
+ - lib/unfuddle/project.rb
31
+ - lib/unfuddle/repository.rb
32
+ - lib/unfuddle/session.rb
33
+ - lib/unfuddle/ticket.rb
34
+ - lib/unfuddle/time_tracking.rb
35
+ - lib/unfuddle.rb
36
+ - lib/unfuddle_notifier.rb
37
+ - README.rdoc
38
+ files:
39
+ - init.rb
40
+ - install.rb
41
+ - lib/tasks/unfuddle.rake
42
+ - lib/unfuddle/account.rb
43
+ - lib/unfuddle/changeset.rb
44
+ - lib/unfuddle/message.rb
45
+ - lib/unfuddle/milestone.rb
46
+ - lib/unfuddle/notebook.rb
47
+ - lib/unfuddle/person.rb
48
+ - lib/unfuddle/project.rb
49
+ - lib/unfuddle/repository.rb
50
+ - lib/unfuddle/session.rb
51
+ - lib/unfuddle/ticket.rb
52
+ - lib/unfuddle/time_tracking.rb
53
+ - lib/unfuddle.rb
54
+ - lib/unfuddle_notifier.rb
55
+ - Rakefile
56
+ - README.rdoc
57
+ - spec/lib/unfuddle/account_spec.rb
58
+ - spec/lib/unfuddle/changeset_spec.rb
59
+ - spec/lib/unfuddle/message_spec.rb
60
+ - spec/lib/unfuddle/milestone_spec.rb
61
+ - spec/lib/unfuddle/notebook_spec.rb
62
+ - spec/lib/unfuddle/person_spec.rb
63
+ - spec/lib/unfuddle/project_spec.rb
64
+ - spec/lib/unfuddle/repository_spec.rb
65
+ - spec/lib/unfuddle/session_spec.rb
66
+ - spec/lib/unfuddle/ticket_spec.rb
67
+ - spec/lib/unfuddle/time_tracking_spec.rb
68
+ - spec/spec_helper.rb
69
+ - views/ui/panel.html.erb
70
+ - Manifest
71
+ - unfuddle.gemspec
72
+ has_rdoc: true
73
+ homepage: http://www.timmatheson.com
74
+ licenses: []
75
+
76
+ post_install_message:
77
+ rdoc_options:
78
+ - --line-numbers
79
+ - --inline-source
80
+ - --title
81
+ - Unfuddle
82
+ - --main
83
+ - README.rdoc
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ version:
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: "1.2"
97
+ version:
98
+ requirements: []
99
+
100
+ rubyforge_project: unfuddle
101
+ rubygems_version: 1.3.4
102
+ signing_key:
103
+ specification_version: 3
104
+ summary: Integrates your rails app with Unfuddle API and Rack
105
+ test_files: []
106
+