embork 0.0.11 → 0.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a910ee84b65e01f8d7c3cd0c5fabf62e7867e7d
4
- data.tar.gz: 3f044dc257979b39af6f9c8deb0c288a6be4b7c6
3
+ metadata.gz: d18393fa8f72cada548910072121d0ed13d7fe22
4
+ data.tar.gz: 08105e21003afa74345ae86a79675d3cb8aa0d91
5
5
  SHA512:
6
- metadata.gz: 64a3b0bef1ac0f7a433e7d98d2e87b37e89424ae6e40399f47204b8f7b30993235c44d99acf43550da67ddb8202d7be62320016a59331f07b08c13bfebcf7368
7
- data.tar.gz: db7ffcb60145e206106ba3dadd7d4d96346492ddb5a3c0cafeae4dd57b158cf686ee600cd2d5412a186d07a3cbda949f9937e7bd35007e57815c694d9708e7fc
6
+ metadata.gz: 83117aeceb898442de7446e761e23aaaadc04bbc93599ed55ce6d9a26a07da3e5f4414352731d080df8605c87a3c691705ca033ec4da8bd7725366f4a40a9b5f
7
+ data.tar.gz: 52cda448b0673f535cdd4883e28d55316c655a5bd7cf79c8bb2dfef251c036613e72b5938fd785ccc883f9a51248f3ec222e503d72872fb356bf5e2cb280a019
@@ -1,3 +1,8 @@
1
+ # 0.0.12
2
+ - By default listen on 0.0.0.0 instead of localhost. 0.0.0.0 listens on all
3
+ interfaces. Localhost only answers local requests to 127.0.0.1.
4
+ - Take out keyword arguments so that embork can run through rubinius.
5
+
1
6
  # 0.0.11
2
7
  - Fix a bug where it was impossible to forward requests between sprockets and a
3
8
  dynamic backend in development mode.
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_runtime_dependency 'barber', '~> 0.4.2'
30
30
  spec.add_runtime_dependency 'colorize'
31
31
  spec.add_runtime_dependency 'qunit-runner', '~> 0.0.1'
32
- spec.add_runtime_dependency 'phrender', '~> 0.0.4'
32
+ spec.add_runtime_dependency 'phrender', '~> 0.0.5'
33
33
 
34
34
  spec.add_development_dependency 'bundler', '~> 1.3'
35
35
  spec.add_development_dependency 'rspec', '~> 3.0.0.beta1'
@@ -1,21 +1,29 @@
1
1
  module Embork::BuildVersions
2
- VERSION_FORMAT_EXP = /\d{4}\.\d{2}\.\d{2}\.\d{2}\.\d{2}\.\d{2}\.\d{4}/
2
+ VERSION_FORMAT_EXP = /[a-f0-9]{40}\.js/
3
3
 
4
4
  def sorted_versions(project_root)
5
5
  build_path = File.join(project_root, 'build', Embork.env.to_s)
6
6
 
7
- versions = []
7
+ versioned_files = []
8
8
  Find.find(build_path) do |file|
9
- version = version_name(file)
10
- versions.push version if version
9
+ versioned_files.push(file) if file.match VERSION_FORMAT_EXP
11
10
  end
12
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
+
13
18
  # Tidy up!
14
- versions.uniq!.sort!.reverse!
19
+ versions.uniq.reverse
15
20
  end
16
21
 
17
22
  def version_name(filename)
18
- m = File.basename(filename).match VERSION_FORMAT_EXP
19
- m.nil? ? false : m[0]
23
+ if match = filename.match(VERSION_FORMAT_EXP)
24
+ match[0]
25
+ else
26
+ nil
27
+ end
20
28
  end
21
29
  end
@@ -18,7 +18,7 @@ class Embork::Builder
18
18
  @environment = Embork::Environment.new(@borkfile)
19
19
  @sprockets_environment = @environment.sprockets_environment
20
20
 
21
- @version = Time.now.to_s.gsub(/( -|-| |:)/, '.')
21
+ @version = generate_version
22
22
 
23
23
  @sprockets_environment.context_class.use_bundled_assets = true
24
24
  @sprockets_environment.context_class.bundle_version = @version
@@ -129,6 +129,12 @@ class Embork::Builder
129
129
 
130
130
  protected
131
131
 
132
+ def generate_version
133
+ Dir.chdir @project_root do
134
+ `git rev-parse HEAD`.strip
135
+ end
136
+ end
137
+
132
138
  def generate_asset_list(config_path)
133
139
  config_pathname = Pathname.new config_path
134
140
 
@@ -16,7 +16,7 @@ class Embork::CLI < Thor
16
16
 
17
17
  desc "server [ENVIRONMENT]", %{run the development or production server}
18
18
  option :port, :type => :numeric, :default => 9292
