outrigger 1.0.0 → 1.1.0

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: ce0d4c69f2e2c7deb1ec22cb1ab210085f2a0d13
4
- data.tar.gz: 0c54dfeb820e336ca9425ee1da1a810dc7f46e01
3
+ metadata.gz: 15960c336f8efd0adaefc5ae539e710a4707094f
4
+ data.tar.gz: 7380ff20bad55808d7a792580daa3172455add80
5
5
  SHA512:
6
- metadata.gz: c721ec0072acea8a9b41c3781df16c3b27b1d07c776f6c4e93005db9d776cb04fc369ded36e56051bd9eb4fef49788c0ad40c21bdfbf3d224c339d39de1b452d
7
- data.tar.gz: 0351e8c9d161fa5727ae0db061e95889734aac627619cd80494ac5601f4acb3f93467edf225ad9163ff24a0abcb8bfe079efee9b105f5c2d548c475aedbb2283
6
+ metadata.gz: bd59666a8b5d0313384f0787664c54a19b652e64cd6f04c88b63979daa94ffa791bcc2b5b9989f29f60ec3b522b4f1e9887eae3c643e8e41e9f4a6f29a6e733f
7
+ data.tar.gz: 245463bbf67d411c85dea4b8c06a02bfa5fc9e1fd8611f519d594fe879e37b3a854dd21bda93b9e38bddb5b1acaf24352866e8870a22bd1816f9e5ef58b4b8e1
@@ -0,0 +1,36 @@
1
+ module RuboCop
2
+ module Cop
3
+ module Migration
4
+ class Tagged < Cop
5
+ def on_class(node)
6
+ _name, superclass, body = *node
7
+ if superclass == s(:const, s(:const, nil, :ActiveRecord), :Migration)
8
+ check(node, body) if body && body.type == :begin
9
+ end
10
+ end
11
+
12
+ private
13
+
14
+ def s(name, *args)
15
+ Parser::AST::Node.new(name, args)
16
+ end
17
+
18
+ def check(klass, node)
19
+ tag_node = node.children.compact.find { |n| n.type == :send && n.to_a[1] == :tag }
20
+
21
+ if allowed_tags.empty?
22
+ add_offense(tag_node, :expression, "No allowed tags have been defined in the RuboCop configuration.")
23
+ elsif tag_node
24
+ add_offense(tag_node, :expression, "Tags may only be one of #{allowed_tags}.") unless allowed_tags.include? tag_node.children.last.to_a.last
25
+ else
26
+ add_offense(klass, :expression, "All migrations require a tag from #{allowed_tags}.")
27
+ end
28
+ end
29
+
30
+ def allowed_tags
31
+ cop_config["AllowedTags"].map(&:to_sym)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,4 +1,3 @@
1
- require "taggable_migrations"
2
1
  require "rails"
3
2
  require "rake"
4
3
 
@@ -1,3 +1,3 @@
1
1
  module Outrigger
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outrigger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drew Bowman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-26 00:00:00.000000000 Z
11
+ date: 2016-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -67,14 +67,14 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.14.1
69
69
  description: Migrations
70
- email:
71
- - dbowman@instructure.com
70
+ email:
72
71
  executables: []
73
72
  extensions: []
74
73
  extra_rdoc_files: []
75
74
  files:
76
75
  - Rakefile
77
76
  - lib/outrigger.rb
77
+ - lib/outrigger/cops/migration/tagged.rb
78
78
  - lib/outrigger/railtie.rb
79
79
  - lib/outrigger/taggable.rb
80
80
  - lib/outrigger/taggable_proxy.rb
@@ -84,7 +84,7 @@ files:
84
84
  - spec/outrigger/taggable_proxy_spec.rb
85
85
  - spec/outrigger/taggable_spec.rb
86
86
  - spec/spec_helper.rb
87
- homepage: http://www.instructure.com
87
+ homepage: https://github.com/instructure/outrigger
88
88
  licenses:
89
89
  - MIT
90
90
  metadata: {}
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.4.6
107
+ rubygems_version: 2.5.1
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Tag migrations and run them separately
@@ -113,4 +113,3 @@ test_files:
113
113
  - spec/outrigger/taggable_proxy_spec.rb
114
114
  - spec/outrigger/taggable_spec.rb
115
115
  - spec/spec_helper.rb
116
- has_rdoc: