ngannotate-rails 0.15.4 → 0.15.4.1

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: 7f66edb3317d94529097c835b638af4cb1a94528
4
- data.tar.gz: b4e683550940bd0fc9ba91a831d0fbdc17380638
3
+ metadata.gz: 803c3f028160ddb16f237bde0767253166634f9d
4
+ data.tar.gz: 39f5bff0e5db3f5ee4b28938411c8dba6da5e4b5
5
5
  SHA512:
6
- metadata.gz: b2c9f1244e639417bb37679586dc4eff73cd8aa82f79c093d322de33bd8271ca5942c9cdb0f68b85a65607b061d971a5da30eb15cd2c6099d8d59a4308a9fce8
7
- data.tar.gz: 1122a9a1c5db4c6cd1633ca63e98a673860ea2607863527c768c1e2d85c01643205e86803db771d1f4514e143f58037eb720d9991d4f4538263a88fc4f3dfce8
6
+ metadata.gz: ce2eea9455191842a3d04f6653d4711b0972336a00cfa24c1f637d936b560bd44a4b5b71eb257ce57f9feec9e7f29da9de8518a8b67a9c874c65082b5fb7889a
7
+ data.tar.gz: 350ee5ef46ae826c1158bb469fdff542cf9062b742de27e1ec443c79d9d19ed65d59ef9721b8f1ec5fc17b93164023eb15687dc223cab87fec768f1e2e071e7e
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/tmp
17
17
  test/version_tmp
18
18
  tmp
19
19
  node_modules
20
+ *.log
data/README.md CHANGED
@@ -80,6 +80,30 @@ The ngannotate-rails version number mirrors the version number for the version o
80
80
  For minor patch releases, when ng-annotate version is not changing, 4th digit is used (For example, "0.9.6.1").
81
81
  Every released version is tagged with tag "v[VERSION]".
82
82
 
83
+ Release Process
84
+ ---------------
85
+
86
+ For ngannotate update:
87
+
88
+ ```bash
89
+ git checkout master
90
+ git pull
91
+ rake ngannotate:build
92
+ git citool
93
+ # check that result makes sense and if so,
94
+ # use comment: ngannotate: vX.Y.Z
95
+ git tag vX.Y.Z
96
+ git push
97
+ git push --tags
98
+ gem build ngannotate-rails.gemspec
99
+ gem push ngannotate-rails-X.Y.Z.gems
100
+ ```
101
+
102
+ For internal fixes:
103
+
104
+ Similar except no ngannotate:build and new version is previous plus fourth digit for patch level (see Versioning).
105
+
106
+
83
107
  Help
84
108
  ----
85
109
 
@@ -0,0 +1,65 @@
1
+ require 'execjs'
2
+
3
+ module Ngannotate
4
+ class Processor
5
+ def self.instance
6
+ @instance ||= new
7
+ end
8
+
9
+ def self.name
10
+ 'Ngannotate::Processor'
11
+ end
12
+
13
+ def self.call(input)
14
+ instance.call(input)
15
+ end
16
+
17
+ def call(input)
18
+ data = input[:data]
19
+ return data if skip
20
+ prepare
21
+ opt = { add: true }.merge!(parse_opt)
22
+ r = @context.call 'window.annotate', data, opt
23
+ r['src']
24
+ end
25
+
26
+ def prepare
27
+ return if skip
28
+ ngannotate_source = File.open(File.join(File.dirname(__FILE__), '../../vendor/ngannotate.js')).read
29
+ @context = ExecJS.compile "window = {};" + ngannotate_source
30
+ end
31
+
32
+ #
33
+ # To allow testing assets compile in development environment
34
+ #
35
+ # To explicitly force assets compile in development environment
36
+ # NG_FORCE=true RAILS_ENV=development bundle exec rake assets:clean assets:precompile
37
+ # or add to environments/development.rb
38
+ # config.ng_annotate.process = true
39
+ #
40
+ def force
41
+ ENV['NG_FORCE'] == 'true'
42
+ end
43
+
44
+ #
45
+ # Skip processing in environments where it does not make sense.
46
+ # Override by NG_FORCE=true env variable
47
+ #
48
+ def skip
49
+ !force && !::Rails.configuration.ng_annotate.process
50
+ end
51
+
52
+ def parse_opt
53
+ opt = {}
54
+ opt_str = ENV['NG_OPT']
55
+ if opt_str
56
+ opt = Hash[opt_str.split(',').map { |e| e.split('=') }]
57
+ opt.symbolize_keys!
58
+ end
59
+ if ENV['NG_REGEXP']
60
+ opt[:regexp] = ENV['NG_REGEXP']
61
+ end
62
+ opt
63
+ end
64
+ end
65
+ end
@@ -1,5 +1,9 @@
1
1
  require 'active_support/core_ext/class/attribute'
2
- require 'ngannotate/processor'
2
+ if Ngannotate.sprockets_v3?
3
+ require 'ngannotate/processor3'
4
+ else
5
+ require 'ngannotate/processor'
6
+ end
3
7
 
4
8
  module Ngannotate
5
9
  module Rails
@@ -1,5 +1,5 @@
1
1
  module Ngannotate
2
2
  module Rails
3
- VERSION = "0.15.4"
3
+ VERSION = "0.15.4.1"
4
4
  end
5
5
  end
@@ -0,0 +1 @@
1
+ require_relative 'ngannotate'
data/lib/ngannotate.rb ADDED
@@ -0,0 +1,8 @@
1
+ module Ngannotate
2
+ def self.sprockets_v3?
3
+ gem = Gem.loaded_specs['sprockets']
4
+ !(gem.version.to_s =~ /\A3\..*\z/).nil?
5
+ end
6
+ end
7
+
8
+ require 'ngannotate/rails'
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/kikonen/ngannotate-rails"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files`.split($/).reject {|f| f.match /example/ }
16
+ spec.files = `git ls-files`.split($/).reject {|f| f =~ /example/ || f =~ /test/}
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ngannotate-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.4
4
+ version: 0.15.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kari Ikonen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-10 00:00:00.000000000 Z
11
+ date: 2015-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,7 +80,10 @@ files:
80
80
  - LICENSE.txt
81
81
  - README.md
82
82
  - Rakefile
83
+ - lib/ngannotate-rails.rb
84
+ - lib/ngannotate.rb
83
85
  - lib/ngannotate/processor.rb
86
+ - lib/ngannotate/processor3.rb
84
87
  - lib/ngannotate/rails.rb
85
88
  - lib/ngannotate/rails/railtie.rb
86
89
  - lib/ngannotate/rails/version.rb
@@ -111,4 +114,3 @@ signing_key:
111
114
  specification_version: 4
112
115
  summary: 'Summary: Use ngannotate in the Rails asset pipeline.'
113
116
  test_files: []
114
- has_rdoc: