socialcast 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -80,7 +80,7 @@ module Socialcast
80
80
  method_option :test, :type => :boolean
81
81
  method_option :skip_emails, :type => :boolean
82
82
  def provision
83
- config_file = File.join Dir.pwd, options[:config]
83
+ config_file = File.expand_path options[:config]
84
84
 
85
85
  if options[:setup]
86
86
  create_file config_file do
@@ -105,6 +105,7 @@ module Socialcast
105
105
  attributes = mappings.values
106
106
  attributes << membership_attribute
107
107
 
108
+ count = 0
108
109
  output_file = File.join Dir.pwd, options[:output]
109
110
  Zlib::GzipWriter.open(output_file) do |gz|
110
111
  xml = Builder::XmlMarkup.new(:target => gz, :indent => 1)
@@ -112,14 +113,12 @@ module Socialcast
112
113
  xml.export do |export|
113
114
  export.users(:type => "array") do |users|
114
115
  config["connections"].each_pair do |key, connection|
115
- say "Connecting to #{key} at #{[connection["host"], connection["port"]].join(':')} with filter #{connection["basedn"]}"
116
+ say "Connecting to #{key} at #{[connection["host"], connection["port"]].join(':')}"
116
117
 
117
118
  ldap = Net::LDAP.new :host => connection["host"], :port => connection["port"], :base => connection["basedn"]
118
119
  ldap.encryption connection['encryption'].to_sym if connection['encryption']
119
120
  ldap.auth connection["username"], connection["password"]
120
- say "Connected"
121
- say "Searching..."
122
- count = 0
121
+ say "Searching base DN: #{connection["basedn"]} with filter: #{connection["filter"]}"
123
122
 
124
123
  ldap.search(:return_result => false, :filter => connection["filter"], :base => connection["basedn"], :attributes => attributes) do |entry|
125
124
  next if entry.grab(mappings["email"]).blank? || (mappings.has_key?("unique_identifier") && entry.grab(mappings["unique_identifier"]).blank?)
@@ -128,16 +127,15 @@ module Socialcast
128
127
  entry.build_xml_from_mappings user, mappings, permission_mappings
129
128
  end
130
129
  count += 1
131
- say "Scanned #{count} users..." if ((count % 100) == 0)
130
+ say "Scanned #{count} users" if ((count % 100) == 0)
132
131
  end # search
133
132
  end # connections
134
133
  end # users
135
134
  end # export
136
135
  end # gzip
136
+ say "Finished scanning #{count} users"
137
137
 
138
- say "Finished Scanning"
139
- say "Sending to Socialcast"
140
-
138
+ say "Uploading dataset to Socialcast..."
141
139
  http_config = config.fetch('http', {})
142
140
  resource = Socialcast.resource_for_path '/api/users/provision', http_config
143
141
  File.open(output_file, 'r') do |file|
@@ -146,10 +144,9 @@ module Socialcast
146
144
  request_params[:test] = 'true' if (config['options']["test"] || options[:test])
147
145
  resource.post request_params
148
146
  end
147
+ say "Finished"
149
148
 
150
149
  File.delete(output_file) if (config['options']['delete_users_file'] || options[:delete_users_file])
151
-
152
- say "Finished"
153
150
  end
154
151
  end
155
152
  end
@@ -1,3 +1,3 @@
1
1
  module Socialcast
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
9
+ - 5
10
+ version: 1.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-20 00:00:00 Z
19
+ date: 2011-08-08 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rest-client