trello_cli 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4c76891db90e191ee98e809bd156df595b53415a
4
+ data.tar.gz: 6701843d8407b0b4f34ff86f807eb4f418f364dd
5
+ SHA512:
6
+ metadata.gz: d7d52328cfdb1ac116cf402bea07744eef3b9d403b7f370fa71863010a2338453fa153c604dcb169d50f6364f1050ebd3a4665e0e71882002756daf1414fe388
7
+ data.tar.gz: d418cb29885559df7536485ec3eba51e016dee5f46167ecb93aa216ca9f51532a7d8f267b1188117e808e53c553f77faf61d65f3489008aa07eddcf3c66113a4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.0.4:
2
+
3
+ * Added move card
4
+
1
5
  ## 0.0.3:
2
6
 
3
7
  * Fixed help
data/README.md CHANGED
@@ -12,9 +12,14 @@ Install the trello_cli gem
12
12
 
13
13
  ## Setup
14
14
 
15
- Get API key:
15
+ Sign-in to trello.com as the user you want to use for trello_cli.
16
+
17
+ Get API key (open this link in a web browser):
16
18
 
17
19
  https://trello.com/1/appKey/generate
20
+
21
+ The top field contains your Developer API Key.
22
+ Use it to replace YOUR_API_KEY in the links below.
18
23
 
19
24
  Get read only member token:
20
25
 
@@ -22,7 +27,7 @@ Get read only member token:
22
27
 
23
28
  Get read / write member token:
24
29
 
25
- https://trello.com/1/authorize?key=YOUR_API_KEY&name=trello-cli=1day&response_type=token&scope=read,write
30
+ https://trello.com/1/authorize?key=YOUR_API_KEY&name=trello-cli&expiration=never&response_type=token&scope=read,write
26
31
 
27
32
  Set the environment variables:
28
33
 
@@ -11,7 +11,7 @@ module TrelloCli
11
11
  option_parser.parse!
12
12
 
13
13
  list_cards.each do |card|
14
- puts "| Name: #{card.name}"
14
+ puts "| Name: #{card.name} ( #{card.id} )"
15
15
  puts "| Description: #{card.name}"
16
16
  puts "|------------------------"
17
17
  end
@@ -0,0 +1,46 @@
1
+ module TrelloCli
2
+ module CLI
3
+ module Card
4
+ class Move
5
+
6
+ def initialize
7
+ @options = {}
8
+ end
9
+
10
+ def run
11
+ option_parser.parse!
12
+
13
+ move_card
14
+
15
+ puts "Card '#{@options[:card_id]}' moved to list '#{@options[:list_id]}'."
16
+ end
17
+
18
+ private
19
+
20
+ def move_card
21
+ mc = TrelloCli::Requests::MoveCard.new
22
+ mc.move @options
23
+ end
24
+
25
+ def option_parser
26
+ OptionParser.new do |opts|
27
+ opts.banner = "Usage: trello card [move] [options]"
28
+
29
+ opts.on("-c", "--card_id [CARD_ID]", "ID of Card") do |c|
30
+ @options[:card_id] = c
31
+ end
32
+
33
+ opts.on("-l", "--list_id [LIST_ID]", "New List ID") do |l|
34
+ @options[:list_id] = l
35
+ end
36
+ end
37
+ end
38
+
39
+ def help
40
+ puts option_parser.help
41
+ end
42
+
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,2 +1,3 @@
1
1
  require 'trello_cli/cli/card/create'
2
2
  require 'trello_cli/cli/card/list'
3
+ require 'trello_cli/cli/card/move'
@@ -6,6 +6,7 @@ module TrelloCli
6
6
  include Shared
7
7
 
8
8
  def list
9
+ ensure_credential_envs_set
9
10
  TrelloCli::CLI::Board::List.new.run
10
11
  end
11
12
 
@@ -6,13 +6,20 @@ module TrelloCli
6
6
  include Shared
7
7
 
8
8
  def create
9
+ ensure_credential_envs_set
9
10
  TrelloCli::CLI::Card::Create.new.run
10
11
  end
11
12
 
12
13
  def list
14
+ ensure_credential_envs_set
13
15
  TrelloCli::CLI::Card::List.new.run
14
16
  end
15
17
 
18
+ def move
19
+ ensure_credential_envs_set
20
+ TrelloCli::CLI::Card::Move.new.run
21
+ end
22
+
16
23
  end
17
24
  end
18
25
  end
@@ -6,6 +6,7 @@ module TrelloCli
6
6
  include Shared
7
7
 
8
8
  def list
9
+ ensure_credential_envs_set
9
10
  TrelloCli::CLI::List::List.new.run
10
11
  end
11
12
 
@@ -15,6 +15,15 @@ module TrelloCli
15
15
  self.class.name.downcase.split('::').last
16
16
  end
17
17
 
