dice_bag 0.9.0 → 1.0.0
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.
- checksums.yaml +4 -4
- data/lib/dice_bag/command.rb +11 -5
- data/lib/dice_bag/default_template_file.rb +1 -17
- data/lib/dice_bag/dice_bag_file.rb +1 -1
- data/lib/dice_bag/tasks/config.rake +11 -5
- data/lib/dice_bag/templates/dalli.yml.dice +3 -3
- data/lib/dice_bag/templates/database.yml.dice +4 -4
- data/lib/dice_bag/version.rb +1 -1
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3aaa7d13ff48bfcf766fb7559829edab19fb14a
|
4
|
+
data.tar.gz: a35210f3327b715bf8bf77140558bb58dc33ed1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a864f3e35d47e30bcaf4d31c7804467e1b7d3f783f858b665d081e478051368092cf822a4b01b4ddda72bd4730bd908eafeee67a5863aaf1155dd0e4001a790
|
7
|
+
data.tar.gz: fbae72a262f02e8c7f3d100a579582503b9bf7f67fe505479fbf38640ab08bab3a06c9595e92a86327bb51ab54fdfc69f31da1ed00d695104ec4dacd5d0fdcdc
|
data/lib/dice_bag/command.rb
CHANGED
@@ -3,12 +3,19 @@ require 'dice_bag/project'
|
|
3
3
|
require 'dice_bag/config_file'
|
4
4
|
require 'dice_bag/template_file'
|
5
5
|
require 'dice_bag/default_template_file'
|
6
|
+
require 'thor'
|
6
7
|
|
7
8
|
module DiceBag
|
8
9
|
#This class seems a candidate to be converted to Thor, the problem is that we need to run
|
9
10
|
#in the same process than the rake task so all the gems are loaded before dice_bag
|
10
11
|
#is called and dice_bag can find what software is used in this project
|
11
12
|
class Command
|
13
|
+
include Thor::Base
|
14
|
+
include Thor::Actions
|
15
|
+
|
16
|
+
def self.source_root
|
17
|
+
Dir.pwd
|
18
|
+
end
|
12
19
|
|
13
20
|
def write_all(params = {})
|
14
21
|
Project.templates_to_generate.each do |template|
|
@@ -25,15 +32,14 @@ module DiceBag
|
|
25
32
|
end
|
26
33
|
|
27
34
|
|
28
|
-
def generate_all_templates
|
35
|
+
def generate_all_templates(force=false)
|
29
36
|
AvailableTemplates.all.each do |template|
|
30
|
-
generate_template(template)
|
37
|
+
generate_template(template, force)
|
31
38
|
end
|
32
39
|
end
|
33
40
|
|
34
|
-
def generate_template(default_template)
|
35
|
-
default_template.
|
36
|
-
default_template.create_file
|
41
|
+
def generate_template(default_template, force=false)
|
42
|
+
copy_file default_template.file, default_template.destination, force: force
|
37
43
|
end
|
38
44
|
|
39
45
|
end
|
@@ -18,24 +18,8 @@ module DiceBag
|
|
18
18
|
@filename = File.basename(name)
|
19
19
|
@file = name
|
20
20
|
@template_location = location
|
21
|
+
@destination = File.join(Project.root, @template_location, @filename)
|
21
22
|
end
|
22
23
|
|
23
|
-
def create_file
|
24
|
-
contents = read_template(@file)
|
25
|
-
rooted_template_location = File.join(Project.root, @template_location)
|
26
|
-
FileUtils.mkdir_p(rooted_template_location)
|
27
|
-
template_file = File.join(rooted_template_location, @filename)
|
28
|
-
File.open(template_file, 'w') do |file|
|
29
|
-
file.puts(contents)
|
30
|
-
end
|
31
|
-
puts "new template file generated in #{template_file}.
|
32
|
-
execute 'rake config:all' to get the corresponding configuration file."
|
33
|
-
end
|
34
|
-
|
35
|
-
def read_template(template)
|
36
|
-
# Some templates need the name of the project. We put a placeholder
|
37
|
-
# PROJECT_NAME there, it gets substituted by the real name of the project here
|
38
|
-
File.readlines(template).join.gsub("PROJECT_NAME", Project.name)
|
39
|
-
end
|
40
24
|
end
|
41
25
|
end
|
@@ -4,7 +4,7 @@ require 'dice_bag/version'
|
|
4
4
|
# configuration files, templates files in the project an templates files shipped with dicebag
|
5
5
|
module DiceBag
|
6
6
|
module DiceBagFile
|
7
|
-
attr_reader :file, :filename
|
7
|
+
attr_reader :file, :filename, :destination
|
8
8
|
@@overwrite_all = false
|
9
9
|
|
10
10
|
def assert_existence
|
@@ -22,16 +22,22 @@ namespace :config do
|
|
22
22
|
DiceBag::Command.new.write(filename)
|
23
23
|
end
|
24
24
|
|
25
|
-
desc
|
25
|
+
desc 'Generate all configuration file templates with interactive commands (use config:generate_all:force to replace all without asking for input)'
|
26
26
|
task :generate_all do
|
27
|
-
DiceBag::Command.new.generate_all_templates
|
27
|
+
DiceBag::Command.new.generate_all_templates(false)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
namespace :generate_all do
|
31
|
+
task :force do
|
32
|
+
DiceBag::Command.new.generate_all_templates(true)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'Generate specified template, optionally in the specified location with options to control file actions'
|
31
37
|
task :generate, :filename, :location do |t, args|
|
32
38
|
filename = args[:filename]
|
33
39
|
location = args[:location]
|
34
|
-
raise
|
35
|
-
DiceBag::Command.new.generate_template(DiceBag::DefaultTemplateFile.new(filename,location))
|
40
|
+
raise 'A filename needs to be provided' if filename.nil?
|
41
|
+
DiceBag::Command.new.generate_template(DiceBag::DefaultTemplateFile.new(filename, location), false)
|
36
42
|
end
|
37
43
|
end
|
@@ -7,9 +7,9 @@
|
|
7
7
|
# cache configuration code in config/environments/production.rb
|
8
8
|
|
9
9
|
development: &default
|
10
|
-
namespace:
|
11
|
-
host: localhost
|
12
|
-
port: 11211
|
10
|
+
namespace: <%= configured.memcached_namespace || 'your_project_namespace' %>
|
11
|
+
host: <%= configured.memcached_host || 'localhost' %>
|
12
|
+
port: <%= configured.memcached_port || 11211 %>
|
13
13
|
value_max_bytes: 52428800
|
14
14
|
compress: true
|
15
15
|
|
@@ -7,10 +7,10 @@
|
|
7
7
|
username: <%= configured[env].database_username || 'root' %>
|
8
8
|
password: <%= configured[env].database_password %>
|
9
9
|
host: <%= configured[env].database_host || 'localhost' %>
|
10
|
-
pool: 5
|
11
|
-
timeout: 5000
|
12
|
-
encoding: utf8
|
13
|
-
reconnect: false
|
10
|
+
pool: <%= configured[env].database_pool || 5 %>
|
11
|
+
timeout: <%= configured[env].database_timeout || 5000 %>
|
12
|
+
encoding: <%= configured[env].database_encoding || 'utf8' %>
|
13
|
+
reconnect: <%= configured[env].database_reconnect || false %>
|
14
14
|
<% db_cert = configured[env].database_ssl_cert %>
|
15
15
|
<%= db_cert ? "sslca: #{db_cert}" : '' %>
|
16
16
|
<% end %>
|
data/lib/dice_bag/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dice_bag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Smith
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -25,6 +25,34 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: thor
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0.0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: diff-lcs
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.0'
|
28
56
|
- !ruby/object:Gem::Dependency
|
29
57
|
name: aruba
|
30
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
147
|
version: '0'
|
120
148
|
requirements: []
|
121
149
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.4.8
|
123
151
|
signing_key:
|
124
152
|
specification_version: 4
|
125
153
|
summary: Dice Bag is a library of rake tasks for configuring web apps in the style
|