shacho 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -50,35 +50,40 @@ Where `action` is one of the standard CRUDy actions:
50
50
  - list
51
51
  - edit
52
52
  - remove
53
+ - clear
53
54
 
54
55
  `params` refers to any additional parameters you might want to pass in. For now, that's just the name of the account you want to create
55
56
 
56
57
  # examples!
57
58
 
58
59
  ```
59
- # Create:
60
+ # Create: makes a new account
60
61
  shacho create default
61
62
  ```
62
63
 
63
64
  ```
64
- # Use:
65
+ # Use: switches the user
65
66
  shacho use default
66
67
  ```
67
68
 
68
69
  ```
69
- # List:
70
+ # List: shows all the accounts on your machine
70
71
  shacho list
71
72
  ```
72
73
 
73
74
  ```
74
- # Edit:
75
+ # Edit: allows you to edit the credentials for a specific account
75
76
  shacho edit default
76
77
  ```
77
78
 
78
79
  ```
79
- # Remove:
80
+ # Remove: removes a specific account
80
81
  shacho remove default
81
82
  ```
83
+ ```
84
+ # Clear: removes all accounts
85
+ shacho clear
86
+ ```
82
87
 
83
88
  # details of implementation
84
89
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -25,9 +25,9 @@ module Shacho
25
25
 
26
26
  def self.list(options)
27
27
  # TODO Throw error for incorrect params
28
- Dir.glob("#{HEROKU_PREFIX}/accounts/*").each do |f|
29
- account_name = File.basename(f)
30
- puts account_name if !(["..", "."].include?(f))
28
+ accounts.each do |account|
29
+ account_name = File.basename(account)
30
+ puts account_name if !(["..", "."].include?(account))
31
31
  end
32
32
  end
33
33
 
@@ -41,7 +41,7 @@ module Shacho
41
41
 
42
42
  def self.remove(options)
43
43
  # TODO Throw error for incorrect params
44
- # TODO Refactor
44
+ # TODO Refactor
45
45
  name = options.first
46
46
  Runner.error account_not_found(name) if !exists?(name)
47
47
 
@@ -50,13 +50,19 @@ module Shacho
50
50
  FileUtils.rm_r account_folder(name)
51
51
  end
52
52
 
53
+ def self.clear(options)
54
+ accounts.each do |account|
55
+ remove([File.basename(account)])
56
+ end
57
+ end
58
+
53
59
  def method_missing(sym, *args, &block)
54
60
  Runner.error("Unsupported action. Run `shacho help` for more information")
55
61
  end
56
62
 
57
63
  private
58
64
  def self.account_folder(name)
59
- return "#{HEROKU_PREFIX}/accounts/#{name}"
65
+ return "#{HEROKU_PREFIX}/accounts/#{name}"
60
66
  end
61
67
 
62
68
  def self.update_credentials(name)
@@ -72,5 +78,9 @@ module Shacho
72
78
  def self.account_not_found(name)
73
79
  "Error: '#{name}' not found. Create account with: shacho create #{name}"
74
80
  end
81
+
82
+ def self.accounts
83
+ Dir.glob "#{HEROKU_PREFIX}/accounts/*"
84
+ end
75
85
  end
76
86
  end
data/lib/shacho.rb CHANGED
@@ -7,5 +7,5 @@ module Shacho
7
7
 
8
8
  # TODO only need to use actions
9
9
  # method_missing willl help with error handling
10
- COMMANDS = ["create", "use", "list", "edit", "remove", "help"]
10
+ COMMANDS = ["create", "use", "list", "edit", "remove", "clear", "help"]
11
11
  end
data/shacho.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "shacho"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kelly"]
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/shacho/runner.rb",
34
34
  "lib/shacho/util.rb",
35
35
  "shacho.gemspec",
36
+ "spec/accounts/clear_account_spec.rb",
36
37
  "spec/accounts/edit_account_spec.rb",
37
38
  "spec/accounts/list_account_spec.rb",
38
39
  "spec/accounts/new_account_spec.rb",
@@ -0,0 +1,14 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "Clearing all accounts" do
4
+ include CoreHelper
5
+
6
+ before :each do
7
+ create_account
8
+ end
9
+
10
+ it "should remove all accounts" do
11
+ Shacho::Account.clear([])
12
+ Shacho::Account.accounts.length.should == 0
13
+ end
14
+ end
@@ -7,7 +7,7 @@ describe "A New Account" do
7
7
  create_account
8
8
  @filename = "#{Shacho::HEROKU_PREFIX}/accounts/test"
9
9
  end
10
-
10
+
11
11
  it "should be created" do
12
12
  File.exists?(@filename).should == true
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shacho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: heroku
16
- requirement: &17015060 !ruby/object:Gem::Requirement
16
+ requirement: &16717860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *17015060
24
+ version_requirements: *16717860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &17014360 !ruby/object:Gem::Requirement
27
+ requirement: &16717200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.3.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *17014360
35
+ version_requirements: *16717200
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ruby-debug19
38
- requirement: &17013660 !ruby/object:Gem::Requirement
38
+ requirement: &16716280 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *17013660
46
+ version_requirements: *16716280
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mocha
49
- requirement: &17012980 !ruby/object:Gem::Requirement
49
+ requirement: &16715280 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *17012980
57
+ version_requirements: *16715280
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &17012200 !ruby/object:Gem::Requirement
60
+ requirement: &16714360 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *17012200
68
+ version_requirements: *16714360
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jeweler
71
- requirement: &17004040 !ruby/object:Gem::Requirement
71
+ requirement: &16713560 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.6.4
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *17004040
79
+ version_requirements: *16713560
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rcov
82
- requirement: &17003180 !ruby/object:Gem::Requirement
82
+ requirement: &16712340 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *17003180
90
+ version_requirements: *16712340
91
91
  description: commandline heroku account manager
92
92
  email: defaultstring@gmail.com
93
93
  executables:
@@ -112,6 +112,7 @@ files:
112
112
  - lib/shacho/runner.rb
113
113
  - lib/shacho/util.rb
114
114
  - shacho.gemspec
115
+ - spec/accounts/clear_account_spec.rb
115
116
  - spec/accounts/edit_account_spec.rb
116
117
  - spec/accounts/list_account_spec.rb
117
118
  - spec/accounts/new_account_spec.rb
@@ -135,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
136
  version: '0'
136
137
  segments:
137
138
  - 0
138
- hash: 734393450952432892
139
+ hash: 2105874688490618431
139
140
  required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  none: false
141
142
  requirements: