sfdcutil 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -6,7 +6,7 @@
6
6
  # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
7
  # Only full ruby name is supported here, for short names use:
8
8
  # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p194@trust_parser"
9
+ environment_id="ruby-1.9.3-p194@sfdcutil"
10
10
 
11
11
  # Uncomment the following lines if you want to verify rvm version per project
12
12
  # rvmrc_rvm_version="1.14.2 (stable)" # 1.10.1 seams as a safe start
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ # - "1.8.7"
4
+ # - "1.9.2"
5
+ - "1.9.3"
6
+ # - jruby-18mode # JRuby in 1.8 mode
7
+ - jruby-19mode # JRuby in 1.9 mode
8
+ # - rbx-18mode
9
+ # - rbx-19mode
10
+ # uncomment this line if your project needs to run something other than `rake`:
11
+ # script: bundle exec rspec spec
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  # A sample Gemfile
2
2
  source "https://rubygems.org"
3
3
 
4
- # Specify your gem's dependencies in test.gemspec
5
- gemspec
4
+ # Specify your gem's dependencies in sfdcutil.gemspec
5
+ gemspec :name => 'sfdcutil'
data/Gemfile.lock ADDED
@@ -0,0 +1,78 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sfdcutil (0.0.9)
5
+ nokogiri
6
+ term-ansicolor
7
+ thor
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ archive-tar-minitar (0.5.2)
13
+ aruba (0.5.0)
14
+ childprocess (= 0.2.3)
15
+ cucumber (>= 1.1.1)
16
+ ffi (>= 1.0.11)
17
+ rspec-expectations (>= 2.7.0)
18
+ builder (3.1.4)
19
+ childprocess (0.2.3)
20
+ ffi (~> 1.0.6)
21
+ columnize (0.3.6)
22
+ cucumber (1.2.1)
23
+ builder (>= 2.1.2)
24
+ diff-lcs (>= 1.1.3)
25
+ gherkin (~> 2.11.0)
26
+ json (>= 1.4.6)
27
+ diff-lcs (1.1.3)
28
+ ffi (1.0.11)
29
+ gherkin (2.11.5)
30
+ json (>= 1.4.6)
31
+ hashr (0.0.22)
32
+ json (1.7.5)
33
+ linecache19 (0.5.13)
34
+ ruby_core_source (>= 0.1.4)
35
+ multi_json (1.3.7)
36
+ nokogiri (1.5.5)
37
+ rake (0.9.2.2)
38
+ rspec (2.11.0)
39
+ rspec-core (~> 2.11.0)
40
+ rspec-expectations (~> 2.11.0)
41
+ rspec-mocks (~> 2.11.0)
42
+ rspec-core (2.11.1)
43
+ rspec-expectations (2.11.3)
44
+ diff-lcs (~> 1.1.3)
45
+ rspec-mocks (2.11.3)
46
+ ruby-debug-base19 (0.11.25)
47
+ columnize (>= 0.3.1)
48
+ linecache19 (>= 0.5.11)
49
+ ruby_core_source (>= 0.1.4)
50
+ ruby-debug19 (0.11.6)
51
+ columnize (>= 0.3.1)
52
+ linecache19 (>= 0.5.11)
53
+ ruby-debug-base19 (>= 0.11.19)
54
+ ruby_core_source (0.1.5)
55
+ archive-tar-minitar (>= 0.5.2)
56
+ simplecov (0.7.1)
57
+ multi_json (~> 1.0)
58
+ simplecov-html (~> 0.7.1)
59
+ simplecov-html (0.7.1)
60
+ term-ansicolor (1.0.7)
61
+ test-unit (2.5.2)
62
+ thor (0.16.0)
63
+ travis-lint (1.4.0)
64
+ hashr (>= 0.0.19)
65
+
66
+ PLATFORMS
67
+ ruby
68
+
69
+ DEPENDENCIES
70
+ aruba
71
+ cucumber
72
+ rake
73
+ rspec
74
+ ruby-debug19
75
+ sfdcutil!
76
+ simplecov
77
+ test-unit
78
+ travis-lint
File without changes
data/README.md CHANGED
@@ -1,83 +1,91 @@
1
- # SFDCUtil
1
+ # SFDCUtil [![Build Status](https://secure.travis-ci.org/johnrizzo1/sfdcutil.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/johnrizzo1/sfdcutil.png?travis)][gemnasium]
2
+ SFDCUtil is a set of libraries that I've created to help me perform common tasks
3
+ for working with salesforce.com as well as a command line tool for using some of
4
+ the features.
2
5
 
