Comments (10)
@asok: ping?
from projectile-rails.
@Silex sorry for not responding it seems that I've overlooked the notification for this issue.
So I guess under apps/rails
you have your normal rails app, but you want ~/work/projects
to be treated as the root? Maybe the easiest would be to overwrite projectile-rails-root
function after loading the package? Something like this:
(eval-after-load 'projectile-rails
(defun projectile-rails-root ()
(projectile-project-root)))
from projectile-rails.
@asok: hum, no that's already what it does...
The problem is that all the functions like projectile-rails-find-controller
just assume everything is under app/controllers
in the projectile-project-root no matter what projectile-rails-root says.
Here's my attempt:
(defun projectile-rails-root ()
"Returns rails root directory if this file is a part of a Rails application else nil"
(ignore-errors
(let ((root (projectile-project-root)))
(concat root "app/rails"))))
Debugger entered--Lisp error: (file-error "Setting current directory" "No such file or directory" "/home/philippe/work/stvs/arqivis/app/controllers/")
call-process("/bin/bash" nil t nil "-c" "git ls-files -zco --exclude-standard")
apply(call-process "/bin/bash" nil t nil ("-c" "git ls-files -zco --exclude-standard"))
process-file("/bin/bash" nil t nil "-c" "git ls-files -zco --exclude-standard")
shell-command-to-string("git ls-files -zco --exclude-standard")
projectile-files-via-ext-command("git ls-files -zco --exclude-standard")
projectile-get-repo-files()
projectile-dir-files-external("/home/philippe/work/stvs/arqivis/" "/home/philippe/work/stvs/arqivis/app/controllers/")
projectile-dir-files("/home/philippe/work/stvs/arqivis/app/controllers/")
projectile-rails-choices((("app/controllers/" "/controllers/\\(.+\\)_controller\\.rb$")))
projectile-rails-find-controller()
funcall-interactively(projectile-rails-find-controller)
#<subr call-interactively>(projectile-rails-find-controller nil nil)
ad-Advice-call-interactively(#<subr call-interactively> projectile-rails-find-controller nil nil)
apply(ad-Advice-call-interactively #<subr call-interactively> (projectile-rails-find-controller nil nil))
call-interactively(projectile-rails-find-controller nil nil)
command-execute(projectile-rails-find-controller)
One possible workaround could be to tell projectile to consider Gemfile
as another project within the git project... but that's a bit nasty.
from projectile-rails.
Maybe something like this:
modified projectile-rails.el
@@ -326,6 +326,9 @@ Returns a hash table with keys being short names and values being relative paths
(maphash (lambda (key value) (setq keys (cons key keys))) hash)
keys)))
+(defun projectile-rails--append-root-suffix (dirs)
+ (--map (format "%s%s%s" (projectile-project-root) "apps/rails/" it) dirs))
+
(defmacro projectile-rails-find-resource (prompt dirs &optional newfile-template)
"Presents files from DIRS to the user using `projectile-completing-read'.
@@ -333,7 +336,7 @@ If users chooses a non existant file and NEWFILE-TEMPLATE is not nil
it will use that variable to interpolate the name for the new file.
NEWFILE-TEMPLATE will be the argument for `s-lex-format'.
The bound variable is \"filename\"."
- `(let* ((choices (projectile-rails-choices ,dirs))
+ `(let* ((choices (projectile-rails-choices (projectile-rails--append-root-suffix ,dirs)))
(filename (or
(projectile-completing-read ,prompt (projectile-rails-hash-keys choices))
(user-error "The completion system you're using does not allow inputting arbitrary value.")))
Though I haven't tested it. Probably you would have to change it slightly because dirs
is a list of lists. So you would have to run map
twice on it. (BTW I don't recall why I made it so :) )
Let me know how it worked out.
from projectile-rails.
Hum, yeah I guess that would work... it's pretty hacky tho.
I can't help but feel that there is an unsolved problem reguarding projectile-rails-root
because it's basically pretty useless at the moment.
IMHO there needs to be some refactoring so the detection of "rails project" is done in a better way.
Right now it works like this:
projectile-rails-root
: checks ifprojectile-project-root
containsconfig/environment.rb
.- All the finders ignore
projectile-rails-root
and useprojectile-dir-files
which usesprojectile-project-root
.
I think it'd be better if it behaved like this:
projectile-rails-root
: useprojectile-locate-dominating-file
to find which directory containsconfig/environment.rb
- Refactor everything so the finders use
projectile-rails-root
(probably as simple as writing aprojectile-rails-dir-files
function which does the right thing)
I'll see if I can hack something.
from projectile-rails.
@Silex I've added you as a collaborator to the project
from projectile-rails.
๐ ๐
from projectile-rails.
Ok, I started the work in another branch, you can look at the diff with https://github.com/asok/projectile-rails/compare/rails-root-improvements?expand=1
from projectile-rails.
Ok cool. Please make a PR. Travis should run it and we should see the result the tests. Unfortunately recently some of them fail, I was too lazy fix them. But if the same will fail as for the master branch we can merge it.
from projectile-rails.
Alright, it's not done tho. It more or less works except I couldn't do the final steps (still have to fix projectile-rails-goto-file
and friends)
from projectile-rails.
Related Issues (20)
- projectile-rails-find-migration not showing completion items HOT 1
- Error on "Setting current directory" in project with git submodule HOT 1
- Any support for "heroku local" or "foreman s" over rails server? HOT 7
- Search files in Gemset associated with project HOT 2
- Does not detect my Rails app HOT 30
- Remove the default keymap prefix "C-c r" HOT 4
- Symbolโs value as variable is void: auto-insert-alist HOT 7
- Support irb >= v1.2 HOT 1
- Use cl-lib instead of cl HOT 1
- Improve Projectile Rails Server buffer (to improve emacs performance) HOT 1
- Time to push a new version to MELPA Stable? HOT 2
- define-obsolete-variable-alias now needs `when` in params
- module template don't have identation (doom emacs) HOT 2
- Cannot run bundle HOT 6
- Not able to install via use-package: Required package โinflections-1.1โ is unavailable HOT 2
- Function projectile-rails-goto-file-at-point not recognize template format.
- Sidekiq directory HOT 2
- Customize rails skeletons / templates
- Autoloading file projectile-rails.elc failed to define function hydra-projectile-rails
- Key "!" in `projectile-rails-command-map` is doubly defined
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from projectile-rails.