fluidfeatures-rails 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,47 +5,59 @@ module Fluidfeatures
|
|
5
5
|
|
6
6
|
def create_initializer_file
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
test_secret = gets.chomp
|
8
|
+
if File.file? CONFIG_FILE
|
9
|
+
config = YAML.load_file(CONFIG_FILE)
|
10
|
+
else
|
11
|
+
config = {
|
12
|
+
"common" => {
|
13
|
+
"base_uri" => "https://www.fluidfeatures.com/service",
|
14
|
+
"cache" => {
|
15
|
+
"enable" => false,
|
16
|
+
"dir" => "tmp/fluidfeatures",
|
17
|
+
"limit" => "10MB"
|
18
|
+
},
|
19
|
+
},
|
20
|
+
"development" => {},
|
21
|
+
"production" => {},
|
22
|
+
"test" => {},
|
23
|
+
}
|
24
|
+
end
|
26
25
|
|
27
|
-
puts "
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
26
|
+
puts "Enter FluidFeatures credentials [press enter to skip]"
|
27
|
+
["development", "production", "test"].each do |env|
|
28
|
+
config[env] ||= {}
|
29
|
+
["app_id", "secret", "base_uri"].each do |key|
|
30
|
+
if config[env][key] and config[env][key].size > 0
|
31
|
+
default = config[env][key]
|
32
|
+
elsif config["common"][key] and config["common"][key].size
|
33
|
+
default = config["common"][key]
|
34
|
+
end
|
35
|
+
print "%s %s %s: " % [
|
36
|
+
env,
|
37
|
+
key,
|
38
|
+
default ? "[#{default}]" : ""
|
39
|
+
]
|
40
|
+
value = gets.chomp.strip
|
41
|
+
if value and value.size > 0
|
42
|
+
config[env][key] = value
|
43
|
+
elsif default
|
44
|
+
config[env][key] = default
|
45
|
+
else
|
46
|
+
config[env][key] = nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
if config[env]["base_uri"] == config["common"]["base_uri"]
|
50
|
+
config[env].delete("base_uri")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
yaml = YAML.dump(config)
|
55
|
+
# remove "---" at top
|
56
|
+
yaml.sub!(/^---\r?\n/, "")
|
57
|
+
# add extra line between environments
|
58
|
+
yaml.gsub!(/(\r?\n)(\S)/) {|m| $1 + $1 + $2 }
|
59
|
+
|
60
|
+
create_file CONFIG_FILE, yaml
|
49
61
|
end
|
50
62
|
end
|
51
63
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "generators/fluidfeatures/
|
2
|
+
require "generators/fluidfeatures/config_generator"
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe Fluidfeatures::ConfigGenerator do
|
5
5
|
it "creates a configuration file" do
|
6
6
|
subject.should_receive(:create_file).with("config/fluidfeatures.yml", kind_of(String))
|
7
7
|
subject.create_initializer_file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluidfeatures-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -115,7 +115,7 @@ files:
|
|
115
115
|
- lib/pre_ruby192/uri.rb
|
116
116
|
- spec/controller_extentions_spec.rb
|
117
117
|
- spec/controller_spec.rb
|
118
|
-
- spec/generators/fluidfeatures/
|
118
|
+
- spec/generators/fluidfeatures/config_generator_spec.rb
|
119
119
|
- spec/initializer_spec.rb
|
120
120
|
- spec/routes_spec.rb
|
121
121
|
- spec/spec_helper.rb
|