Skip to content

Commit

Permalink
removed references in code to ticketmaster and renamed file names to …
Browse files Browse the repository at this point in the history
…taskmapper
  • Loading branch information
cored committed May 9, 2012
1 parent 8f6288d commit 67878e8
Show file tree
Hide file tree
Showing 46 changed files with 213 additions and 53 deletions.
2 changes: 1 addition & 1 deletion bin/tm
Expand Up @@ -3,5 +3,5 @@
# The 'ticketmaster' gem was installed using rubygems # The 'ticketmaster' gem was installed using rubygems
# This file is the CLI application to use with 'ticketmaster' # This file is the CLI application to use with 'ticketmaster'


require File.dirname(__FILE__) + '/../lib/ticketmaster/cli/init.rb' require File.dirname(__FILE__) + '/../lib/taskmapper/cli/init.rb'


6 changes: 3 additions & 3 deletions examples/tm_example.rb
@@ -1,9 +1,9 @@
require 'rubygems' require 'rubygems'
require 'ticketmaster' require 'taskmapper'
require 'ticketmaster-lighthouse' require 'taskmapper-lighthouse'


# display list of projects # display list of projects
tm = TicketMaster.new(:lighthouse) tm = TaskMapper.new(:lighthouse)
tm.projects.each {|project| tm.projects.each {|project|
puts "#{project.id} - #{project.name}" puts "#{project.id} - #{project.name}"
} }
Expand Down
6 changes: 3 additions & 3 deletions examples/tm_example_2.rb
@@ -1,9 +1,9 @@
require 'rubygems' require 'rubygems'
require 'ticketmaster' require 'taskmapper'
require 'ticketmaster-pivotal' require 'taskmapper-pivotal'


