habtm_generator 0.4 → 0.5

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: 227358fd36cbff8dd8e618c8269c375f5cd2e088
4
- data.tar.gz: f08386cfa1740cb7ab9613894663db93861ab900
3
+ metadata.gz: e78010f2e839c96abb9e409c274e3226d15550df
4
+ data.tar.gz: 559f5ed4d68d74d34d810a5c1f80aca407b0d8d5
5
5
  SHA512:
6
- metadata.gz: 4c23b1fe43ac247ced6e0fed325239aefc7e4ec470541fed22190eb5bdaefe125713cd257de1ee67c6fcbb3947b2db42444b8aff0f91a84910012d62834f2a57
7
- data.tar.gz: b03756091567bceaac45f0de10e6c1c769132352f0c04c896809780b13903f8c50dff37eeb53e81773adaf612c73459d1c7488c1522a7c5e76e329af1563a93f
6
+ metadata.gz: 4ff90522b06dbcb446e5ab9ef63ab902dff78caab2ec51eee738a2306971c0669a8ff78febc67b4b16e416f3d146f2e524e67cf27eb22d4fa09af3127c6fb04b
7
+ data.tar.gz: af3bad16c38764a7faaf22eab24f8df04c2904e24d6873495b15225939ac5c2a9446afda134db56fb5d82bf5cb6439675381e9efa33c555073c81d331200d370
data/Rakefile CHANGED
@@ -19,6 +19,10 @@ task :test => [:clear, 'dummy:app'] do
19
19
  system 'rails g model admin/process'
20
20
  system 'rails g habtm user post'
21
21
  system 'rails g habtm user admin/process'
22
+
23
+ system 'rails g model chef_process'
24
+ system 'rails g model chef_script'
25
+ system 'rails g habtm chef_process chef_script'
22
26
  system 'rake db:migrate'
23
27
  system 'pwd'
24
28
  system 'rails r ../../test.rb'
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
13
  gem.name = "habtm_generator"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "0.4"
15
+ gem.version = "0.5"
16
16
  gem.add_dependency "activerecord"
17
17
  gem.add_development_dependency 'appraisal'
18
18
  gem.add_development_dependency 'pry'
@@ -51,7 +51,9 @@ class HabtmGenerator < ActiveRecord::Generators::Base
51
51
  junction_string = '_'
52
52
  end
53
53
 
54
- sorted_models.map{|i| no_ns i.tableize}.join(junction_string)
54
+ pluralized = sorted_models.map{|i| no_ns i.tableize}
55
+ # stolen from active_record/associations/builder/has_and_belongs_to_many.rb
56
+ pluralized.join("\0").gsub(/^(.*[._])(.+)\0\1(.+)/, '\1\2_\3').tr("\0", junction_string)
55
57
  end
56
58
 
57
59
  def models
data/test.rb CHANGED
@@ -10,3 +10,9 @@ process = Admin::Process.create!
10
10
  user.admin_processes << process
11
11
 
12
12
  process.reload.users.include?(user) || (raise StandardError.new('Admin/Process not loaded'))
13
+
14
+
15
+ # Common namespace
16
+ cp = ChefProcess.create!
17
+ cp.chef_scripts.create!
18
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: habtm_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Wienert