3
- SFDCUtil is a set of libraries that I've created to help me perform common tasks for working with salesforce.com
6
+ [travis]: http://travis-ci.org/johnrizzo1/sfdcutil
7
+ [gemnasium]: https://gemnasium.com/johnrizzo1/sfdcutil
4
8
 
5
9
  ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- $ gem 'sfdcutil'
10
-
11
- And then execute:
10
+ Add require 'sfdcutil' to your Gemfile and execute:
12
11
 
13
12
  $ bundle
14
13
 
15
- Or install it yourself as:
14
+ Or install it yourself:
16
15
 
17
16
  $ gem install sfdcutil
18
17
 
19
- ## Usage
18
+ ## Resources
19
+ * [View Source on GitHub][code]
20
+ * [Report Issues on GitHub][issues]
21
+ * [Read More at the Wiki][wiki]
20
22
 
21
- $ sfdcutil -h
22
- Usage: sfdcutil COMMAND [OPTIONS]
23
+ [code]: https://github.com/johnrizzo1/sfdcutil
24
+ [issues]: https://github.com/johnrizzo1/sfdcutil/issues
25
+ [wiki]: https://wiki.github.com/johnrizzo1/sfdcutil
23
26
 
24
- Commands
25
- trust:status - get the status of all instances
27
+ ## Usage Examples
26
28
 
27
- Options
28
- -u, --url URL trust URL
29
- -i, --instance INSTANCE which instance do you want to get the status of
30
- -v, --[no-]verbose Run verbosely
31
- -h, --help help
29
+ $ sfdcutil -h
30
+ Usage: sfdcutil COMMAND [OPTIONS]
31
+
32
+ Commands
33
+ trust:status - get the status of all instances
34
+
35
+ Options
36
+ -u, --url URL trust URL
37
+ -i, --instance INSTANCE which instance do you want to get the status of
38
+ -v, --[no-]verbose Run verbosely
39
+ -h, --help help
32
40
 
33
41
  Getting a single instance status
34
42
 
35
- $ sfdcutil trust:status --instance "NA1"
36
- Instance Status
37
- NA1 Instance available
43
+ $ sfdcutil trust:status --instance "NA1"
44
+ Instance Status
45
+ NA1 Instance available
38
46
 
39
47
  Get a status of all instances
40
48
 
41
- $ sfdcutil trust:status
42
- Instance Status
43
- AP0 (Japan) Instance available
44
- AP1 (APAC) Instance available
45
- EU0 (EMEA) Instance available
46
- EU1 Instance available
47
- EU2 Instance available
48
- NA0 (SSL) Instance available
49
- NA1 Instance available
50
- NA2 Instance available
51
- NA3 Instance available
52
- NA4 Instance available
53
- NA5 Instance available
54
- NA6 Instance available
55
- NA7 Instance available
56
- NA8 Instance available
57
- NA9 Instance available
58
- NA10 Instance available
59
- NA11 Instance available
60
- NA12 Instance available
61
- NA13 Instance available
62
- NA14 Instance available
63
- CS0 (TAPP0) Instance available
64
- CS1 Instance available
65
- CS2 Instance available
66
- CS3 Instance available
67
- CS4 Instance available
68
- CS5 Instance available
69
- CS6 Instance available
70
- CS7 Instance available
71
- CS8 Instance available
72
- CS9 Instance available
73
- CS10 Instance available
74
- CS11 Instance available
75
- CS12 Instance available
76
- CS13 Instance available
77
- CS14 Instance available
78
- CS15 Instance available
79
- CS16 Instance available
80
- CS17 Instance available
49
+ $ sfdcutil trust:status
50
+ Instance Status
51
+ AP0 (Japan) Instance available
52
+ AP1 (APAC) Instance available
53
+ EU0 (EMEA) Instance available
54
+ EU1 Instance available
55
+ EU2 Instance available
56
+ NA0 (SSL) Instance available
57
+ NA1 Instance available
58
+ NA2 Instance available
59
+ NA3 Instance available
60
+ NA4 Instance available
61
+ NA5 Instance available
62
+ NA6 Instance available
63
+ NA7 Instance available
64
+ NA8 Instance available
65
+ NA9 Instance available
66
+ NA10 Instance available
67
+ NA11 Instance available
68
+ NA12 Instance available
69
+ NA13 Instance available
70
+ NA14 Instance available
71
+ CS0 (TAPP0) Instance available
72
+ CS1 Instance available
73
+ CS2 Instance available
74
+ CS3 Instance available
75
+ CS4 Instance available
76
+ CS5 Instance available
77
+ CS6 Instance available
78
+ CS7 Instance available
79
+ CS8 Instance available
80
+ CS9 Instance available
81
+ CS10 Instance available
82
+ CS11 Instance available
83
+ CS12 Instance available
84
+ CS13 Instance available
85
+ CS14 Instance available
86
+ CS15 Instance available
87
+ CS16 Instance available
88
+ CS17 Instance available
81
89
 
