utopia 2.13.1 → 2.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/bake/utopia/test.rb +1 -1
- data/lib/utopia/command/environment.rb +29 -11
- data/lib/utopia/command/site.rb +3 -5
- data/lib/utopia/setup.rb +5 -5
- data/lib/utopia/version.rb +1 -1
- data/setup/site/.gitignore +1 -0
- data/spec/utopia/command_spec.rb +8 -17
- data/utopia.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b55bff1afd9814b453d84f5539d06fb4e969c804bedae04eb40259ff934b2097
|
4
|
+
data.tar.gz: 4483a3359f05949c3952ff22e4d6bd3f34907e861b2da9e8b75ed77a84d8b6a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4512d2aae4b421a2a10cf5ccb50badfa4dee7792ab59dabb79eaab0792e9bed35f5f61a0a1bbe04e38acbed98bdf714583de7f75cbded5ac2fcea6112c28b89
|
7
|
+
data.tar.gz: b5ae7a176dedc1af47f5e2a8a57b3d8168de33f11824b607e972d5c6eba81d409583626cff3bc4daedd4ba8c3166a18015c554a418b3e65999d1bfd3fc56b4b1
|
data/.travis.yml
CHANGED
data/bake/utopia/test.rb
CHANGED
@@ -22,6 +22,7 @@
|
|
22
22
|
|
23
23
|
require 'securerandom'
|
24
24
|
require 'yaml/store'
|
25
|
+
require 'console'
|
25
26
|
|
26
27
|
module Utopia
|
27
28
|
module Command
|
@@ -31,27 +32,41 @@ module Utopia
|
|
31
32
|
|
32
33
|
options do
|
33
34
|
option '-e/--environment-name <name>', "The environment file to modify.", default: 'environment'
|
35
|
+
option '-d/--defaults', "Initialize any recommended defaults."
|
34
36
|
end
|
35
37
|
|
36
38
|
many :variables, "A list of environment KEY=VALUE pairs to set."
|
37
39
|
|
40
|
+
def self.defaults(destination_root)
|
41
|
+
# Set some useful defaults for the environment.
|
42
|
+
self["--environment-name", "testing", "--defaults"].call(destination_root)
|
43
|
+
self["--environment-name", "development", "--defaults"].call(destination_root)
|
44
|
+
end
|
45
|
+
|
46
|
+
def environment_name
|
47
|
+
@options[:environment_name]
|
48
|
+
end
|
49
|
+
|
38
50
|
# Setup `config/environment.yaml` according to specified options.
|
39
|
-
def update_environment(root, name =
|
51
|
+
def update_environment(root, name = self.environment_name)
|
40
52
|
environment_path = File.join(root, "config", "#{name}.yaml")
|
41
53
|
FileUtils.mkpath File.dirname(environment_path)
|
42
54
|
|
43
55
|
store = YAML::Store.new(environment_path)
|
44
56
|
|
45
57
|
store.transaction do
|
46
|
-
yield store
|
58
|
+
yield store, name, environment_path
|
47
59
|
end
|
48
60
|
end
|
49
61
|
|
50
|
-
def
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
62
|
+
def call(root = parent.root)
|
63
|
+
update_environment(root) do |store, name, path|
|
64
|
+
if @options[:defaults]
|
65
|
+
# Set some useful defaults for the environment.
|
66
|
+
store['UTOPIA_SESSION_SECRET'] ||= SecureRandom.hex(40)
|
67
|
+
end
|
68
|
+
|
69
|
+
variables&.each do |variable|
|
55
70
|
key, value = variable.split('=', 2)
|
56
71
|
|
57
72
|
if value
|
@@ -63,10 +78,13 @@ module Utopia
|
|
63
78
|
end
|
64
79
|
end
|
65
80
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
81
|
+
Console.logger.debug(self) do |buffer|
|
82
|
+
buffer.puts "Environment #{name} (#{path}):"
|
83
|
+
store.roots.each do |key|
|
84
|
+
value = store[key]
|
85
|
+
|
86
|
+
buffer.puts "#{key}=#{value.inspect}"
|
87
|
+
end
|
70
88
|
end
|
71
89
|
end
|
72
90
|
end
|
data/lib/utopia/command/site.rb
CHANGED
@@ -99,11 +99,7 @@ module Utopia
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
|
103
|
-
environment = Environment[]
|
104
|
-
environment.update_environment(destination_root, :testing) do |store|
|
105
|
-
store['UTOPIA_SESSION_SECRET'] ||= SecureRandom.hex(40)
|
106
|
-
end
|
102
|
+
Environment.defaults(destination_root)
|
107
103
|
|
108
104
|
name = `git config user.name || whoami`.chomp
|
109
105
|
|
@@ -177,6 +173,8 @@ module Utopia
|
|
177
173
|
File.open(destination_path, "w") { |file| file.write(buffer) }
|
178
174
|
end
|
179
175
|
|
176
|
+
Environment.defaults(destination_root)
|
177
|
+
|
180
178
|
begin
|
181
179
|
Dir.chdir(destination_root) do
|
182
180
|
# Stage any files that have been changed or removed:
|
data/lib/utopia/setup.rb
CHANGED
@@ -113,11 +113,11 @@ module Utopia
|
|
113
113
|
Utopia.logger.debug(self) {"Loading environment at path: #{path.inspect}"}
|
114
114
|
|
115
115
|
# Load the YAML environment file:
|
116
|
-
environment = YAML.load_file(path)
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
116
|
+
if environment = YAML.load_file(path)
|
117
|
+
# We update ENV but only when it's not already set to something:
|
118
|
+
ENV.update(environment) do |name, old_value, new_value|
|
119
|
+
old_value || new_value
|
120
|
+
end
|
121
121
|
end
|
122
122
|
|
123
123
|
return true
|
data/lib/utopia/version.rb
CHANGED
data/setup/site/.gitignore
CHANGED
data/spec/utopia/command_spec.rb
CHANGED
@@ -28,16 +28,13 @@ require 'open3'
|
|
28
28
|
require 'bundler'
|
29
29
|
|
30
30
|
RSpec.describe "utopia command" do
|
31
|
+
let(:utopia_path) {File.expand_path("../..", __dir__)}
|
32
|
+
let(:pkg_path) {File.expand_path("pkg", utopia_path)}
|
31
33
|
let(:utopia) {File.expand_path("../../bin/utopia", __dir__)}
|
32
|
-
let(:gemspec) {Gem::Specification.load File.expand_path("../../utopia.gemspec", __dir__)}
|
33
|
-
let(:package_path) {File.expand_path("../../pkg/#{gemspec.file_name}", __dir__)}
|
34
34
|
|
35
35
|
before(:all) do
|
36
36
|
# We need to build a package to test deployment:
|
37
37
|
system("rake", "build") or abort("Could not build package for setup spec!")
|
38
|
-
|
39
|
-
ENV['DEPLOY_USER'] = 'http'
|
40
|
-
ENV['DEPLOY_GROUP'] = 'http'
|
41
38
|
end
|
42
39
|
|
43
40
|
around(:each) do |example|
|
@@ -45,9 +42,6 @@ RSpec.describe "utopia command" do
|
|
45
42
|
# If we don't delete this, when running on travis, it will try submit the coverage report.
|
46
43
|
ENV.delete('COVERAGE')
|
47
44
|
|
48
|
-
# This allows the utopia command to load the correct library:
|
49
|
-
ENV['RUBYLIB'] = File.expand_path("../../lib", __dir__)
|
50
|
-
|
51
45
|
example.run
|
52
46
|
end
|
53
47
|
end
|
@@ -75,24 +69,21 @@ RSpec.describe "utopia command" do
|
|
75
69
|
end
|
76
70
|
|
77
71
|
def install_packages(dir)
|
78
|
-
|
79
|
-
|
80
|
-
FileUtils.cp package_path, File.join(dir, "vendor/cache")
|
72
|
+
system("bundle", "config", "--local", "local.utopia", utopia_path, chdir: dir)
|
73
|
+
system("bundle", "config", "--local", "cache_path", pkg_path, chdir: dir)
|
81
74
|
end
|
82
75
|
|
83
76
|
it "should generate sample site" do
|
84
77
|
Dir.mktmpdir('test-site') do |dir|
|
85
78
|
install_packages(dir)
|
86
79
|
|
87
|
-
|
88
|
-
expect(result).to be == 0
|
80
|
+
system(utopia, "--in", dir, "site", "create")
|
89
81
|
|
90
82
|
expect(Dir.entries(dir)).to include(".yarnrc", ".git", "Gemfile", "Gemfile.lock", "README.md", "bake.rb", "config.ru", "lib", "pages", "public", "spec")
|
91
83
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
end
|
84
|
+
expect(
|
85
|
+
system("bundle", "exec", "bake", "utopia:test", chdir: dir)
|
86
|
+
).to be true
|
96
87
|
end
|
97
88
|
end
|
98
89
|
|
data/utopia.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.required_ruby_version = '~> 2.
|
24
|
+
spec.required_ruby_version = '~> 2.5'
|
25
25
|
|
26
26
|
spec.add_dependency 'trenni', '~> 3.0'
|
27
27
|
spec.add_dependency 'mime-types', '~> 3.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.13.
|
4
|
+
version: 2.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trenni
|
@@ -813,14 +813,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
813
813
|
requirements:
|
814
814
|
- - "~>"
|
815
815
|
- !ruby/object:Gem::Version
|
816
|
-
version: '2.
|
816
|
+
version: '2.5'
|
817
817
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
818
818
|
requirements:
|
819
819
|
- - ">="
|
820
820
|
- !ruby/object:Gem::Version
|
821
821
|
version: '0'
|
822
822
|
requirements: []
|
823
|
-
rubygems_version: 3.
|
823
|
+
rubygems_version: 3.1.2
|
824
824
|
signing_key:
|
825
825
|
specification_version: 4
|
826
826
|
summary: Utopia is a framework for building dynamic content-driven websites.
|