sfd2 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -11
- data/bin/sfd2 +2 -0
- data/lib/sfd2/sfd2.rb +55 -0
- data/lib/sfd2/utils.rb +36 -0
- data/lib/sfd2/version.rb +1 -1
- data/sfd2.gemspec +1 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83d0a3774c28b3a0fe654129dac824787afb602a
|
4
|
+
data.tar.gz: d0d1813532fa1adbc5b692daca3ae8c6a929a97d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5d49a99067ae483825617661c3cccd526a57dd32c55d6afe9137f2545dc91c63a67b434f0e4e6872202db11792649879c40ec9f3820955085b2930e1d347baa
|
7
|
+
data.tar.gz: 87b818805b58fe00c9fbc33792a03c070bf4f9e9887cd0a7134b2cf251eb59304a51c081f875734ef4204c453d03931cd5e704c2e180500bdbb94e895920cb52
|
data/README.md
CHANGED
@@ -1,24 +1,27 @@
|
|
1
1
|
# Sfd2
|
2
2
|
|
3
|
-
|
3
|
+
Downloads all of Salesforce documents by a single command.
|
4
|
+
Includes:
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
And then execute:
|
6
|
+
salesforce_soql_sosl.pdf
|
7
|
+
api_rest.pdf
|
8
|
+
apex_language_reference.pdf
|
9
|
+
pages_developers_guide.pdf
|
10
|
+
object_reference.pdf
|
11
|
+
salesforce1_guide.pdf
|
12
12
|
|
13
|
-
|
13
|
+
## Installation
|
14
14
|
|
15
|
-
|
15
|
+
Open your command line and run:
|
16
16
|
|
17
17
|
$ gem install sfd2
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
Open your command line and run:
|
22
|
+
|
23
|
+
$ sfd2
|
24
|
+
|
22
25
|
|
23
26
|
## Contributing
|
24
27
|
|
data/bin/sfd2
ADDED
data/lib/sfd2/sfd2.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__))
|
2
|
+
%w(utils).each do |file|
|
3
|
+
require "#{file}"
|
4
|
+
end
|
5
|
+
|
6
|
+
folder = File.join(Dir.home, "/Documents/SfDocuments#{Time.now}")
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
options[:folder] = folder
|
10
|
+
op = OptionParser.new do |opts|
|
11
|
+
opts.banner = Sfd2::HELP_MSG
|
12
|
+
opts.separator ''
|
13
|
+
|
14
|
+
opts.on("-f", String, "Show Salesforce downloads to folder") do |f|
|
15
|
+
puts folder
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on_tail("-h", "--help", "Show help message") do
|
20
|
+
puts op
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
op.parse(ARGV)
|
27
|
+
rescue Exception => e
|
28
|
+
abort e.message
|
29
|
+
end
|
30
|
+
|
31
|
+
Dir.mkdir(folder)
|
32
|
+
|
33
|
+
puts "Loading Salesforce documents..."
|
34
|
+
|
35
|
+
@sf_urls = %w{ http://www.salesforce.com/us/developer/docs/soql_sosl/salesforce_soql_sosl.pdf
|
36
|
+
http://www.salesforce.com/us/developer/docs/api_rest/api_rest.pdf
|
37
|
+
http://www.salesforce.com/us/developer/docs/apexcode/salesforce_apex_language_reference.pdf
|
38
|
+
http://www.salesforce.com/us/developer/docs/pages/salesforce_pages_developers_guide.pdf
|
39
|
+
http://www.salesforce.com/us/developer/docs/object_reference/object_reference.pdf
|
40
|
+
http://www.salesforce.com/us/developer/docs/salesforce1/salesforce1_guide.pdf
|
41
|
+
}
|
42
|
+
|
43
|
+
threads = []
|
44
|
+
|
45
|
+
@sf_urls.each do |url|
|
46
|
+
threads << Thread.new do
|
47
|
+
Sfd2.download(folder, url)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
threads.each { |t| t.join; puts "" }
|
52
|
+
|
53
|
+
puts ""
|
54
|
+
puts "Done! Please check it in this folder #{folder}."
|
55
|
+
|
data/lib/sfd2/utils.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__))
|
2
|
+
%w(open-uri progressbar).each do |file|
|
3
|
+
require "#{file}"
|
4
|
+
end
|
5
|
+
|
6
|
+
module Sfd2
|
7
|
+
extend self
|
8
|
+
|
9
|
+
HELP_MSG = "
|
10
|
+
Downloads all of Salesforce documents by a single command.
|
11
|
+
Usage:
|
12
|
+
run sfd2 in your command line:
|
13
|
+
$ sfd2 "
|
14
|
+
|
15
|
+
def download(folder, url)
|
16
|
+
file_path = "#{folder}/#{File.basename(url)}"
|
17
|
+
pbar = nil
|
18
|
+
begin
|
19
|
+
File.open(file_path, "wb") do |file|
|
20
|
+
file.write open(url,
|
21
|
+
:content_length_proc => lambda {|t|
|
22
|
+
if t && 0 < t
|
23
|
+
pbar = ProgressBar.new(File.basename(url).split('_')[1], t)
|
24
|
+
pbar.file_transfer_mode
|
25
|
+
end
|
26
|
+
},
|
27
|
+
:progress_proc => lambda {|s|
|
28
|
+
pbar.set s if pbar
|
29
|
+
}
|
30
|
+
).read
|
31
|
+
end
|
32
|
+
rescue Exception => e
|
33
|
+
puts e.message
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/sfd2/version.rb
CHANGED
data/sfd2.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sfd2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruce Yue
|
@@ -39,10 +39,25 @@ dependencies:
|
|
39
39
|
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: progressbar
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.21.0
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.21.0
|
42
56
|
description: TDownloads all of Salesforce documents by a single command
|
43
57
|
email:
|
44
58
|
- bruce.yue@outlook.com
|
45
|
-
executables:
|
59
|
+
executables:
|
60
|
+
- sfd2
|
46
61
|
extensions: []
|
47
62
|
extra_rdoc_files: []
|
48
63
|
files:
|
@@ -50,7 +65,10 @@ files:
|
|
50
65
|
- LICENSE.txt
|
51
66
|
- README.md
|
52
67
|
- Rakefile
|
68
|
+
- bin/sfd2
|
53
69
|
- lib/sfd2.rb
|
70
|
+
- lib/sfd2/sfd2.rb
|
71
|
+
- lib/sfd2/utils.rb
|
54
72
|
- lib/sfd2/version.rb
|
55
73
|
- sfd2.gemspec
|
56
74
|
homepage: https://www.sharealltech.com
|