# display list of tickets for last project # display list of tickets for last project
tm = TicketMaster.new(:pivotal) tm = TaskMapper.new(:pivotal)
project = tm.projects.last project = tm.projects.last
project.tickets.each {|ticket| project.tickets.each {|ticket|
puts "#{ticket.id} - #{ticket.title}" puts "#{ticket.id} - #{ticket.title}"
Expand Down
10 changes: 5 additions & 5 deletions examples/tm_example_3.rb
@@ -1,11 +1,11 @@
require 'rubygems' require 'rubygems'
require 'ticketmaster' require 'taskmapper'
require 'ticketmaster-pivotal' require 'taskmapper-pivotal'
require 'ticketmaster-lighthouse' require 'taskmapper-lighthouse'


# copy all tickets and comments from pivotal tracker to new lighthouse project (the hard way) # copy all tickets and comments from pivotal tracker to new lighthouse project (the hard way)
pivotal = TicketMaster.new(:pivotal) pivotal = TaskMapper.new(:pivotal)
lighthouse = TicketMaster.new(:lighthouse) lighthouse = TaskMapper.new(:lighthouse)


from = pivotal.project(97107) from = pivotal.project(97107)


Expand Down
10 changes: 5 additions & 5 deletions examples/tm_example_4.rb
@@ -1,11 +1,11 @@
require 'rubygems' require 'rubygems'
require 'ticketmaster' require 'taskmapper'
require 'ticketmaster-pivotal' require 'taskmapper-pivotal'
require 'ticketmaster-lighthouse' require 'taskmapper-lighthouse'


# copy all tickets and comments from pivotal tracker to new lighthouse project (the easy way) # copy all tickets and comments from pivotal tracker to new lighthouse project (the easy way)
pivotal = TicketMaster.new(:pivotal) pivotal = TaskMapper.new(:pivotal)
lighthouse = TicketMaster.new(:lighthouse) lighthouse = TaskMapper.new(:lighthouse)


from = pivotal.project(97107) from = pivotal.project(97107)
to = lighthouse.project!(:name => "Copy Test on #{Time.now}", to = lighthouse.project!(:name => "Copy Test on #{Time.now}",
Expand Down
2 changes: 1 addition & 1 deletion lib/ticketmaster.rb → lib/taskmapper.rb
Expand Up @@ -36,7 +36,7 @@ class TaskMapper
def initialize(system = nil, authentication = nil) def initialize(system = nil, authentication = nil)
if system.nil? or authentication.nil? if system.nil? or authentication.nil?
require 'yaml' require 'yaml'
data = YAML.load_file File.expand_path(ENV['TICKETMASTER_CONFIG'] || '~/.ticketmaster.yml') data = YAML.load_file File.expand_path(ENV['TASKMAPPER_CONFIG'] || '~/.taskmapper.yml')
system = system.nil? ? data['default'] || data.first.first : system.to_s system = system.nil? ? data['default'] || data.first.first : system.to_s
authentication = data[system]['authentication'] if authentication.nil? and data[system]['authentication'] authentication = data[system]['authentication'] if authentication.nil? and data[system]['authentication']
end end
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions lib/taskmapper/cli/commands/help/config
@@ -0,0 +1,27 @@
This command is used to configure taskmapper settings for use in your terminal.

By default, taskmapper searches for the config information in a file named 'taskmapper.yml' in the current directory. Next it searches for 'config/taskmapper.yml' and if that fails, it uses the home directory's ~/.taskmapper.yml (note the . in front on this one). There is also the TASKMAPPER environment variable that you can set to point to another configuration file anywhere if necessary.

This command helps facilitate the creation of a taskmapper.yml.

Warning: Due to the way the authentication is parsed, if any keys or values contain a comma (,) or colin (:), it can not be parsed through the -A command. Usually this isn't a problem, and if it is, it can be resolved though putting the values in a config file.

Example:
tm -c ~/.taskmapper.yml -p dummy -A username:cheese,password:cakes -P 555 config --add
tm -p dummy config --set-default-provider

The format for taskmapper.yml is:
default: <default provider>
<provider name>:
authentication:
<authentication information>
project: <project>
[...]

For example, a taskmapper.yml with the Dummy provider would look something like this:
default: dummy
dummy:
authentication:
username: name
password: doesnt-matter
project: 555
@@ -1,7 +1,7 @@
This command is used to open an irb session with the ticketmaster. This command is used to open an irb session with the taskmapper.


The configuration for this command should mostly be dependent on the ticketmaster.yml files. The configuration for this command should mostly be dependent on the taskmapper.yml files.
See ticketmaster help config for more information on how to set it up. See taskmapper help config for more information on how to set it up.


Example: Example:
tm console tm console
Expand Down
Expand Up @@ -2,7 +2,7 @@ This command is used to generate a new provider.


It generates some basic files to get you started on creating your own provider. It generates some basic files to get you started on creating your own provider.


NOTE: This command, in an attempt to keep provider names consistent, will prepend 'ticketmaster-' to the given provider name. You can cancel this by prepending a _ before your provider name, which will be removed if found. NOTE: This command, in an attempt to keep provider names consistent, will prepend 'taskmapper-' to the given provider name. You can cancel this by prepending a _ before your provider name, which will be removed if found.


If you have not created a gem directory or skeleton and want to use Jeweler (http://github.com/technicalpickles/jeweler) you can execute: If you have not created a gem directory or skeleton and want to use Jeweler (http://github.com/technicalpickles/jeweler) you can execute:


Expand Down
File renamed without changes.
Expand Up @@ -5,7 +5,7 @@ It can be used to do any of the CRUD actions with projects that are provided by
It will attempt to load data through the config files if they are available. See 'tm help config' for more information. It will attempt to load data through the config files if they are available. See 'tm help config' for more information.


Examples: Examples:
tm -p lighthouse -A account:ticketmaster,token:abc project --create name "new project" tm -p lighthouse -A account:taskmapper,token:abc project --create name "new project"
tm project --read 946 tm project --read 946
tm --project 946 project --read tm --project 946 project --read
tm -p dummy -A "user:common coder,pass:w3rd out" project --destroy 712 tm -p dummy -A "user:common coder,pass:w3rd out" project --destroy 712
Expand Down
Expand Up @@ -7,7 +7,7 @@ It will attempt to load data through the config files if they are available. See
If any of the keys or values contain a space, you will have to enclose that key or value in quotes. For example, if you set name to ProjectName it does not need to be quoted, but if you set name to Project Name it will have to be quoted to "Project Name" or 'Project Name' If any of the keys or values contain a space, you will have to enclose that key or value in quotes. For example, if you set name to ProjectName it does not need to be quoted, but if you set name to Project Name it will have to be quoted to "Project Name" or 'Project Name'


Examples: Examples:
tm -p lighthouse -A account:ticketmaster,token:abc ticket --create name "new ticket" description "this is a new ticket" tm -p lighthouse -A account:taskmapper,token:abc ticket --create name "new ticket" description "this is a new ticket"
tm --project 946 ticket --read --ticket 2 tm --project 946 ticket --read --ticket 2
tm -p dummy -A "user:common coder,pass: w3rd out" ticket --destroy --ticket 12 tm -p dummy -A "user:common coder,pass: w3rd out" ticket --destroy --ticket 12
tm -p dummy -P 712 ticket --destroy --ticket 4 tm -p dummy -P 712 ticket --destroy --ticket 4
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 0 additions & 27 deletions lib/ticketmaster/cli/commands/help/config

This file was deleted.

4 changes: 2 additions & 2 deletions spec/spec_helper.rb
@@ -1,7 +1,7 @@
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'ticketmaster.rb' require 'taskmapper.rb'
require 'ticketmaster/dummy/dummy.rb' require 'taskmapper/dummy/dummy.rb'
require 'rspec' require 'rspec'


RSpec.configure do |config| RSpec.configure do |config|
Expand Down
File renamed without changes.
160 changes: 160 additions & 0 deletions spec/taskmapper-exception_spec.rb
@@ -0,0 +1,160 @@
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'rubygems'
require 'ticketmaster'

describe "TaskMapper Exception Messages" do
let(:exception) { TaskMapper::Exception }
let(:tm) { TaskMapper.new(:tester, {}) }
let(:validation_error) { "TaskMapper::Provider::Base::valid? method must be implemented by the provider" }
let(:easy_finder_error) { "TaskMapper::Provider::Helper::easy_finder method must be implemented by the provider" }

describe TaskMapper::Provider::Base do
context "when calling #valid? method" do
subject { lambda { tm.valid? } }
it { should raise_error(exception, validation_error) }
end
end

describe TaskMapper::Provider::Helper do
context "when calling #easy_finder" do
subject { lambda { tm.easy_finder(1, :test, {}) } }
it { should raise_error(exception, easy_finder_error) }
end
end

describe TaskMapper::Provider::Tester::Project do
let(:find_by_id_error) { "TaskMapper::Provider::Tester::Project::find_by_id method must be implemented by the provider" }
let(:find_by_attributes_error) { "TaskMapper::Provider::Tester::Project::find_by_attributes method must be implemented by the provider" }
let(:search_error) { "TaskMapper::Provider::Tester::Project::search method must be implemented by the provider"}
let(:create_error) { "TaskMapper::Provider::Tester::Project::create method must be implemented by the provider"}
let(:save_error) { "TaskMapper::Provider::Tester::Project::save method must be implemented by the provider"}
let(:destroy_error) { "TaskMapper::Provider::Tester::Project::destroy method must be implemented by the provider" }

context "when calling #find_by_id" do
subject { lambda { tm.project([1]) } }
it { should raise_error(exception, find_by_id_error) }
end

context "when calling #find_by_attributes" do
subject { lambda { tm.project.find :all, :name => 'Test Project' } }
it { should raise_error(exception, find_by_attributes_error) }
end

context "when calling #search" do
subject { lambda { tm.project.search :tag => 'testing' } }
it { should raise_error(exception, search_error) }
end

context "when calling #create" do
subject { lambda { tm.project.create :name => 'Foo Bar' } }
it { should raise_error(exception, create_error) }
end

context "when calling #save" do
subject { lambda { tm.project.save } }
pending { should raise_error(exception, save_error) }
end

context "when calling #destroy" do
let(:project) { TaskMapper::Provider::Tester::Project.new }
subject { lambda { project.destroy } }
it { should raise_error(exception, destroy_error) }
end
end

describe TaskMapper::Provider::Tester::Ticket do
let(:ticket) { TaskMapper::Provider::Tester::Ticket.new(1) }
let(:find_by_id_error) { "TaskMapper::Provider::Tester::Ticket::find_by_id method must be implemented by the provider" }
let(:find_by_attributes_error) { "TaskMapper::Provider::Tester::Ticket::find_by_attributes method must be implemented by the provider" }
let(:search_error) { "TaskMapper::Provider::Tester::Ticket::search method must be implemented by the provider" }
let(:create_error) { "TaskMapper::Provider::Tester::Ticket::create method must be implemented by the provider" }
let(:save_error) { "TaskMapper::Provider::Tester::Ticket::save method must be implemented by the provider" }
let(:destroy_error) { "TaskMapper::Provider::Tester::Ticket::destroy method must be implemented by the provider" }
let(:close_error) { "TaskMapper::Provider::Tester::Ticket::close method must be implemented by the provider" }
let(:reload_error) { "TaskMapper::Provider::Tester::Ticket::reload! method must be implemented by the provider" }

context "when #find_by_id" do
subject { lambda { tm.tickets(:id => 22) } }
it { should raise_error(exception, find_by_id_error) }
end

context "when #find_by_attributes" do
subject { lambda { tm.ticket.find(1, :all, :title => 'Test ticket') } }
it { should raise_error(exception, find_by_attributes_error) }
end

context "when #search" do
subject { lambda { tm.ticket.search :tag => 'testing' } }
it { should raise_error(exception, search_error) }
end

context "when #create" do
subject { lambda { tm.ticket.create :name => 'Foo Bar' } }
it { should raise_error(exception, create_error) }
end

context "when #save" do
subject { lambda { ticket.save } }
it { should raise_error(exception, save_error) }
end

context "when #destroy" do
subject { lambda { ticket.destroy } }
it { should raise_error(exception, destroy_error) }
end

context "when #close" do
subject { lambda { ticket.close } }
it { should raise_error(exception, close_error) }
end

context "when #reload!" do
subject { lambda { ticket.reload! } }
it { should raise_error(exception, reload_error) }
end
end

describe TaskMapper::Provider::Tester::Comment do
let(:ticket_with_comments) { TaskMapper::Provider::Tester::Ticket.new(1) }
let(:comment) { TaskMapper::Provider::Tester::Comment.new(1, 1) }
let(:find_by_id_error) { "TaskMapper::Provider::Tester::Comment::find_by_id method must be implemented by the provider" }
let(:find_by_attributes_error) { "TaskMapper::Provider::Tester::Comment::find_by_attributes method must be implemented by the provider" }
let(:search_error) { "TaskMapper::Provider::Tester::Comment::search method must be implemented by the provider" }
let(:create_error) { "TaskMapper::Provider::Tester::Comment::create method must be implemented by the provider" }
let(:save_error) { "TaskMapper::Provider::Tester::Comment::save method must be implemented by the provider" }
let(:destroy_error) { "TaskMapper::Provider::Tester::Comment::destroy method must be implemented by the provider" }

context "when #find_by_id" do
subject { lambda { ticket_with_comments.comment.find(1,1,[1,2]) } }
it { should raise_error(exception, find_by_id_error) }
end

context "when #find_by_attributes" do
subject { lambda { ticket_with_comments.comment.find(1, 1, :all, :tag => 'tag') } }
it { should raise_error(exception, find_by_attributes_error) }
end

context "when #search" do
subject { lambda { ticket_with_comments.comment.search(1, 1, :tag => 'testing') } }
it { should raise_error(exception, search_error) }
end

context "when #create" do
subject { lambda { ticket_with_comments.comment.create :name => 'Foo Bar' } }
it { should raise_error(exception, create_error) }
end

context "when #save" do
subject { lambda { comment.save } }
it { should raise_error(exception, save_error) }
end

context "when #destroy" do
subject { lambda { comment.destroy } }
it { should raise_error(exception, destroy_error) }
end
end
end

File renamed without changes.

0 comments on commit 67878e8

Please sign in to comment.