18
+ def ensure_credential_envs_set
19
+ %w{TRELLO_MEMBER_TOKEN TRELLO_DEVELOPER_PUBLIC_KEY}.each do |e|
20
+ unless ENV[e]
21
+ puts "#{e} environment variable not set"
22
+ exit 1
23
+ end
24
+ end
25
+ end
26
+
18
27
  def help
19
28
  puts "Valid commands for #{target_name}: #{actions.join(', ')}"
20
29
  puts "For further help, append -h to sub command."
@@ -16,6 +16,13 @@ module TrelloCli
16
16
  rescue OptionParser::InvalidOption, Trello::Error => e
17
17
  puts e.message
18
18
  exit 1
19
+ rescue NoMethodError => e
20
+ if e.message.match /SocketError/
21
+ puts 'Please connect to the internet to access Trello'
22
+ exit 1
23
+ else
24
+ raise e
25
+ end
19
26
  end
20
27
  when '-v'
21
28
  puts TrelloCli::VERSION
@@ -0,0 +1,19 @@
1
+ module TrelloCli
2
+ module Requests
3
+ class MoveCard
4
+
5
+ include Shared
6
+
7
+ def initialize
8
+ connect_to_trello
9
+ end
10
+
11
+ def move(args)
12
+ card = Trello::Card.new 'id' => args[:card_id]
13
+ list = Trello::List.find args[:list_id]
14
+ card.move_to_list list
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -3,6 +3,7 @@ require 'trello'
3
3
  require 'trello_cli/requests/shared'
4
4
 
5
5
  require 'trello_cli/requests/create_card'
6
+ require 'trello_cli/requests/move_card'
6
7
  require 'trello_cli/requests/list_boards'
7
8
  require 'trello_cli/requests/list_cards'
8
9
  require 'trello_cli/requests/list_lists'
@@ -1,3 +1,3 @@
1
1
  module TrelloCli
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/spec/cli/run_spec.rb CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe TrelloCli::CLI::Run do
4
4
 
5
5
  before do
6
- @card_mock = mock 'card'
6
+ @card_mock = double 'card'
7
7
  TrelloCli::CLI::Commands::Card.stub :new => @card_mock
8
8
  end
9
9
 
@@ -14,12 +14,11 @@ describe TrelloCli::Requests::CreateCard do
14
14
  'desc' => args[:description],
15
15
  'idBoard' => args[:board_id],
16
16
  'idList' => args[:list_id] }
17
- trello_card_mock = mock 'trello card'
17
+ trello_card_mock = double 'trello card'
18
18
  Trello::Card.should_receive(:new).
19
19
  with(options).
20
20
  and_return trello_card_mock
21
21
  trello_card_mock.should_receive(:save)
22
- create_card = TrelloCli::Requests::CreateCard.new
23
- create_card.create args
22
+ subject.create args
24
23
  end
25
24
  end
@@ -7,7 +7,6 @@ describe TrelloCli::Requests::ListBoards do
7
7
 
8
8
  it "should list the lists for given board" do
9
9
  Trello::Board.stub :all => ['123']
10
- lb = TrelloCli::Requests::ListBoards.new
11
- lb.list.should == ['123']
10
+ subject.list.should == ['123']
12
11
  end
13
12
  end
@@ -10,12 +10,11 @@ describe TrelloCli::Requests::ListCards do
10
10
  :list_id => '321' }
11
11
  options = { 'idBoard' => args[:board_id],
12
12
  'id' => args[:list_id] }
13
- trello_list_mock = mock 'trello list'
13
+ trello_list_mock = double 'trello list'
14
14
  Trello::List.should_receive(:new).
15
15
  with(options).
16
16
  and_return trello_list_mock
17
17
  trello_list_mock.should_receive(:cards)
18
- list_cards = TrelloCli::Requests::ListCards.new
19
- list_cards.list args
18
+ subject.list args
20
19
  end
21
20
  end
@@ -6,11 +6,10 @@ describe TrelloCli::Requests::ListLists do
6
6
  end
7
7
 
8
8
  it "should list the lists for given board" do
9
- trello_board_mock = mock 'new'
9
+ trello_board_mock = double 'new'
10
10
  Trello::Board.should_receive(:new).with('id' => '123').
11
11
  and_return trello_board_mock
12
12
  trello_board_mock.stub :lists => ['321']
13
- ll = TrelloCli::Requests::ListLists.new
14
- ll.list(:board_id => '123').should == ['321']
13
+ subject.list(:board_id => '123').should == ['321']
15
14
  end
16
15
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe TrelloCli::Requests::MoveCard do
4
+ before do
5
+ Trello.should_receive(:configure)
6
+ end
7
+
8
+ it "should move the card to the requested list" do
9
+ args = { card_id: '123', list_id: '321' }
10
+ trello_card_mock = double 'trello card'
11
+ trello_list_mock = double 'trello list'
12
+ Trello::Card.should_receive(:new).
13
+ with('id' => args[:card_id]).
14
+ and_return trello_card_mock
15
+ Trello::List.should_receive(:find).
16
+ with(args[:list_id]).
17
+ and_return trello_list_mock
18
+ trello_card_mock.should_receive(:move_to_list).with(trello_list_mock)
19
+ subject.move args
20
+ end
21
+ end
@@ -8,7 +8,7 @@ describe TrelloCli::Requests::Shared do
8
8
  end
9
9
 
10
10
  it "should connect to trello" do
11
- trello_configure_mock = mock 'trello_configure'
11
+ trello_configure_mock = double 'trello_configure'
12
12
  Trello.should_receive(:configure).and_yield trello_configure_mock
13
13
  trello_configure_mock.should_receive(:developer_public_key=).
14
14
  with('key')
data/trello_cli.gemspec CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.homepage = "https://github.com/brettweavnet/trello_cli"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
+ gem.files -= gem.files.grep(%r{^\.})
16
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
19
  gem.require_paths = ["lib"]
metadata CHANGED
@@ -1,49 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trello_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brett Weaver
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-27 00:00:00.000000000 Z
11
+ date: 2014-03-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
- requirement: &70261266173780 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *70261266173780
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: rake
27
- requirement: &70261266173340 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - ">="
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *70261266173340
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: ruby-trello
38
- requirement: &70261266172800 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - =
45
+ - - '='
42
46
  - !ruby/object:Gem::Version
43
47
  version: 0.5.1
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *70261266172800
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.5.1
47
55
  description: Simple Trello Command Line Interface
48
56
  email:
49
57
  - brett@weav.net
@@ -52,9 +60,6 @@ executables:
52
60
  extensions: []
53
61
  extra_rdoc_files: []
54
62
  files:
55
- - .gitignore
56
- - .rvmrc
57
- - .travis.yml
58
63
  - CHANGELOG.md
59
64
  - Gemfile
60
65
  - LICENSE.txt
@@ -68,6 +73,7 @@ files:
68
73
  - lib/trello_cli/cli/card.rb
69
74
  - lib/trello_cli/cli/card/create.rb
70
75
  - lib/trello_cli/cli/card/list.rb
76
+ - lib/trello_cli/cli/card/move.rb
71
77
  - lib/trello_cli/cli/commands.rb
72
78
  - lib/trello_cli/cli/commands/board.rb
73
79
  - lib/trello_cli/cli/commands/card.rb
@@ -81,6 +87,7 @@ files:
81
87
  - lib/trello_cli/requests/list_boards.rb
82
88
  - lib/trello_cli/requests/list_cards.rb
83
89
  - lib/trello_cli/requests/list_lists.rb
90
+ - lib/trello_cli/requests/move_card.rb
84
91
  - lib/trello_cli/requests/shared.rb
85
92
  - lib/trello_cli/version.rb
86
93
  - spec/cli/commands/shared_spec.rb
@@ -89,38 +96,32 @@ files:
89
96
  - spec/requests/list_boards_spec.rb
90
97
  - spec/requests/list_card_spec.rb
91
98
  - spec/requests/list_lists_spec.rb
99
+ - spec/requests/move_card_spec.rb
92
100
  - spec/requests/shared_spec.rb
93
101
  - spec/spec_helper.rb
94
102
  - trello_cli.gemspec
95
103
  homepage: https://github.com/brettweavnet/trello_cli
96
104
  licenses: []
105
+ metadata: {}
97
106
  post_install_message:
98
107
  rdoc_options: []
99
108
  require_paths:
100
109
  - lib
101
110
  required_ruby_version: !ruby/object:Gem::Requirement
102
- none: false
103
111
  requirements:
104
- - - ! '>='
112
+ - - ">="
105
113
  - !ruby/object:Gem::Version
106
114
  version: '0'
107
- segments:
108
- - 0
109
- hash: 3964216416038007398
110
115
  required_rubygems_version: !ruby/object:Gem::Requirement
111
- none: false
112
116
  requirements:
113
- - - ! '>='
117
+ - - ">="
114
118
  - !ruby/object:Gem::Version
115
119
  version: '0'
116
- segments:
117
- - 0
118
- hash: 3964216416038007398
119
120
  requirements: []
120
121
  rubyforge_project:
121
- rubygems_version: 1.8.16
122
+ rubygems_version: 2.2.0
122
123
  signing_key:
123
- specification_version: 3
124
+ specification_version: 4
124
125
  summary: Simple Trello Command Line Interface
125
126
  test_files:
126
127
  - spec/cli/commands/shared_spec.rb
@@ -129,5 +130,6 @@ test_files:
129
130
  - spec/requests/list_boards_spec.rb
130
131
  - spec/requests/list_card_spec.rb
131
132
  - spec/requests/list_lists_spec.rb
133
+ - spec/requests/move_card_spec.rb
132
134
  - spec/requests/shared_spec.rb
133
135
  - spec/spec_helper.rb
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use ruby-1.9.3-p385@trello_cli --create
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- rvm:
2
- - 1.9.2
3
- - 1.9.3
4
- script: "rake spec"