active_record-annotate 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d46ab2c978b90e86c92cc4c21cc11007100fe01b
4
- data.tar.gz: 8a3fbf198e6ab48158313b1e270bc1ebc93489e8
3
+ metadata.gz: 7993b3163ca44d4a0bc01d33b6dec3c3e2771df5
4
+ data.tar.gz: b43985e86662c7249a38fea23221a9d74d9da98f
5
5
  SHA512:
6
- metadata.gz: 62d1fb53fd8b99b1cea51746e716a3b46c6d1a96cc87c90f797884f79ef57d524a68bf14b67e2902dcce7ba0f1d9a1a97bab79f5a69f8ee817bf046f6b8900e1
7
- data.tar.gz: 71f8c07dce06df0168053f02454fd45047870dde06fcf65a724042ee74bea4be4d7d0fa21a28d201281141825b9dd69f050540fd9ecc6b67db620cf92f642821
6
+ metadata.gz: 760912037953c8ade81346556ccf1aa02df22aa3944add396e821b6eb79db70701916301e47499219b66cfaffe3df23a02ee7c72ad47762ff34b9c9204ef0fb3
7
+ data.tar.gz: 1004587b536ed6580ca4fc090874c057e0f9e4735db8022ef748421b42dd1a0a8f0100745cc549c5b7964e92353cd072f16fb3ccd0161fcf6b488409828f2df9
data/Guardfile CHANGED
@@ -1,7 +1,9 @@
1
- guard :rspec, all_on_start: true, all_after_pass: true do
2
- watch(%r{^spec/.+_spec\.rb$})
3
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
- watch('spec/spec_helper.rb') { 'spec' }
5
-
6
- notification :terminal_notifier, activate: 'com.googlecode.iTerm2'
1
+ guard :rspec, all_on_start: true, cmd: 'bundle exec rspec' do
2
+ require 'guard/rspec/dsl'
3
+ dsl = Guard::RSpec::Dsl.new(self)
4
+
5
+ watch(dsl.rspec.spec_helper) { dsl.rspec.spec_dir }
6
+ watch(dsl.rspec.spec_files)
7
+
8
+ dsl.watch_spec_files_for(dsl.ruby.lib_files)
7
9
  end
data/README.md CHANGED
@@ -66,6 +66,7 @@ It creates an initializer at `config/initializers/annotate.rb` which contains de
66
66
  * 0.4 Checking table existance before dumping
67
67
  * 0.4.1 Several models per table fix
68
68
  * 0.4.2 Initializer fix
69
+ * 0.4.3 Support for `frozen_string_literal` & `warn_indent` magic comments
69
70
 
70
71
  ## Roadmap
71
72
 
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'rake'
25
25
 
26
26
  spec.add_development_dependency 'guard-rspec'
27
+ spec.add_development_dependency 'terminal-notifier'
27
28
  spec.add_development_dependency 'terminal-notifier-guard'
28
29
  spec.add_development_dependency 'pry'
29
30
  spec.add_development_dependency 'awesome_print'
@@ -10,9 +10,14 @@ module ActiveRecord
10
10
  end
11
11
 
12
12
  def annotate_with(annotation, configurator)
13
- if @lines.first =~ /^\s*#.*coding/
14
- # encoding: utf-8 encountered on the first line
15
- encoding_line = @lines.shift
13
+ magic_comments = []
14
+ while @lines.first =~ /^\s*#.*(coding|frozen_string_literal|warn_indent)/i
15
+ magic_comments.push(@lines.shift)
16
+ end
17
+
18
+ unless magic_comments.empty?
19
+ # separate magic comments from the annotation with an empty line
20
+ magic_comments << nil
16
21
  end
17
22
 
18
23
  while @lines.first.start_with?('#') || @lines.first.blank?
@@ -27,7 +32,7 @@ module ActiveRecord
27
32
  end
28
33
 
29
34
  @lines.unshift(*annotation, nil)
30
- @lines.unshift(encoding_line) unless encoding_line.nil?
35
+ @lines.unshift(*magic_comments)
31
36
  @lines.push(nil) # newline at the end of file
32
37
  end
33
38
 
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Annotate
3
- VERSION = '0.4.2'
3
+ VERSION = '0.4.3'
4
4
  end
5
5
  end
@@ -5,7 +5,10 @@ describe ActiveRecord::Annotate::File do
5
5
  file = Tempfile.new('test_annotation')
6
6
  File.open(file.path, 'w') do |tempfile|
7
7
  tempfile.write(<<-FILE)
8
- # encoding: utf-8
8
+ # enCoding: utf-8
9
+ # frozen_string_literal: true
10
+ # warn_indent: true
11
+
9
12
  # create_table :users do |t|
10
13
  # t.string :name
11
14
  # t.integer :age
@@ -40,7 +43,10 @@ end
40
43
 
41
44
  let(:expected_result) do
42
45
  <<-FILE
43
- # encoding: utf-8
46
+ # enCoding: utf-8
47
+ # frozen_string_literal: true
48
+ # warn_indent: true
49
+
44
50
  # create_table :users do |t|
45
51
  # t.string :name
46
52
  # t.integer :age, null: false, default: 0
@@ -54,7 +60,10 @@ end
54
60
 
55
61
  let(:expected_result_for_yard) do
56
62
  <<-FILE
57
- # encoding: utf-8
63
+ # enCoding: utf-8
64
+ # frozen_string_literal: true
65
+ # warn_indent: true
66
+
58
67
  # ```
59
68
  # create_table :users do |t|
60
69
  # t.string :name
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record-annotate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vsevolod Romashov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-09 00:00:00.000000000 Z
11
+ date: 2018-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: terminal-notifier
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: terminal-notifier-guard
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -158,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
172
  version: '0'
159
173
  requirements: []
160
174
  rubyforge_project:
161
- rubygems_version: 2.4.5.1
175
+ rubygems_version: 2.6.13
162
176
  signing_key:
163
177
  specification_version: 4
164
178
  summary: ActiveRecord models annotator based on rails' schema dumper
@@ -167,4 +181,3 @@ test_files:
167
181
  - spec/active_record/annotate/file_spec.rb
168
182
  - spec/active_record/annotate_spec.rb
169
183
  - spec/spec_helper.rb
170
- has_rdoc: