PHP Drupal bundle for Textmate added to Macromates SVN

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
moshe weitzman's picture

We finally did it. I submitted a PHP Drupal for Textmate and it is now listed at http://macromates.com/svn/Bundles/trunk/Review/Bundles/. The bundle primarily consists of work by kkaefer. I've also added bits that have been posted by others over time.

To install, see the Bundles page of the macromates wiki.

Lets improve the bundle. This group is the right place for general discussion about it (Textmate specific RSS feed). I created a Textmate project at drupal.org for discussing patches, bug reports, feature requests.

As for next steps with Macromates - here is the reply from Michael Sheets ....

I've added the PHP Drupal bundle to the review directory. The next step is get feedback from the community on the bundle before it's inclusion in the main Bundles directory in the repository. Generally these will be posted to the tm-dev list, some of the core bundle contributors may give their comments in the form of a comments.markdown document in the root of the bundle as to easily track the comments.

After a suitable amount of time and any issues have been addressed the bundle can be promoted to the main Bundles directory.

Sorry you thought the need the justify the bundle, we've got room for any languages no matter how small or big. As long as someone writes it we'll add it to the repository. I'll be adding some review comments when I can, until then keep up the good work.

Need from you the subversion username you'd like so I can setup a account for you to update the bundle.

Thanks for your contribution!

--
Michael Sheets
TextMate Bundles Moderator

Comments

I've been working on a

psynaptic's picture

I've been working on a Drupal TextMate bundle recently and you seem to have beat me to it. I've seen you talk about the need for a Drupal bundle for a while and just checked this morning to see if one had been added to the bundles repository. Anyway, I'm up for helping to make this bundle the best it can be.

Going to install it now and see what it provides.

This Bundle is certainly the

psynaptic's picture

This Bundle is certainly the start of something amazing for us TextMate users!

TM_drupal_version should be TM_DRUPAL_VERSION for consistency.

I'd like to know how you feel about integrating the current hook_* tab triggers with Steven Wittens' function completion. The main PHP bundle does function completion using option+escape, it gives an option list to choose a function. I've been working on getting this same functionality with Drupal functions generated by Steven's generate.php.

The generator Steven created makes autocomplete snippets for functions within contributed modules. When doing a look-up using Wim Leers' api.drupal.org command the contrib functions are not found. API module allows documentation for contributed module functions. These two combined could allow the documentation look-up of the contributed functions from a local API.

Would love to know your thoughts on these.

I have the Bundle doing a

psynaptic's picture

I have the Bundle doing a look-up on my local API and it's working for functions from within contributed modules too. I added a new Shell Variable called TM_DRUPAL_API and set it to: http://api.drupal.org/apis/

