Commit 46f264fa408a93242327e040e6797a986faa7901
1 parent
a4fefc0c
Exists in
master
and in
29 other branches
noosfero-plugins: support out-of-tree plugins
Installing out-of-tree plugins with $ ./script/noosfero-plugins enable /path/to/plugin will just work. (Manually creating the symlinks should already work, but what the hell) Also, install relative symlinks to allow relocation of the Noosfero tree.
Showing
1 changed file
with
17 additions
and
2 deletions
Show diff stats
script/noosfero-plugins
... | ... | @@ -79,7 +79,22 @@ run(){ |
79 | 79 | |
80 | 80 | _enable(){ |
81 | 81 | plugin="$1" |
82 | - source="$available_plugins_dir/$plugin" | |
82 | + | |
83 | + if [ -d "$available_plugins_dir/$plugin" ]; then | |
84 | + source="$available_plugins_dir/$plugin" | |
85 | + linksource="../../plugins/$plugin" | |
86 | + else | |
87 | + if [ ! -d "$plugin" ]; then | |
88 | + echo "E: $plugin not found (needs to be an existing directory)" | |
89 | + return | |
90 | + fi | |
91 | + | |
92 | + # out-of-tree plugins | |
93 | + source="$plugin" | |
94 | + linksource="$source" | |
95 | + plugin=$(basename "$plugin") | |
96 | + fi | |
97 | + | |
83 | 98 | target="$enabled_plugins_dir/$plugin" |
84 | 99 | base="$base_plugins_dir/$plugin" |
85 | 100 | run "$source/before_enable.rb" |
... | ... | @@ -110,7 +125,7 @@ _enable(){ |
110 | 125 | fi |
111 | 126 | fi |
112 | 127 | if [ "$installation_ok" = true ] && [ "$dependencies_ok" = true ]; then |
113 | - ln -s "$source" "$target" | |
128 | + ln -s "$linksource" "$target" | |
114 | 129 | plugins_public_dir="$NOOSFERO_DIR/public/plugins" |
115 | 130 | plugins_features_dir="$NOOSFERO_DIR/features/plugins" |
116 | 131 | test -d "$target/public" && ln -s "$target/public" "$plugins_public_dir/$plugin" | ... | ... |