2016-04-11 4 views
1

少数のAPIアクセスモデルを含む単純なRailsエンジンであるGem(https://github.com/absolutedevops/civo)を書きました。gemは(意図せず)移行パスをどのように変更できますか?

しかし、それをRailsプロジェクトに含めると、ジェネレータはプロジェクトのものではなく、Gemのソースコードの下にファイルを作成します。私はこれを引き起こす宝石の中で何かしているのを見ることができません。繰り返します(私の会社では2つのプロジェクトで起こっており、以下の最小限の手順で再現できます)。

どのように私がこれを管理したか教えていただけますか?私は長年にわたりRailsのユーザーでしたが、これまでにこれまでに遭遇したことはありません。 (私はあなたがにリンクするためのもの一つだと思い)https://github.com/absolutedevops/civo-rubyでcivo-rubyのリポジトリを見てみると

$ rails -v 
Rails 4.2.6 
$ rails new civo-test 
[...] 
Bundle complete! 12 Gemfile dependencies, 55 gems now installed. 
Use `bundle show [gemname]` to see where a bundled gem is installed. 
     run bundle exec spring binstub --all 
* bin/rake: spring inserted 
* bin/rails: spring inserted 
$ cd civo-test 
$ echo 'gem "civo"' >> Gemfile 
$ bundle 
[...] 
Bundle complete! 13 Gemfile dependencies, 66 gems now installed. 
Use `bundle show [gemname]` to see where a bundled gem is installed. 
$ rails g migration a_new_migration_here 
Running via Spring preloader in process 75091 
     invoke active_record 
     create db/migrate/20160411093346_a_new_migration_here.rb 
$ ls -l db/migrate/20160411093346_a_new_migration_here.rb 
ls: db/migrate/20160411093346_a_new_migration_here.rb: No such file or directory 
$ rails g migration a_new_migration_here     
Running via Spring preloader in process 75193 
     invoke active_record 
    identical db/migrate/20160411093346_a_new_migration_here.rb 
$ ls -l /Users/andy/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/civo-0.3.21/db/migrate/ 
total 8 
-rw-r--r-- 1 andy staff 73 11 Apr 10:33 20160411093346_a_new_migration_here.rb 
+0

あなたがリンクしているリポジトリは、Goプログラムであり、Rubyの宝石ではありません。 – matt

答えて

2

、あなたはあなたのエンジンのコードがインストールされている場所を指すようにENGINE_ROOTを定義します。また、いくつかの場所でレールuses this constantと私はこれが衝突が起こっていると思う。

定数の名前を変更することができます。 CIVO_ENGINE_ROOTに移動するか、またはCivoモジュールに移動して名前空間にすることができます。

+0

それはちょうどそれ、素晴らしいキャッチだった。私は明らかに賞金を18時間授与することはできませんが、期限が切れると私はそれをします。 –

関連する問題