embork 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/blueprint/Borkfile +0 -2
- data/lib/embork/borkfile.rb +0 -5
- data/lib/embork/builder.rb +0 -31
- data/lib/embork/cli.rb +1 -5
- data/lib/embork/server.rb +1 -4
- data/lib/embork/version.rb +1 -1
- data/spec/embork/borkfile/Borkfile.full +0 -2
- data/spec/embork/borkfile_spec.rb +0 -8
- data/spec/embork/builder_spec.rb +0 -37
- metadata +2 -4
- data/TODO.md +0 -16
- data/lib/embork/build_versions.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9070b93c526dd9629b5aead7b7b6aebd26fb862f
|
4
|
+
data.tar.gz: fd7f83264cf1ef557b651e2aa949a963c7efaf59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a842ca8cf62a16dc71b252f7cf60d4dc1570d30e5bd326948e7a7950ead0b8589ba988b0fbb82c5ef695eae3e84020693bdd0d64d920bcaf3f86588b1b09aab6
|
7
|
+
data.tar.gz: cc66126749406cff1a69358714aebde2d47d9831a0fdc722a5bd3032c3930160b5b4655c31e586bc4feb4bbca421a2623c57fba72e85c61220c3c9ae5238411d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 0.0.13
|
2
|
+
- Remove the ability to have embork clean up old versions. This is better
|
3
|
+
outsourced to your deployment solution. Also it was buggy.
|
4
|
+
|
1
5
|
# 0.0.12
|
2
6
|
- By default listen on 0.0.0.0 instead of localhost. 0.0.0.0 listens on all
|
3
7
|
interfaces. Localhost only answers local requests to 127.0.0.1.
|
data/blueprint/Borkfile
CHANGED
data/lib/embork/borkfile.rb
CHANGED
@@ -24,10 +24,6 @@ class Embork::Borkfile
|
|
24
24
|
@phrender_index_file = index_file_path || @phrender_index_file
|
25
25
|
end
|
26
26
|
|
27
|
-
def keep_old_versions(number_to_keep = nil)
|
28
|
-
@keep_old_versions = number_to_keep || @keep_old_versions
|
29
|
-
end
|
30
|
-
|
31
27
|
def es6_namespace(namespace = nil)
|
32
28
|
@es6_namespace = namespace || @es6_namespace
|
33
29
|
end
|
@@ -49,7 +45,6 @@ class Embork::Borkfile
|
|
49
45
|
@project_root = nil
|
50
46
|
@html = []
|
51
47
|
@backend = :static_index
|
52
|
-
@keep_old_versions = 5
|
53
48
|
@es6_namespace = nil
|
54
49
|
@frameworks = []
|
55
50
|
@logger = logger
|
data/lib/embork/builder.rb
CHANGED
@@ -4,11 +4,8 @@ require 'find'
|
|
4
4
|
require 'sprockets'
|
5
5
|
|
6
6
|
require 'embork/environment'
|
7
|
-
require 'embork/build_versions'
|
8
7
|
|
9
8
|
class Embork::Builder
|
10
|
-
include Embork::BuildVersions
|
11
|
-
|
12
9
|
def initialize(borkfile)
|
13
10
|
@borkfile = borkfile
|
14
11
|
@project_root = @borkfile.project_root
|
@@ -95,34 +92,6 @@ class Embork::Builder
|
|
95
92
|
@version
|
96
93
|
end
|
97
94
|
|
98
|
-
def clean
|
99
|
-
versions = sorted_versions @project_root
|
100
|
-
|
101
|
-
# If there are more than our threshold
|
102
|
-
if versions.length > @borkfile.keep_old_versions
|
103
|
-
|
104
|
-
# Grab the versions to keep
|
105
|
-
retained_versions = versions[0...@borkfile.keep_old_versions]
|
106
|
-
build_path = File.join(@project_root, 'build', Embork.env.to_s)
|
107
|
-
|
108
|
-
Find.find(build_path) do |file|
|
109
|
-
name = File.basename(file)
|
110
|
-
|
111
|
-
# Skip if this is an unversioned file
|
112
|
-
next unless version_name(file)
|
113
|
-
|
114
|
-
# If any version strings that we should retain are in the file name,
|
115
|
-
# skip to next. Otherwise, obliterate.
|
116
|
-
if retained_versions.any?{ |version| name.include?(version) }
|
117
|
-
next
|
118
|
-
else
|
119
|
-
Dir.chdir(build_path){ FileUtils.rm file }
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
end
|
125
|
-
|
126
95
|
def clean!
|
127
96
|
FileUtils.rm_rf File.join(@project_root, 'build', Embork.env.to_s)
|
128
97
|
end
|
data/lib/embork/cli.rb
CHANGED
@@ -60,15 +60,11 @@ class Embork::CLI < Thor
|
|
60
60
|
end
|
61
61
|
|
62
62
|
desc "build [ENVIRONMENT]", %{build the project in the 'build' directory}
|
63
|
-
option :
|
64
|
-
:desc => %{By default, older versions of the project are removed, only keeping the last few versions. This flag keeps all old versions.}
|
63
|
+
option :desc => %{By default, older versions of the project are removed, only keeping the last few versions. This flag keeps all old versions.}
|
65
64
|
def build(environment = :production)
|
66
65
|
borkfile = Embork::Borkfile.new options[:borkfile], environment
|
67
66
|
builder = Embork::Builder.new(borkfile)
|
68
67
|
builder.build
|
69
|
-
if !options[:keep_all_old_versions]
|
70
|
-
builder.clean
|
71
|
-
end
|
72
68
|
end
|
73
69
|
|
74
70
|
desc "clean", %{Remove all files under the build directory}
|
data/lib/embork/server.rb
CHANGED
@@ -4,11 +4,8 @@ require 'webrick'
|
|
4
4
|
require 'embork/environment'
|
5
5
|
require 'embork/pushstate'
|
6
6
|
require 'embork/forwarder'
|
7
|
-
require 'embork/build_versions'
|
8
7
|
|
9
8
|
class Embork::Server
|
10
|
-
include Embork::BuildVersions
|
11
|
-
|
12
9
|
attr_reader :backend
|
13
10
|
attr_reader :project_root
|
14
11
|
attr_reader :sprockets_environment
|
@@ -23,7 +20,7 @@ class Embork::Server
|
|
23
20
|
Embork.bundle_version = options[:bundle_version]
|
24
21
|
setup_bundled_mode
|
25
22
|
elsif options[:with_latest_bundle]
|
26
|
-
Embork.bundle_version =
|
23
|
+
Embork.bundle_version = File.read(File.join(borkfile.project_root, Embork.env, current-version))
|
27
24
|
setup_bundled_mode
|
28
25
|
elsif options[:enable_tests]
|
29
26
|
setup_test_mode
|
data/lib/embork/version.rb
CHANGED
@@ -35,10 +35,6 @@ describe 'Embork::Borkfile' do
|
|
35
35
|
expect(borkfile.html).to be_empty
|
36
36
|
end
|
37
37
|
|
38
|
-
it 'keeps five old versions' do
|
39
|
-
expect(borkfile.keep_old_versions).to eq(5)
|
40
|
-
end
|
41
|
-
|
42
38
|
it 'has no es6 module namespace defined' do
|
43
39
|
expect(borkfile.es6_namespace).to eq(nil)
|
44
40
|
end
|
@@ -101,10 +97,6 @@ describe 'Embork::Borkfile' do
|
|
101
97
|
expect(borkfile.backend).to eq(:static_index)
|
102
98
|
end
|
103
99
|
|
104
|
-
it 'keeps the specified number of old versions' do
|
105
|
-
expect(borkfile.keep_old_versions).to eq(10)
|
106
|
-
end
|
107
|
-
|
108
100
|
it 'sets up an es6 module namespace' do
|
109
101
|
expect(borkfile.es6_namespace).to eq('my-package')
|
110
102
|
end
|
data/spec/embork/builder_spec.rb
CHANGED
@@ -49,43 +49,6 @@ describe 'Embork::Builder' do
|
|
49
49
|
expect(built_files).to match_array(expected_files.map{ |f| f % [ @asset_bundle_version ] })
|
50
50
|
end
|
51
51
|
|
52
|
-
context '#clean' do
|
53
|
-
|
54
|
-
let(:versions) {
|
55
|
-
[
|
56
|
-
'49b65b48a44ead62720c1c649db8fb529f730bed',
|
57
|
-
'f15678d0862a572f898c54e50bc4f8e0bfcc5380',
|
58
|
-
'0779ed758aacf70705206964a7ebe79231f4537b',
|
59
|
-
'c5325c6a4bee73612f839b9b59e7bdfa566674cf',
|
60
|
-
'45c508baf8fafa8475e1b14a2169e69a1b51c2cb',
|
61
|
-
]
|
62
|
-
}
|
63
|
-
let(:expected_files) do
|
64
|
-
versions[0..3].map do |v|
|
65
|
-
"application-%s.js" % v
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
let(:unexpected_files) do
|
70
|
-
[ "application-%s.js" % @asset_bundle_version ]
|
71
|
-
end
|
72
|
-
|
73
|
-
before(:each) do
|
74
|
-
versions.each do |v|
|
75
|
-
FileUtils.touch File.join(build_directory, "application-%s.js" % v)
|
76
|
-
sleep 1 unless v == versions.last
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'keeps :keep_old_versions number of versions' do
|
81
|
-
# This is what we're testing
|
82
|
-
builder.clean
|
83
|
-
|
84
|
-
expect(built_files).to include(*expected_files)
|
85
|
-
expect(built_files).not_to include(*unexpected_files)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
52
|
context 'asset_helpers' do
|
90
53
|
let(:index_read) { File.read File.join(build_directory, 'index.html') }
|
91
54
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mina Smart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|
@@ -318,7 +318,6 @@ files:
|
|
318
318
|
- LICENSE.txt
|
319
319
|
- README.md
|
320
320
|
- Rakefile
|
321
|
-
- TODO.md
|
322
321
|
- bin/embork
|
323
322
|
- blueprint/Borkfile
|
324
323
|
- blueprint/Gemfile
|
@@ -365,7 +364,6 @@ files:
|
|
365
364
|
- embork.gemspec
|
366
365
|
- lib/embork.rb
|
367
366
|
- lib/embork/borkfile.rb
|
368
|
-
- lib/embork/build_versions.rb
|
369
367
|
- lib/embork/builder.rb
|
370
368
|
- lib/embork/cli.rb
|
371
369
|
- lib/embork/environment.rb
|
data/TODO.md
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
TODO
|
2
|
-
====
|
3
|
-
|
4
|
-
- [x] add helpers to run from built or generated files
|
5
|
-
- [x] Add html files to Borkfile. Discreet list of what to build. Don't assume.
|
6
|
-
- [x] Use no cache for erb files.
|
7
|
-
- [x] Add `:keep_old_versions` to Borkfile to configure the number of old versions
|
8
|
-
- [x] Create full blown example project.
|
9
|
-
- [x] Create blank Borkfile with all options presented and probably commented out.
|
10
|
-
- [x] Make module transpiler ignore components
|
11
|
-
- [x] Create cli to run server.
|
12
|
-
- [x] Add jj-abrams resolver
|
13
|
-
- [ ] Extend cli with clean, and hint
|
14
|
-
- [ ] add hint task
|
15
|
-
- [ ] build in qunit-runner
|
16
|
-
- [ ] build in prerender
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Embork::BuildVersions
|
2
|
-
VERSION_FORMAT_EXP = /[a-f0-9]{40}\.js/
|
3
|
-
|
4
|
-
def sorted_versions(project_root)
|
5
|
-
build_path = File.join(project_root, 'build', Embork.env.to_s)
|
6
|
-
|
7
|
-
versioned_files = []
|
8
|
-
Find.find(build_path) do |file|
|
9
|
-
versioned_files.push(file) if file.match VERSION_FORMAT_EXP
|
10
|
-
end
|
11
|
-
|
12
|
-
sorted_files = versioned_files.sort_by do |file|
|
13
|
-
File.mtime file
|
14
|
-
end
|
15
|
-
|
16
|
-
versions = sorted_files.map { |f| version_name f }
|
17
|
-
|
18
|
-
# Tidy up!
|
19
|
-
versions.uniq.reverse
|
20
|
-
end
|
21
|
-
|
22
|
-
def version_name(filename)
|
23
|
-
if match = filename.match(VERSION_FORMAT_EXP)
|
24
|
-
match[0]
|
25
|
-
else
|
26
|
-
nil
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|