82
90
  ## Contributing
83
91
 
@@ -94,14 +102,34 @@ I can be reached by sending an email to johnrizzo1 at gmail dot com
94
102
 
95
103
  I am currently a Salesforce.com employee. The views expressed are my own and not those of salesforce.com
96
104
 
97
- ## TODO
105
+ ## Supported Ruby Versions
106
+ This library aims to support and is [tested against][travis] the following Ruby
107
+ implementations:
98
108
 
99
- 1. Fix the code so that querying a specific POD works properly.
109
+ * Ruby 1.9.3
110
+ * [JRuby][]
100
111
 
101
- ## Versions
112
+ [jruby]: http://www.jruby.org/
102
113
 
103
- 0.4 Fixed the script so that it works properly however it is not working when you query for a single org.
104
- 0.3 Fixed the script so that it now works with the latest site updates and prints out the proper colors for all
105
- status types.
106
- 0.2 Partially fixed an issue that occurred after the recent site changes
107
- 0.1 Initial version
114
+ If something doesn't work on one of these interpreters, it should be considered
115
+ a bug.
116
+
117
+ This library may inadvertently work (or seem to work) on other Ruby
118
+ implementations, however support will only be provided for the versions listed
119
+ above.
120
+
121
+ If you would like this library to support another Ruby version, you may
122
+ volunteer to be a maintainer. Being a maintainer entails making sure all tests
123
+ run and pass on that implementation. When something breaks on your
124
+ implementation, you will be personally responsible for providing patches in a
125
+ timely fashion. If critical issues for a particular implementation exist at the
126
+ time of a major release, support for that Ruby version may be dropped.
127
+
128
+ ## Copyright
129
+ Copyright (c) 2012 John Rizzo.
130
+ See [LICENSE][] for details.
131
+ [license]: https://github.com/intridea/oauth2/blob/master/LICENSE.md
132
+
133
+ ## Versions
134
+ See [VERSIONS][] for details.
135
+ [versions]: https://github.com/johnrizzo1/sfdcutil/blob/master/VERSIONS.md
data/Rakefile CHANGED
@@ -1,8 +1,37 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
3
- require "rspec/core/rake_task"
1
+ require 'rubygems'
2
+ #require 'bundler'
3
+ #require 'bundler/setup'
4
+ require 'bundler/gem_tasks'
5
+ require 'rspec/core/rake_task'
4
6
 
5
7
  RSpec::Core::RakeTask.new
6
8
 
7
- task :default => :spec
8
- task :test => :spec
9
+ desc "Validate the Travis config"
10
+ task :travis do
11
+ system "travis-lint"
12
+ end
13
+
14
+ require 'rdoc/task'
15
+ desc "Generate RDOC documentation"
16
+ Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
18
+ rdoc.rdoc_dir = 'rdoc'
19
+ rdoc.title = "sfdcutil #{version}"
20
+ rdoc.rdoc_files.include('README*')
21
+ rdoc.rdoc_files.include('lib/**/*.rb')
22
+ rdoc.rdoc_files.include('LICENSE*')
23
+ rdoc.rdoc_files.include('VERSIONS*')
24
+ rdoc.rdoc_files.include('COPYING*')
25
+ rdoc.rdoc_files.exclude('.idea*')
26
+ end
27
+
28
+ require 'cucumber'
29
+ require 'cucumber/rake/task'
30
+ desc "Test Features"
31
+ Cucumber::Rake::Task.new(:features, 'sfdcutil')
32
+
33
+ desc "Run the default tasks"
34
+ task :default => [:spec, :travis]
35
+
36
+ desc "Run All Tests"
37
+ task :test => [:spec, :features]
data/VERSIONS.md ADDED
@@ -0,0 +1,13 @@
1
+ # Version History
2
+
3
+ 0.9 Added rspec tests
4
+ Added cucumber tests
5
+ Refactored the gem config
6
+ Switched to Thor for the command line processing (possibly a mistake ;)
7
+ Leveraging term-ansicolor instead of the error prone method I was using
8
+ 0.4 Fixed the script so that it works properly however it is not working when you query for a single org.
9
+ 0.3 Fixed the script so that it now works with the latest site updates and prints out the proper colors for all
10
+ status types.
11
+ 0.2 Partially fixed an issue that occurred after the recent site changes
12
+ 0.1 Initial version
13
+
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'bash_completion.sh' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('sfdcutil', 'bash_completion.sh')
data/bin/sfdcutil CHANGED
@@ -1,95 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
+ require "sfdcutil/cli"
2
3
 
3
- require 'sfdcutil'
4
- require 'optparse'
5
- require 'ostruct'
6
- require 'pp'
7
-
8
- class SFDCUtilParser
9
- def self.parse(args)
10
- options = OpenStruct.new
11
- options.verbose = false
12
- options.url = nil
13
- options.instance = nil
14
- script_name = File.basename($0)
15
-
16
- opts = OptionParser.new do |opts|
17
- opts.banner = "Usage: " + script_name + " COMMAND [OPTIONS]"
18
- opts.separator ""
19
-
20
- opts.separator "Commands"
21
- opts.separator " trust:status - get the status of all instances"
22
-
23
- opts.separator ""
24
- opts.separator "Options"
25
-
26
- opts.on("-u", "--url URL", "trust URL") do |url|
27
- options.url = url
28
- end
29
-
30
- opts.on("-i", "--instance INSTANCE", "which instance do you want to get the status of") do |instance|
31
- options.instance = instance
32
- end
33
-
34
- opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
35
- options.verbose = v
36
- end
37
-
38
- opts.on("-h", "--help", "help") do
39
- puts opts
40
- end
41
- end
42
-
43
- opts.parse!(args)
44
- options.opts = opts
45
-
46
- options
47
- end
48
- end
49
-
50
- options = SFDCUtilParser.parse(ARGV)
51
- def colorize(text, color_code)
52
- "\e[#{color_code}m#{text}\e[0m"
53
- end
54
-
55
- RED = 31
56
- GREEN = 32
57
- YELLOW = 33
58
- BLUE = 34
59
- MAGENTA = 35
60
-
61
- case ARGV[0]
62
- when "trust:status"
63
- if options.url != nil
64
- trust = SFDCUtil::Trust.new(url)
65
- else
66
- trust = SFDCUtil::Trust.new
67
- end
68
-
69
- if options.instance != nil
70
- instances = trust.get_status(options.instance)
71
- else
72
- instances = trust.get_all_status
73
- end
74
-
75
- puts sprintf("%12s %s", "Instance", "Status")
76
- instances.each do |instance|
77
- color = RED
78
- if instance[:status] == "Instance available"
79
- color = GREEN
80
- elsif instance[:status] == "Performance issues"
81
- puts color = YELLOW
82
- elsif instance[:status] == "Service disruption"
83
- puts color = RED
84
- elsif instance[:status] == "Informational message"
85
- puts color = BLUE
86
- elsif instance[:status] == "Status not available"
87
- puts color = MAGENTA
88
- end
89
-
90
- puts colorize(sprintf("%12s %s" % [instance[:instance], instance[:status]]), color)
91
- end
92
- else
93
- puts options.opts
94
- end
95
-
4
+ SFDCUtil::CLI.start
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'autospec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'autospec')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'cucumber' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('cucumber', 'cucumber')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'decolor' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('term-ansicolor', 'decolor')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'htmldiff' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('diff-lcs', 'htmldiff')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'ldiff' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('diff-lcs', 'ldiff')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'minitar' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('archive-tar-minitar', 'minitar')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'nokogiri' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('nokogiri', 'nokogiri')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake2thor' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('thor', 'rake2thor')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rdebug' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('ruby-debug19', 'rdebug')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'rspec')