middleman-ember 0.0.2 → 0.1.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.
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ 0.1.0
2
+ ===
3
+
4
+ * Options for specifying the path to Ember and Handlebars
5
+
6
+ 0.0.2
7
+ ===
8
+
9
+ * Initial support for Ember
data/README.md CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  Add the following code to your `config.rb` file:
22
22
  ```ruby
23
- activate: :ember
23
+ activate: :ember
24
24
  ```
25
25
 
26
26
  Set the production variant in your build configuration:
@@ -30,7 +30,7 @@ configure :build do
30
30
  end
31
31
  ```
32
32
 
33
- The gem uses handlebars-source, ember-source and ember-data-source for the Ember assets. If you want to have specific versions of ember, ember-data or handlebars specify those in your Gemfile, e.g:
33
+ By default, the gem uses handlebars-source, ember-source and ember-data-source for the Ember assets. If you want to have specific gem versions of ember, ember-data or handlebars specify those in your Gemfile, e.g:
34
34
 
35
35
  ```ruby
36
36
  gem "handlebars-source", "~> 1.0.0.rc3"
@@ -39,17 +39,24 @@ gem "ember-data-source", "~> 0.0.5"
39
39
 
40
40
  ```
41
41
 
42
- There are 3 helpers that expose the asset paths of the ember assets used, namely:
42
+ If you want to use a local version of ember, ember-data or handlebars, set that in the configuration, i.e.
43
+ ```ruby
44
+ activate :ember do |ember|
45
+ ember.ember_path = "/path/to/ember_js/dist"
46
+ ember.ember_data_path = "/path/to/ember_data/dist"
47
+ ember.handlebars_path = "/path/to/handlebars/dist"
48
+ end
49
+ ```
50
+
51
+ There are also 2 helpers that expose the asset paths of the ember assets used, namely:
43
52
  * ember_asset_path
44
53
  * handlebars_asset_path
45
- * ember_local_path
46
54
 
47
55
  These are useful if you're using the [middleman-jasmine](https://github.com/mrship/middleman-jasmine) gem to allow you to add the ember and handlebars assets to another sprockets instance. e.g.:
48
56
  ```ruby
49
57
  after_configuration do
50
58
  jasmine_sprockets.append_path(ember_asset_path)
51
59
  jasmine_sprockets.append_path(handlebars_asset_path)
52
- jasmine_sprockets.prepend_path(ember_local_path) unless ember_local_path.nil?
53
60
  end
54
61
  ```
55
62
 
@@ -7,6 +7,9 @@ module Middleman
7
7
  app.send :include, InstanceMethods
8
8
  app.set :ember_variant, :development
9
9
 
10
+ @@options = OpenStruct.new(default_options.merge(options_hash))
11
+ yield @@options if block_given?
12
+
10
13
  app.after_configuration do
11
14
  ember_version =
12
15
  if app.ember_variant == :production
@@ -15,18 +18,30 @@ module Middleman
15
18
  ""
16
19
  end
17
20
 
21
+ # copy in the relevant version of Ember
18
22
  FileUtils.mkdir_p(ember_asset_path)
19
- FileUtils.cp(::Ember::Source.bundled_path_for("ember.#{ember_version}js"), ember_asset_path.join("ember.js"))
20
- FileUtils.cp(::Ember::Data::Source.bundled_path_for("ember-data.#{ember_version}js"), ember_asset_path.join("ember-data.js"))
23
+ FileUtils.cp("#{@@options.ember_path}/ember.#{ember_version}js", ember_asset_path.join("ember.js"))
24
+ FileUtils.cp("#{@@options.ember_data_path}/ember-data.#{ember_version}js", ember_asset_path.join("ember-data.js"))
21
25
  sprockets.append_path(ember_asset_path)
22
26
 
23
- # allow for a local Ember variant
24
- sprockets.prepend_path(ember_local_path) unless ember_local_path.nil?
25
-
26
27
  # add in Handlebars path
27
28
  sprockets.append_path(handlebars_asset_path)
28
29
  end
29
30
  end
31
+
32
+ def ember_options
33
+ @@options
34
+ end
35
+
36
+ private
37
+
38
+ def default_options
39
+ {
40
+ ember_path: ::Ember::Source.bundled_path_for(""),
41
+ ember_data_path: ::Ember::Data::Source.bundled_path_for(""),
42
+ handlebars_path: File.dirname(::Handlebars::Source.bundled_path)
43
+ }
44
+ end
30
45
  alias :included :registered
31
46
  end
32
47
 
@@ -36,14 +51,8 @@ module Middleman
36
51
  end
37
52
 
38
53
  def handlebars_asset_path
39
- File.dirname(::Handlebars::Source.bundled_path)
40
- end
41
-
42
- def ember_local_path
43
- local_path = "#{root}/vendor/assets/ember"
44
- File.directory?(local_path) ? local_path : nil
54
+ ::Middleman::Ember.ember_options.handlebars_path
45
55
  end
46
56
  end
47
-
48
57
  end
49
58
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Ember
3
- VERSION = "0.0.2"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-ember
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -99,6 +99,7 @@ extensions: []
99
99
  extra_rdoc_files: []
100
100
  files:
101
101
  - .gitignore
102
+ - CHANGELOG.md
102
103
  - Gemfile
103
104
  - LICENSE.txt
104
105
  - README.md