Merge lp:~marcustomlinson/unity-js-scopes/standalone-scope into lp:unity-js-scopes

Proposed by Marcus Tomlinson
Status: Merged
Merged at revision: 74
Proposed branch: lp:~marcustomlinson/unity-js-scopes/standalone-scope
Merge into: lp:unity-js-scopes
Diff against target: 245 lines (+109/-14)
11 files modified
debian/control (+3/-3)
debian/unity-js-scopes-bindings.install (+1/-1)
debian/unity-js-scopes-launcher.install (+2/-1)
examples/simple-click/CMakeLists.txt (+12/-3)
examples/simple-click/js-scope.apparmor (+1/-1)
examples/simple-click/src/CMakeLists.txt (+16/-1)
examples/simple-click/src/js-scope.webapps_js-scope.ini.in (+1/-3)
src/CMakeLists.txt (+1/-0)
src/launcher/main.cc (+2/-1)
src/tool/CMakeLists.txt (+22/-0)
src/tool/unity-js-scopes-tool (+48/-0)
To merge this branch: bzr merge lp:~marcustomlinson/unity-js-scopes/standalone-scope
Reviewer Review Type Date Requested Status
Alexandre Abreu (community) Approve
Review via email: mp+270684@code.launchpad.net

Commit message

Added unity-js-scopes-tool to allow for easy packaging of the bindings into scope projects, and updated the simple-click example scope accordingly.

To post a comment you must log in.
Revision history for this message
Alexandre Abreu (abreu-alexandre) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-08-25 13:47:20 +0000
3+++ debian/control 2015-09-16 07:03:32 +0000
4@@ -24,8 +24,8 @@
5 Depends: ${misc:Depends},
6 ${shlibs:Depends},
7 Description: Javascript bindings to unity scopes library
8- Provides a mean for developers to developer Ubuntu Scopes in Javascript
9- by providing bindings to the unity scopes API.
10+ Provides a means for developers to develop Ubuntu Scopes in Javascript
11+ by providing bindings to the Unity Scopes API.
12
13 Package: unity-js-scopes-launcher
14 Architecture: any
15@@ -34,4 +34,4 @@
16 ${shlibs:Depends},
17 unity-js-scopes-bindings (= ${binary:Version}),
18 Description: Scope launcher for unity javascript scopes
19- Provides a custom mean for developers to launch their Javascript Ubuntu Scopes.
20+ Provides a custom means for developers to launch their Javascript Ubuntu Scopes.
21
22=== modified file 'debian/unity-js-scopes-bindings.install'
23--- debian/unity-js-scopes-bindings.install 2015-07-09 01:03:04 +0000
24+++ debian/unity-js-scopes-bindings.install 2015-09-16 07:03:32 +0000
25@@ -1,1 +1,1 @@
26-node_modules/unity-js-scopes/*
27\ No newline at end of file
28+node_modules/unity-js-scopes/*
29
30=== modified file 'debian/unity-js-scopes-launcher.install'
31--- debian/unity-js-scopes-launcher.install 2015-07-09 01:03:04 +0000
32+++ debian/unity-js-scopes-launcher.install 2015-09-16 07:03:32 +0000
33@@ -1,1 +1,2 @@
34-usr/bin/unity-js-scopes-launcher
35\ No newline at end of file
36+usr/bin/unity-js-scopes-launcher
37+usr/bin/unity-js-scopes-tool
38
39=== modified file 'examples/simple-click/CMakeLists.txt'
40--- examples/simple-click/CMakeLists.txt 2015-08-06 09:37:35 +0000
41+++ examples/simple-click/CMakeLists.txt 2015-09-16 07:03:32 +0000
42@@ -1,7 +1,11 @@
43 project(js-scope)
44 cmake_minimum_required(VERSION 2.8.10)
45
46-# Do not remove this line, its required for the correct functionality of the Ubuntu-SDK
47+# Do not remove this, its required to ensure the correct node binaries are included in the project
48+execute_process(COMMAND unity-js-scopes-tool install ${CMAKE_SOURCE_DIR}/src/node_modules)
49+add_custom_target(install_modules ALL COMMAND unity-js-scopes-tool install ${CMAKE_SOURCE_DIR}/src/node_modules)
50+
51+# Do not remove this, its required for the correct functionality of the Ubuntu-SDK
52 set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Tells QtCreator location and name of the manifest file")
53 set(UBUNTU_PROJECT_TYPE "Scope" CACHE INTERNAL "Tells QtCreator this is a Scope project")
54
55@@ -21,16 +25,21 @@
56
57 configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
58
59-# Install the click manifest
60+# Install the manifest and apparmor files
61 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION "/")
62 install(FILES "js-scope.apparmor" DESTINATION "/")
63
64-# Make these files show up in QtCreator
65+# Make manifest, apparmor, and js files show up in QtCreator
66+file(GLOB_RECURSE
67+ _JS_FILES
68+ "*.js"
69+)
70 add_custom_target(hidden_files
71 ALL
72 SOURCES
73 manifest.json.in
74 js-scope.apparmor
75+ ${_JS_FILES}
76 )
77
78 # Add our main directories
79
80=== modified file 'examples/simple-click/js-scope.apparmor'
81--- examples/simple-click/js-scope.apparmor 2015-08-06 09:37:35 +0000
82+++ examples/simple-click/js-scope.apparmor 2015-09-16 07:03:32 +0000
83@@ -1,5 +1,5 @@
84 {
85- "template": "unconfined",
86+ "template": "ubuntu-scope-network",
87 "policy_groups": [],
88 "policy_version": 1.3
89 }
90
91=== modified file 'examples/simple-click/src/CMakeLists.txt'
92--- examples/simple-click/src/CMakeLists.txt 2015-08-19 12:25:48 +0000
93+++ examples/simple-click/src/CMakeLists.txt 2015-09-16 07:03:32 +0000
94@@ -8,7 +8,7 @@
95 )
96
97 configure_file(
98- "${CMAKE_CURRENT_SOURCE_DIR}/../data/${SCOPE_NAME}.ini.in"
99+ "${CMAKE_CURRENT_SOURCE_DIR}/${SCOPE_NAME}.ini.in"
100 "${CMAKE_CURRENT_BINARY_DIR}/${SCOPE_NAME}.ini"
101 @ONLY
102 COPYONLY
103@@ -21,6 +21,13 @@
104 COPYONLY
105 )
106
107+add_custom_target(
108+ copy_modules ALL
109+ COMMAND ${CMAKE_COMMAND} -E copy_directory
110+ "${CMAKE_CURRENT_SOURCE_DIR}/node_modules"
111+ "${CMAKE_CURRENT_BINARY_DIR}/node_modules"
112+)
113+
114 # Install the scope ini and js files
115 install(
116 FILES
117@@ -29,3 +36,11 @@
118 DESTINATION
119 ${SCOPE_INSTALL_DIR}
120 )
121+
122+install(
123+ DIRECTORY
124+ "${CMAKE_CURRENT_SOURCE_DIR}/node_modules"
125+ DESTINATION
126+ ${SCOPE_INSTALL_DIR}
127+ USE_SOURCE_PERMISSIONS
128+)
129
130=== renamed file 'examples/simple-click/data/js-scope.webapps_js-scope.ini.in' => 'examples/simple-click/src/js-scope.webapps_js-scope.ini.in'
131--- examples/simple-click/data/js-scope.webapps_js-scope.ini.in 2015-09-01 10:31:12 +0000
132+++ examples/simple-click/src/js-scope.webapps_js-scope.ini.in 2015-09-16 07:03:32 +0000
133@@ -1,7 +1,5 @@
134 [ScopeConfig]
135-ScopeRunner=/usr/bin/unity-js-scopes-launcher %S %R
136-#ScopeRunner=/usr/bin/gdbserver :10000 /usr/bin/unity-js-scopes-launcher %S %R
137-#DebugMode = true
138+ScopeRunner=./node_modules/unity-js-scopes/bin/unity-js-scopes-launcher %S %R
139 DisplayName = Simple JS Scope
140 Description = A simple JS scope
141 Author = WebApps
142
143=== modified file 'src/CMakeLists.txt'
144--- src/CMakeLists.txt 2015-06-19 20:38:02 +0000
145+++ src/CMakeLists.txt 2015-09-16 07:03:32 +0000
146@@ -18,3 +18,4 @@
147
148 add_subdirectory(bindings)
149 add_subdirectory(launcher)
150+add_subdirectory(tool)
151
152=== modified file 'src/launcher/main.cc'
153--- src/launcher/main.cc 2015-08-05 07:31:51 +0000
154+++ src/launcher/main.cc 2015-09-16 07:03:32 +0000
155@@ -29,7 +29,8 @@
156 #include <boost/filesystem.hpp>
157
158 void usage() {
159- std::cout << executable_name()
160+ std::cout << "Usage: "
161+ << executable_name()
162 << " "
163 << "<path-to-scope-ini>"
164 << " "
165
166=== added directory 'src/tool'
167=== added file 'src/tool/CMakeLists.txt'
168--- src/tool/CMakeLists.txt 1970-01-01 00:00:00 +0000
169+++ src/tool/CMakeLists.txt 2015-09-16 07:03:32 +0000
170@@ -0,0 +1,22 @@
171+# vim:expandtab:shiftwidth=2:tabstop=2:
172+
173+# Copyright (C) 2015 Canonical Ltd.
174+
175+# This library is free software; you can redistribute it and/or
176+# modify it under the terms of the GNU Lesser General Public
177+# License as published by the Free Software Foundation; either
178+# version 2.1 of the License, or (at your option) any later version.
179+
180+# This library is distributed in the hope that it will be useful,
181+# but WITHOUT ANY WARRANTY; without even the implied warranty of
182+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
183+# Lesser General Public License for more details.
184+
185+# You should have received a copy of the GNU Lesser General Public
186+# License along with this library; if not, write to the Free Software
187+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
188+
189+install(FILES unity-js-scopes-tool
190+ DESTINATION /usr/bin
191+ PERMISSIONS WORLD_READ WORLD_EXECUTE
192+ )
193
194=== added file 'src/tool/unity-js-scopes-tool'
195--- src/tool/unity-js-scopes-tool 1970-01-01 00:00:00 +0000
196+++ src/tool/unity-js-scopes-tool 2015-09-16 07:03:32 +0000
197@@ -0,0 +1,48 @@
198+#!/bin/bash
199+
200+# Check that there are 2 arguments
201+if [ $# != 2 ] || [ $1 != "install" ]; then
202+ echo "Usage: unity-js-scopes-tool install <path/to/node_modules>"
203+ exit 1
204+fi
205+
206+# Check that the target directory is named "node_modules"
207+if [[ ! $2 == */node_modules ]] && [[ ! $2 == */node_modules/ ]]; then
208+ echo "Target directory should be named 'node_modules'"
209+ exit 1
210+fi
211+
212+# Check that the argument is not already a file
213+if [ -f $2 ]; then
214+ echo "'$2' already exists as a file"
215+ exit 1
216+fi
217+
218+echo "Installation started."
219+
220+# Ensure that the target node_modules folder exists
221+mkdir -p $2
222+
223+# Copy the unity-js-scopes bindings into the target node_modules folder
224+echo "Removing '$2/unity-js-scopes' ..."
225+rm -rf $2/unity-js-scopes
226+echo "Copying '/node_modules/unity-js-scopes' to '$2' ..."
227+cp -r /node_modules/unity-js-scopes $2
228+echo "Copying '/usr/bin/unity-js-scopes-launcher' to '$2/unity-js-scopes/bin' ..."
229+mkdir -p $2/unity-js-scopes/bin
230+cp /usr/bin/unity-js-scopes-launcher $2/unity-js-scopes/bin
231+
232+# Rebuild any binary npm modules for the current targeted arch
233+if [ ! -f /usr/bin/node ] && [ -f /usr/bin/nodejs ]; then
234+ # If we are using the old node + npm:
235+ echo "Rebuilding binary modules in '$2' (using old nodejs) ..."
236+ ln -s /usr/bin/nodejs $2/node
237+ PATH=$2:$PATH nodejs /usr/lib/nodejs/npm/lib/npm.js --prefix=$2/../ rebuild
238+ rm $2/node
239+elif [ -f /usr/bin/npm ]; then
240+ # Else if we are using the new node + npm:
241+ echo "Rebuilding binary modules in '$2' (using npm) ..."
242+ npm --prefix=$2/../ rebuild
243+fi
244+
245+echo "Installation complete."

Subscribers

People subscribed via source and target branches

to all changes: