socialcast 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/socialcast/cli.rb +11 -2
- data/lib/socialcast/version.rb +1 -1
- data/socialcast.gemspec +1 -1
- data/spec/cli_spec.rb +16 -10
- metadata +23 -29
data/lib/socialcast/cli.rb
CHANGED
@@ -106,10 +106,12 @@ module Socialcast
|
|
106
106
|
end
|
107
107
|
return
|
108
108
|
end
|
109
|
-
|
109
|
+
|
110
110
|
fail "Unable to load configuration file: #{config_file}" unless File.exists?(config_file)
|
111
111
|
say "Using configuration file: #{config_file}"
|
112
|
-
|
112
|
+
|
113
|
+
config = load_configuration config_file
|
114
|
+
|
113
115
|
required_mappings = %w{email first_name last_name}
|
114
116
|
mappings = config.fetch 'mappings', {}
|
115
117
|
required_mappings.each do |field|
|
@@ -169,5 +171,12 @@ module Socialcast
|
|
169
171
|
end
|
170
172
|
File.delete(output_file) if (config['options']['delete_users_file'] || options[:delete_users_file])
|
171
173
|
end
|
174
|
+
|
175
|
+
no_tasks do
|
176
|
+
def load_configuration(path)
|
177
|
+
YAML.load_file path
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
172
181
|
end
|
173
182
|
end
|
data/lib/socialcast/version.rb
CHANGED
data/socialcast.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_runtime_dependency 'json', '>= 1.4.6'
|
19
19
|
s.add_runtime_dependency 'thor', '>= 0.14.6'
|
20
20
|
s.add_runtime_dependency 'highline', '>= 1.6.2'
|
21
|
-
s.add_runtime_dependency '
|
21
|
+
s.add_runtime_dependency 'socialcast-net-ldap', '>= 0.1.5'
|
22
22
|
s.add_runtime_dependency 'activeresource', '>= 2.3.11'
|
23
23
|
s.add_development_dependency "rspec", '>= 2.6.0'
|
24
24
|
s.add_development_dependency "webmock", '>= 1.7.7'
|
data/spec/cli_spec.rb
CHANGED
@@ -63,6 +63,11 @@ describe Socialcast::CLI do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
describe '#provision' do
|
66
|
+
before do
|
67
|
+
Socialcast::CLI.instance_eval do # to supress warning from stubbing load_configuration
|
68
|
+
@no_tasks = true
|
69
|
+
end
|
70
|
+
end
|
66
71
|
context 'with 0 users found in ldap' do
|
67
72
|
before do
|
68
73
|
Net::LDAP.any_instance.stub(:search).and_return(nil)
|
@@ -70,7 +75,7 @@ describe Socialcast::CLI do
|
|
70
75
|
@result = ''
|
71
76
|
Zlib::GzipWriter.stub(:open).and_yield(@result)
|
72
77
|
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
|
73
|
-
|
78
|
+
Socialcast::CLI.any_instance.should_receive(:load_configuration).with('/my/path/to/ldap.yml').and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap_without_permission_mappings.yml')))
|
74
79
|
File.should_receive(:exists?).with('/my/path/to/ldap.yml').and_return(true)
|
75
80
|
File.stub(:open).with(/users.xml.gz/, anything).and_yield(@result)
|
76
81
|
|
@@ -88,8 +93,9 @@ describe Socialcast::CLI do
|
|
88
93
|
@result = ''
|
89
94
|
Zlib::GzipWriter.stub(:open).and_yield(@result)
|
90
95
|
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
|
91
|
-
|
96
|
+
Socialcast::CLI.any_instance.should_receive(:load_configuration).with('/my/path/to/ldap.yml').and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap_without_permission_mappings.yml')))
|
92
97
|
File.should_receive(:exists?).with('/my/path/to/ldap.yml').and_return(true)
|
98
|
+
|
93
99
|
File.stub(:open).with(/users.xml.gz/, anything).and_yield(@result)
|
94
100
|
|
95
101
|
RestClient::Resource.any_instance.should_receive(:post).once
|
@@ -108,7 +114,7 @@ describe Socialcast::CLI do
|
|
108
114
|
@result = ''
|
109
115
|
Zlib::GzipWriter.stub(:open).and_yield(@result)
|
110
116
|
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
|
111
|
-
|
117
|
+
Socialcast::CLI.any_instance.should_receive(:load_configuration).with('/my/path/to/ldap.yml').and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap_without_permission_mappings.yml')))
|
112
118
|
File.should_receive(:exists?).with('/my/path/to/ldap.yml').and_return(true)
|
113
119
|
File.stub(:open).with(/users.xml.gz/, anything).and_yield(@result)
|
114
120
|
RestClient::Resource.any_instance.stub(:post)
|
@@ -127,7 +133,7 @@ describe Socialcast::CLI do
|
|
127
133
|
@result = ''
|
128
134
|
Zlib::GzipWriter.stub(:open).and_yield(@result)
|
129
135
|
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
|
130
|
-
|
136
|
+
Socialcast::CLI.any_instance.should_receive(:load_configuration).with(/ldap\.yml/).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap_without_permission_mappings.yml')))
|
131
137
|
File.stub(:open).with(/users.xml.gz/, anything).and_yield(@result)
|
132
138
|
|
133
139
|
RestClient::Resource.any_instance.stub(:post)
|
@@ -149,7 +155,7 @@ describe Socialcast::CLI do
|
|
149
155
|
@result = ''
|
150
156
|
Zlib::GzipWriter.stub(:open).and_yield(@result)
|
151
157
|
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
|
152
|
-
|
158
|
+
Socialcast::CLI.any_instance.should_receive(:load_configuration).with(/ldap.yml/).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap.yml')))
|
153
159
|
File.stub(:open).with(/users.xml.gz/, anything).and_yield(@result)
|
154
160
|
|
155
161
|
RestClient::Resource.any_instance.stub(:post)
|
@@ -171,7 +177,7 @@ describe Socialcast::CLI do
|
|
171
177
|
@result = ''
|
172
178
|
Zlib::GzipWriter.stub(:open).and_yield(@result)
|
173
179
|
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
|
174
|
-
|
180
|
+
Socialcast::CLI.any_instance.should_receive(:load_configuration).with(/ldap.yml/).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap_with_array_permission_mapping.yml')))
|
175
181
|
File.stub(:open).with(/users.xml.gz/, anything).and_yield(@result)
|
176
182
|
|
177
183
|
RestClient::Resource.any_instance.stub(:post)
|
@@ -194,7 +200,7 @@ describe Socialcast::CLI do
|
|
194
200
|
@result = ''
|
195
201
|
Zlib::GzipWriter.stub(:open).and_yield(@result)
|
196
202
|
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
|
197
|
-
|
203
|
+
Socialcast::CLI.any_instance.should_receive(:load_configuration).with(/ldap.yml/).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap.yml')))
|
198
204
|
File.stub(:open).with(/users.xml.gz/, anything).and_yield(@result)
|
199
205
|
|
200
206
|
RestClient::Resource.any_instance.stub(:post)
|
@@ -219,7 +225,7 @@ describe Socialcast::CLI do
|
|
219
225
|
@result = ''
|
220
226
|
Zlib::GzipWriter.stub(:open).and_yield(@result)
|
221
227
|
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
|
222
|
-
|
228
|
+
Socialcast::CLI.any_instance.should_receive(:load_configuration).with(/ldap.yml/).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap_with_array_permission_mapping.yml')))
|
223
229
|
File.stub(:open).with(/users.xml.gz/, anything).and_yield(@result)
|
224
230
|
|
225
231
|
RestClient::Resource.any_instance.stub(:post)
|
@@ -244,7 +250,7 @@ describe Socialcast::CLI do
|
|
244
250
|
@result = ''
|
245
251
|
Zlib::GzipWriter.stub(:open).and_yield(@result)
|
246
252
|
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
|
247
|
-
|
253
|
+
Socialcast::CLI.any_instance.should_receive(:load_configuration).with(/ldap.yml/).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap_with_array_permission_mapping.yml')))
|
248
254
|
File.stub(:open).with(/users.xml.gz/, anything).and_yield(@result)
|
249
255
|
|
250
256
|
RestClient::Resource.any_instance.stub(:post)
|
@@ -271,7 +277,7 @@ describe Socialcast::CLI do
|
|
271
277
|
@result = ''
|
272
278
|
Zlib::GzipWriter.stub(:open).and_yield(@result)
|
273
279
|
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
|
274
|
-
|
280
|
+
Socialcast::CLI.any_instance.should_receive(:load_configuration).with(/ldap.yml/).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap_with_interpolated_values.yml')))
|
275
281
|
File.stub(:open).with(/users.xml.gz/, anything).and_yield(@result)
|
276
282
|
|
277
283
|
RestClient::Resource.any_instance.stub(:post)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socialcast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-06-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
17
|
-
requirement: &
|
17
|
+
requirement: &2155944280 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 1.4.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2155944280
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: json
|
28
|
-
requirement: &
|
28
|
+
requirement: &2151820520 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.4.6
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2151820520
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: thor
|
39
|
-
requirement: &
|
39
|
+
requirement: &2151804340 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 0.14.6
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2151804340
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: highline
|
50
|
-
requirement: &
|
50
|
+
requirement: &2151803720 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,21 +55,21 @@ dependencies:
|
|
55
55
|
version: 1.6.2
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2151803720
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
61
|
-
requirement: &
|
60
|
+
name: socialcast-net-ldap
|
61
|
+
requirement: &2151803040 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: 0.1.
|
66
|
+
version: 0.1.5
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *2151803040
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: activeresource
|
72
|
-
requirement: &
|
72
|
+
requirement: &2151802160 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 2.3.11
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *2151802160
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: rspec
|
83
|
-
requirement: &
|
83
|
+
requirement: &2151801560 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ! '>='
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 2.6.0
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *2151801560
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: webmock
|
94
|
-
requirement: &
|
94
|
+
requirement: &2151801040 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: 1.7.7
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *2151801040
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: rake
|
105
|
-
requirement: &
|
105
|
+
requirement: &2151800380 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - =
|
@@ -110,7 +110,7 @@ dependencies:
|
|
110
110
|
version: 0.9.2.2
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *2151800380
|
114
114
|
description: publish messages to your stream from a command line interface
|
115
115
|
email:
|
116
116
|
- ryan@socialcast.com
|
@@ -159,21 +159,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
159
|
- - ! '>='
|
160
160
|
- !ruby/object:Gem::Version
|
161
161
|
version: '0'
|
162
|
-
segments:
|
163
|
-
- 0
|
164
|
-
hash: 4411756108143482154
|
165
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
163
|
none: false
|
167
164
|
requirements:
|
168
165
|
- - ! '>='
|
169
166
|
- !ruby/object:Gem::Version
|
170
167
|
version: '0'
|
171
|
-
segments:
|
172
|
-
- 0
|
173
|
-
hash: 4411756108143482154
|
174
168
|
requirements: []
|
175
169
|
rubyforge_project: socialcast
|
176
|
-
rubygems_version: 1.8.
|
170
|
+
rubygems_version: 1.8.10
|
177
171
|
signing_key:
|
178
172
|
specification_version: 3
|
179
173
|
summary: command line interface to socialcast api
|