19
- option :host, :type => :string, :default => 'localhost'
19
+ option :host, :type => :string, :default => '0.0.0.0'
20
20
  option :bundle_version, :type => :string, :default => nil
21
21
  option :with_latest_bundle, :type => :boolean, :default => false
22
22
  option :enable_tests, :type => :boolean, :default => false
@@ -27,7 +27,7 @@ class Embork::CLI < Thor
27
27
 
28
28
  desc "phrender [ENVIRONMENT]", %{run phrender the prerenderer}
29
29
  option :port, :type => :numeric, :default => 9292
30
- option :host, :type => :string, :default => 'localhost'
30
+ option :host, :type => :string, :default => '0.0.0.0'
31
31
  option :bundle_version, :type => :string, :default => nil
32
32
  option :with_latest_bundle, :type => :boolean, :default => false
33
33
  def phrender(environment = :development)
@@ -41,7 +41,7 @@ class Embork::CLI < Thor
41
41
  min = 52000
42
42
  max = 65000
43
43
  port = (Random.rand * (max - min) + min).to_i
44
- host = 'localhost'
44
+ host = '0.0.0.0'
45
45
 
46
46
  server_options = {
47
47
  :host => host,
@@ -66,7 +66,9 @@ class Embork::CLI < Thor
66
66
  borkfile = Embork::Borkfile.new options[:borkfile], environment
67
67
  builder = Embork::Builder.new(borkfile)
68
68
  builder.build
69
- builder.clean unless options[:keep_all_old_versions]
69
+ if !options[:keep_all_old_versions]
70
+ builder.clean
71
+ end
70
72
  end
71
73
 
72
74
  desc "clean", %{Remove all files under the build directory}
@@ -4,13 +4,18 @@ require 'embork/borkfile'
4
4
  class Embork::Extension
5
5
  attr_reader :project_root
6
6
 
7
- def initialize(project_root, bundled_assets: false, environment: nil)
8
- @environment = environment || Embork.env || ENV['RACK_ENV']
7
+ def initialize(project_root, options = {})
8
+ # Set up defaults
9
+ bundled_assets = options[:bundled_assets] || false
10
+ environment = options[:environment] || nil
11
+
12
+ @environment = environment || ENV['RACK_ENV'] || Embork.env
13
+ Embork.env = @environment
9
14
  @project_root = project_root
10
15
  if bundled_assets
11
16
  version_file_path = File.join(project_root, 'build',
12
17
  @environment.to_s, 'current-version')
13
- @bundle_version = File.read(version_file_path)
18
+ @bundle_version = File.read(version_file_path).strip
14
19
  @use_bundled_assets = true
15
20
  end
16
21
  end
@@ -1,3 +1,3 @@
1
1
  class Embork
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -51,25 +51,29 @@ describe 'Embork::Builder' do
51
51
 
52
52
  context '#clean' do
53
53
 
54
- let(:older_stamp) { Time.now - 10 }
54
+ let(:versions) {
55
+ [
56
+ '49b65b48a44ead62720c1c649db8fb529f730bed',
57
+ 'f15678d0862a572f898c54e50bc4f8e0bfcc5380',
58
+ '0779ed758aacf70705206964a7ebe79231f4537b',
59
+ 'c5325c6a4bee73612f839b9b59e7bdfa566674cf',
60
+ '45c508baf8fafa8475e1b14a2169e69a1b51c2cb',
61
+ ]
62
+ }
55
63
  let(:expected_files) do
56
- (1..4).map do |delta|
57
- version = (older_stamp - delta).to_s.gsub(/ -| |-|:/, '.')
58
- "application-#{version}.js"
59
- end.push "application-#{@asset_bundle_version}.js"
64
+ versions[0..3].map do |v|
65
+ "application-%s.js" % v
66
+ end
60
67
  end
61
68
 
62
69
  let(:unexpected_files) do
63
- (5..10).map do |delta|
64
- version = (older_stamp - delta).to_s.gsub(/ -| |-|:/, '.')
65
- "application-#{version}.js"
66
- end
70
+ [ "application-%s.js" % @asset_bundle_version ]
67
71
  end
68
72
 
69
73
  before(:each) do
70
- (1..10).each do |delta|
71
- version = (older_stamp - delta).to_s.gsub(/ -| |-|:/, '.')
72
- FileUtils.touch File.join(build_directory, "application-#{version}.js")
74
+ versions.each do |v|
75
+ FileUtils.touch File.join(build_directory, "application-%s.js" % v)
76
+ sleep 1 unless v == versions.last
73
77
  end
74
78
  end
75
79
 
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.11
4
+ version: 0.0.12
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-14 00:00:00.000000000 Z
11
+ date: 2014-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 0.0.4
173
+ version: 0.0.5
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 0.0.4
180
+ version: 0.0.5
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: bundler
183
183
  requirement: !ruby/object:Gem::Requirement