if grep <<<${TM_CURRENT_WORD:-!} -Esq '^[a-zA-Z0-9_]+$'
  then
  FILENAME=${TM_FILEPATH##/}
  BASENAME=${FILENAME%%.
};
  if [ echo &quot;$TM_CURRENT_WORD&quot; | grep -E &quot;${BASENAME}_[0-9A-Za-z_]&quot; ]
    then
    HOOK=${TM_CURRENT_WORD##${BASENAME}}
    URL="${TM_DRUPAL_API}${TM_DRUPAL_VERSION}/hook${HOOK}"
    else
    URL="${TM_DRUPAL_API}${TM_DRUPAL_VERSION}/${TM_CURRENT_WORD}"
  fi
  exit_show_html "<meta http-equiv='Refresh' content='0;URL=$URL'>"
  else echo "Nothing to lookup (hint: place the caret on a function name)"
fi

This makes the API location flexible so you can use your own local API. Mine is set to: http://localhost/api/apis/ where api is the name of my local API site.

I was using all uppercase

moshe weitzman's picture

I was using all uppercase for TM_drupal_version but I thought to use lowercase afterreading the variables section of http://wiki.macromates.com/Bundles/StyleGuide. I think uppercase is the call though. Should we use TM_PHP_DRUPAL_VERSION so we get the nundle name in there?

I really want autocomplete and snippits for Drupal functions. But Steven's implementation is too odd for my taste. I don't want to generate .plist files. I'm not even sure the user should generate anything. We might just make a collection of frequently used modules (FM) and ship their functions in the bundle. In other words, myself and kkaefer (the bundle maintainers) run 'generate' from time to time to pickup new functions and add them to the bundle. I think we should hook into the PHP completion that exists already. We might just append our list of functions to the PHP function list and add our snippits somehow. I have investigated this at times but never found a solution that I liked. But this has to be the top priority so lets get to it people ...

TM_PHP_DRUPAL_VERSION would

psynaptic's picture

TM_PHP_DRUPAL_VERSION would be the way to go, saves any confusion since, as you say, it contains the bundle name.

I've been trying to hack Ciaran's PHP Bundle's Completions command to work with a modified version of Steven's generate.php. I can get a list of options just like the PHP bundle completion: type 'theme_' then Option+Escape to see all functions starting with 'theme_'. The problem I'm having is that the prototype isn't expanding correctly. Ciaren kindly gave me a script that should help but I'm new to Ruby so I've been finding it hard to get working properly.

I'll post here when I get further with it.

Exciting news about PHP completion

moshe weitzman's picture

I was in #textmate today and caught wind of a new PHP Completion effort by Ciarán Walsh. It does what we all hoped - function/method completion based on the files in the current project. The module stores function/method info in a SQLite database. The bundle currently only parses .php files. I fiddled with Ruby and git like a semi blind person until i managed to publish my own fork which also parses .module and .inc files. I already submitted a patch (aka 'pull request') to Ciarán.

I consider Steven's bundle to now be obsolete and we'll use this new bundle as our completion solution for Drupal.

So what is the next priority for our little bundle? D6? More hooks?

The fork seems to have been

shrop's picture

The fork seems to have been removed at this point. Has your changed been merged into the main trunk for PHP Completion? I tried looking through recent commits and couldn't tell from the comments.

Thanks!
Shrop

php completion

shrop's picture

BTW.. I do think that having auto complete of functions for installed modules. If it makes most sense to leverage the work in PHP Completion, then that works for me :)

Thanks for all of your work on this!

Shrop

Thanks Moshe

amanuel's picture

As a TM user I'm happy to see this.

I've started testing and playing with it.

Thanks.

More snippets

BlakeLucchesi's picture

Sweet! I actually released a small set of snippets that I have been using for the past few months, its not a complete package but there are form api and menu array helpers that are pretty useful (you can watch the demo to see how they work http://boldsource.com/tutorials/drupal-helper-textmate-bundle-screencast). Feel free to include the snippets in this new 'master' package.

http://boldsource.com/downloads/drupal-helper-textmate-bundle

Blake

Thanks for the link. Please

moshe weitzman's picture

Thanks for the link. Please review the bundle from SVN and create a patch or a small bundle with your proposed additions. Post to Textmate project ... Try to maintain the naming conventions of the SVN bundle. Keep refreshing your checkout since the bundle will change frequently in its early days. Thanks.

Haven't even heard of

tjholowaychuk's picture

Haven't even heard of textmate, looks fairly primitive but I have a macbook now so I will have to check it out! not sure I could live without phped though

vision media
350designs
Print Huge Edmonton Printing Services
Design Inspiration Gallery

I did heard of textmate but

robertgarrigos's picture

I did hear of textmate but since the beginning I used bbedit. However, I did try textmate with this bundle after reading this and I'm already on it. No more bbedit! Long live to textmate and Drupal bundle!

I really like the Drupal community....


Robert Garrigós
Professional site: garrigos.cat


Robert Garrigós
Professional site: garrigos.cat

How is the FTP/SSH support?

tjholowaychuk's picture

How is the FTP/SSH support? PhpED has alot of great features I could not live without, but I am sure some other IDE's incorporate them as well. Namely: integrated terminal, ftp/sftp, instant php function/class help & search, profiling, debugging module, db client, etc

vision media
350designs
Print Huge Edmonton Printing Services
Design Inspiration Gallery

FTP suggestion

sime's picture

If you can localhost debug with textmate I'd be impressed, but fwiw I'll drop a suggestion about FTP.

I highly recommend Cyberduck for nice GUI FTP that integrates nicely. When you tell Cyberduck that Textmate is your default editor, it gives you a textmate edit button. When you save with textmate it will then save back to server via Cyberduck.

Another advantage of Cyberduck is integration with lots of other text editors. For me, this means I can do quick setup on other people's Macs with a free combination like Cyberduck/TextWrangler. It's a nice non-techie setup.

Steven?

We are discussing how to

moshe weitzman's picture

We are discussing how to incorporate drupal function complete in another comment branch of this same post. We all surely want it, but Steven's solution is not ideal IMO. The PHP bundle now has function completion and we need to tie into that somehow.

Would be nice to have some

tjholowaychuk's picture

Would be nice to have some quick hook completion functionality, or perhaps even a wizard sort of functionality. At the moment I just use a combination of code templates (CTRL + J, pick one and bam) and auto replace functionality so if type mmd it turns into dpm() ( mmd is faster for me to type ), mmm turns into a menu hook, mmf turns into a formAPI array, mmi turns into an install hook template etc

vision media
350designs
Print Huge Edmonton Printing Services
Design Inspiration Gallery

I just downloaded the trial,

tjholowaychuk's picture

I just downloaded the trial, does it not support FTP/SFTP/SSH? what do you guys use for this on the mac? My IDE on the windows end has been the ONLY reason that I have held of from migrating over to the mac entirely, PhpED is a very tight package though so I am second guessing what I have found for the mac so far :(


Tj Holowaychuk

Vision Media - Victoria BC Web Design
Victoria British Columbia Web Design School

If you're used to the FTP

psynaptic's picture

If you're used to the FTP way of working then Transmit 3 is a good option (although it's not free).

You could use ExpanDrive if you prefer navigating the file system using Finder.

I used ExpanDrive until the demo ran out and now just use Transmit until I find something better.

Anything integrated with

tjholowaychuk's picture

Anything integrated with textmate? I hate having tons of separate clients, I have been leaning towards going with Eclipse for debugging and ftp etc but textmate is certainly cleaner


Tj Holowaychuk

Vision Media - Victoria BC Web Design
Victoria British Columbia Web Design School

FTP/SSH Bundle

christefano's picture

You're not alone. This has been discussed a bunch of times on the TextMate mailing list.

Check out the FTP/SSH Bundle. I've been thinking of using it but I keep going back to using MacFUSE.

This will come in the much

psynaptic's picture

This will come in the much anticipated TextMate 2.0. For now I'm happy to use the other options.

I generally do everything in my local environment anyway so this is less of an issue for me.

No debugging either correct?

tjholowaychuk's picture

No debugging either correct? The bundles look pretty elaborate as far as what can be accomplished but im not sure about what is available. I installed Eclipse as well and its a beast already haha so slow in comparison to what I normally use.


Tj Holowaychuk

Vision Media - Victoria BC Web Design
Victoria British Columbia Web Design School

That's right, no debugger. I

psynaptic's picture

That's right, no debugger. I have never used a debugger in my life, they seem a bit clunky to me. I just manually print (using functions provided by devel module) the data I need to see.

There are so many features in TextMate that it's hard to say what you'll find most useful.

  • Option-Command-T gets you a searchable list of bundle items
  • Control-H while on a word gets you documentation for that word
  • Control-D on a function name gives you api.drupal.org documentation for that function
  • Esc cycles through word completions
  • Column editing saves a lot of time
  • Markdown bundle is awesome
  • There is just too much to even scratch the surface of why I love this app.

Freestyle Systems
Drupal Contributions API

The bundles seem really

tjholowaychuk's picture

The bundles seem really robust I really like what they have done with that, thats the main reason I am really interested in where it is now and where it will go in the future. Debuggers are really handy, I use them somewhat rarely but its defiantly something I am not ready to give up all together. A few things I noticed that it didnt seem to have (that i know of) was:

  • Terminal(s)
  • FTP/SFTP/SCP
  • Autocompletion of PHP functions/classes/methods etc
  • Column editing is great! haha was glad to see that
  • SVN/CVS? I think I did see something about CVS
  • Functionality of the IDE 'scanning' all project files to show you what functions are available, then once you click the function name it should bring you to the declaration of that function

There were a few more I cant think of, like I said though totally stoked on where its going! Eclipse is slow and seems like a worse choice in the long run but for right now I might stick with it.


Tj Holowaychuk

Vision Media - Victoria BC Web Design
Victoria British Columbia Web Design School

Terminal(s) You can run

psynaptic's picture
  • Terminal(s)
    • You can run Terminal commands from within TextMate but I generally just use Terminal + Visor + Terminal Colors. I set my ± key (directly underneath the Esc key) to drop down my terminal window. You can use tabs in Visor too which helps.
  • FTP/SFTP/SCP
    • I use Transmit and have used ExpanDrive but I prefer to work locally on a development site so I rarely need to use this. I have built a migrate script that I run using $ migrate send sitename or $ migrate get sitename. This works well but I’ve been thinking I should build another script to enable incremental updates (syncing) to the remote file system.
  • Autocompletion of PHP functions/classes/methods etc
    • Did you try typing the start of a PHP function and pressing Option+Esc? You might want to take a look at the PHP Completions bundle as mentioned above. I’m trying to get this working with Drupal API again but can’t remember how.
  • SVN/CVS? I think I did see something about CVS
    • There are SVN and CVS bundles. You can see a list of user contributed bundles at http://macromates.com/svn/Bundles/trunk/Bundles/. See the manual http://manual.macromates.com/en/bundles#installingabundle on how to install a bundle from the macromates SVN repository.
  • Functionality of the IDE ‘scanning’ all project files to show you what functions are available, then once you click the function name it should bring you to the declaration of that function
    • There is the Go to Symbol… menu item that works for the current file. Not sure about how to do this for a project.

freestylesystems.co.uk
Drupal Contributions API

Thanks for all the info man,

tjholowaychuk's picture

Thanks for all the info man, sounds like its working good for you guys so I have to dive deeper and see how things are done on this OS :)


Tj Holowaychuk

Vision Media - Victoria BC Web Design
Victoria British Columbia Web Design School

API Version for this bundle

shrop's picture

Is this bundle only for D6 or will much of the snippets work in D5? Is there an easy way to tell?

Thanks!
Shrop

I'm considering creating the

psynaptic's picture

I'm considering creating the theme extension to this bundle.

We have the ability to see which version of Drupal we're currently working on so I propose that we use this logic to insert the theme snippets for the version required.

I have already created theme_regions and theme_links to make sure I know how to do this.

http://pastie.textmate.org/private/9y46e41mgdcy3xtinervbq
http://pastie.textmate.org/private/0rzjlxf7nvdqnxh6lrdyba

You can add these as commands and use the following settings:

Input: None
Output: Insert as Snippet
Tab Trigger: theme_regions and theme_links respectively
Scope Selector: source.php

This will give you the ability to type theme_regions, press tab and you will have a fully formed theme_regions function inserted as a snippet.

I think this is pretty useful but wanted to find out if others would also find this a useful addition to the PHP Drupal bundle. Let me know your thoughts.

Looks good. I would love to

shrop's picture

Looks good.

I would love to have common theming functions added to the bundle.

I have hundreds of commands

tjholowaychuk's picture

I have hundreds of commands / snippits that I added, will contribute them ASAP. Even wrote a quick bash script to 'jump' to a function declaration within the project in other files.


Tj Holowaychuk

Vision Media - Victoria BC Web Design
Victoria British Columbia Web Design School

Drupal 6.x

psynaptic's picture

I'm going to work on updating the bundle now.

Does anyone have anything before I go ahead and do work you've already done?

Drupal Contrib API | #drupaluk IRC channel | Freestyle Systems

Textmate SVN repository location

psynaptic's picture

The repo location has changed to:

The SVN repo has changed location. Here is the current location:

http://svn.textmate.org/trunk/Review/Bundles/PHP%20Drupal.tmbundle/

Drupal Contrib API | #drupaluk IRC channel | Freestyle Systems

Does anything else need to

localhost's picture

Does anything else need to be done to install the textmate bundle other than setting TM_DRUPAL_VERSION and TM_DRUPAL_API shell variables inside textmate prefs? I keep getting an error "The PHP Drupal Bundle is not installed properly" when I use tab triggers with bundle from svn…

Same error

kim.pepper's picture

I Get the same error: "The PHP Drupal Bundle is not installed properly". I have set the both TM_DRUPAL_VERSION and TM_DRUPAL_API shell variables.

I upgraded to Snow Leopard a few weeks ago. Maybe this is the culprit?

Kim

Yes, there was an issue that

psynaptic's picture

Yes, there was an issue that mikejoconnor submitted a patch for where the TM_VARIABLES where in the wrong $_SERVER or $_ENV. His patch checks both locations and should fix the problem. Either do an svn up or delete and grab anew from github.

http://github.com/psynaptic/php-drupal.tmbundle

tortoisesvn not working

juicytoo's picture

Hi guys,

Thanks for this.

tortoisesvn on windows vista is failing for me when I try to "svn checkout" the drupal bundle.

Is there a tar.gz or zip file I can download somewhere?

Thanks

Development has moved to GitHub

psynaptic's picture

Just to let everyone know, I have today migrated development of the PHP Drupal TextMate bundle to GitHub!

It's time to update your bundles!

http://github.com/psynaptic/php-drupal.tmbundle

Quick installation instructions

stemount's picture

Just a quick and simple way (using the command-line) to install the Drupal textmate bundle.

Taking a ZIP / tar.gz out of GitHub will extract as a directory which is useless.

Just run in Terminal.app:

mkdir ~/Library/Application\ Support/TextMate/; mkdir ~/Library/Application\ Support/TextMate/Bundles/
cd ~/Library/Application\ Support/TextMate/Bundles/
git clone git://github.com/psynaptic/php-drupal.tmbundle.git

Should look something like this if it hasn't gone pear-shaped:

untouched-sm-mbp15:Bundles stephen$ mkdir ~/Library/Application\ Support/TextMate/
untouched-sm-mbp15:Bundles stephen$ mkdir ~/Library/Application\ Support/TextMate/Bundles/
untouched-sm-mbp15:Bundles stephen$ cd ~/Library/Application\ Support/TextMate/Bundles/
untouched-sm-mbp15:Bundles stephen$ git clone git://github.com/psynaptic/php-drupal.tmbundle.git
Initialized empty Git repository in /Users/stephen/Library/Application Support/TextMate/Bundles/php-drupal.tmbundle/.git/
remote: Counting objects: 1359, done.
remote: Compressing objects: 100% (451/451), done.
remote: Total 1359 (delta 924), reused 1266 (delta 869)
Receiving objects: 100% (1359/1359), 187.60 KiB | 306 KiB/s, done.
Resolving deltas: 100% (924/924), done.
Checking out files: 100% (417/417), done.
untouched-sm-mbp15:Bundles stephen$

For those who simply want the .tmbundle...

LoMo's picture

Taking a ZIP / tar.gz out of GitHub will extract as a directory which is useless.

Actually, it's easy to make the directory work... e.g. If I go to the download page for the Drupal .tmbundle, and download and extract the archive, I currently get a directory named: psynaptic-php-drupal.tmbundle-0d64d4e

If you rename that to simply: php-drupal.tmbundle (assuming you have Textmate installed), your system will recognize it as what it is: a Textmate Bundle. Double-clicking it will now automatically install it in Textmate and open it in Textmate's Bundle Editor, just as with any other Textmate Bundle.

This means that those of us who are just getting into Drupal development can get the latest release of this .tmbundle to work with, even before mastering the use of Git. ;-)

About me:
  • Drupal evangelist
  • (Former) regular author of the Cocomore Drupal Blog
  • Systems tester / QA automation, Kairion GmbH / freelance

Drupal IDE

Group organizers

Group categories

Drupal IDE Tags

Dev Software

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: