codefumes 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.1.4 2009-09-26
2
+
3
+ * Updated require statements executables
4
+
1
5
  == 0.1.3 2009-09-22
2
6
 
3
7
  * Added ConfigFile#save_credentials
data/bin/cf_claim_project CHANGED
@@ -3,7 +3,7 @@
3
3
  # Created on 2009-9-21.
4
4
  # Copyright (c) 2009. All rights reserved.
5
5
 
6
- require 'lib/codefumes'
7
- require "lib/cf_claim_project/cli"
6
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/codefumes")
7
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/cf_claim_project/cli")
8
8
 
9
9
  CfClaimProject::CLI.execute(STDOUT, ARGV)
@@ -5,6 +5,6 @@
5
5
 
6
6
  require 'rubygems'
7
7
  require File.expand_path(File.dirname(__FILE__) + "/../lib/codefumes")
8
- require "lib/store_codefumes_credentials/cli"
8
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/store_codefumes_credentials/cli")
9
9
 
10
10
  StoreCodefumesCredentials::CLI.execute(STDOUT, ARGV)
@@ -47,7 +47,7 @@ module CfClaimProject
47
47
  opts.parse!(arguments)
48
48
  end
49
49
 
50
- @public_keys = claim_all_projects_flag_set? ? ConfigFile.public_keys : [ARGV[0]].compact
50
+ @public_keys = claim_all_projects_flag_set? ? ConfigFile.public_keys : arguments.compact
51
51
  if @public_keys.empty?
52
52
  print_missing_arguments_message
53
53
  exit
data/lib/codefumes.rb CHANGED
@@ -8,5 +8,5 @@ require 'codefumes/payload'
8
8
  require 'codefumes/project'
9
9
 
10
10
  module CodeFumes
11
- VERSION = '0.1.3'
11
+ VERSION = '0.1.4'
12
12
  end
@@ -3,26 +3,27 @@ require 'optparse'
3
3
  module StoreCodefumesCredentials
4
4
  class CLI
5
5
  def self.execute(stdout, arguments=[])
6
- parse_command_line_options!(stdout, arguments)
6
+ @stdout = stdout
7
+ parse_command_line_options!(arguments)
8
+ api_key = arguments.first
7
9
 
8
- api_key = ARGV[0]
9
10
  if CodeFumes::ConfigFile.credentials.empty? || @force_overwrite == true
10
11
  CodeFumes::ConfigFile.save_credentials(api_key)
11
- stdout.puts "Saved credentials to codefumes config file.\n\nExiting."
12
+ @stdout.puts "Saved credentials to codefumes config file.\n\nExiting."
12
13
  else
13
14
  if CodeFumes::ConfigFile.credentials == api_key
14
- stdout.puts "Credentials already stored in config file!\n"
15
+ @stdout.puts "Credentials already stored in config file!\n"
15
16
  else
16
- stdout.puts "You have already stored CodeFumes credentials.\n\n"
17
- stdout.puts "The current value you have stored is: #{CodeFumes::ConfigFile.credentials[:api_key]}\n\n"
18
- stdout.puts "If you would like to replace this value, execute:\n\n"
19
- stdout.puts "\t#{File.basename($0)} --force #{api_key}\n\n"
17
+ @stdout.puts "You have already stored CodeFumes credentials.\n\n"
18
+ @stdout.puts "The current value you have stored is: #{CodeFumes::ConfigFile.credentials[:api_key]}\n\n"
19
+ @stdout.puts "If you would like to replace this value, execute:\n\n"
20
+ @stdout.puts "\t#{File.basename($0)} --force #{api_key}\n\n"
20
21
  end
21
22
  end
22
23
  end
23
24
 
24
25
  private
25
- def self.parse_command_line_options!(stdout, arguments = [])
26
+ def self.parse_command_line_options!(arguments)
26
27
  @force_overwrite = false
27
28
 
28
29
  parser = OptionParser.new do |opts|
@@ -35,13 +36,13 @@ module StoreCodefumesCredentials
35
36
  BANNER
36
37
  opts.separator ""
37
38
  opts.on("-h", "--help",
38
- "Show this help message.") { stdout.puts opts; exit }
39
+ "Show this help message.") { @stdout.puts opts; exit }
39
40
  opts.on("-f", "--force",
40
41
  "Force overwrite of existing API key in config file.") { @force_overwrite = true }
41
42
  opts.parse!(arguments)
42
43
 
43
- if ARGV[0].nil?
44
- stdout.puts opts; exit
44
+ if arguments.size != 1
45
+ @stdout.puts opts; exit
45
46
  end
46
47
  end
47
48
  end
@@ -3,13 +3,15 @@ require 'lib/cf_claim_project/cli'
3
3
 
4
4
  describe CfClaimProject::CLI, "execute" do
5
5
  before(:each) do
6
+ @project = Project.new(:public_key => "pub", :private_key => "prv_key")
7
+ Project.stub!(:find).and_return(@project)
6
8
  ConfigFile.save_credentials("sample_credentials")
7
- Project.stub!(:find).and_return(mock(Project))
9
+ ConfigFile.save_project(@project)
8
10
  @stdout_io = StringIO.new
9
11
  end
10
12
 
11
13
  it "calls Claim#create" do
12
14
  Claim.should_receive(:create)
13
- CfClaimProject::CLI.execute(@stdout_io, [])
15
+ CfClaimProject::CLI.execute(@stdout_io, [@project.public_key])
14
16
  end
15
17
  end
@@ -9,14 +9,15 @@ describe StoreCodefumesCredentials::CLI, "execute" do
9
9
  end
10
10
 
11
11
  before(:each) do
12
- @api_key_value = "API_KEY"
12
+ @api_key_value = "API_KEY#{rand(100)}"
13
13
  @stdout_io = StringIO.new
14
14
  StoreCodefumesCredentials::CLI.execute(@stdout_io, [@api_key_value])
15
15
  @stdout_io.rewind
16
16
  @stdout = @stdout_io.read
17
17
  end
18
18
 
19
- it "store the value supplied as an argument in the config file" do
19
+ it "stores the value supplied in the config file under the key ':api_key'" do
20
20
  ConfigFile.credentials.keys.should include(:api_key)
21
+ ConfigFile.credentials[:api_key].should == @api_key_value
21
22
  end
22
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codefumes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Kersten
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-22 00:00:00 -05:00
13
+ date: 2009-09-26 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency