unitylock 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.babelrc +8 -0
  3. data/.gitignore +11 -0
  4. data/.node-version +1 -0
  5. data/.rspec +2 -0
  6. data/.ruby-version +1 -0
  7. data/.travis.yml +5 -0
  8. data/CODE_OF_CONDUCT.md +49 -0
  9. data/Gemfile +8 -0
  10. data/Gemfile.lock +53 -0
  11. data/LICENSE.txt +21 -0
  12. data/Procfile +1 -0
  13. data/README.md +32 -0
  14. data/Rakefile +10 -0
  15. data/app.json +7 -0
  16. data/app/action_creators/Lock.js +22 -0
  17. data/app/action_creators/Login.js +10 -0
  18. data/app/action_creators/LoginDialogAction.js +9 -0
  19. data/app/action_creators/Search.js +13 -0
  20. data/app/action_creators/SnackMessage.js +6 -0
  21. data/app/action_creators/Unlock.js +22 -0
  22. data/app/client.js +1 -0
  23. data/app/components/AppSnackBarComponent.js +24 -0
  24. data/app/components/FooterComponent.js +40 -0
  25. data/app/components/LockAppBarComponent.js +60 -0
  26. data/app/components/LockTableComponent.js +59 -0
  27. data/app/components/LoginDialogComponent.js +69 -0
  28. data/app/containers/App.js +18 -0
  29. data/app/containers/AppSnackBar.js +19 -0
  30. data/app/containers/LockAppBar.js +30 -0
  31. data/app/containers/LockTable.js +44 -0
  32. data/app/containers/LoginDialog.js +32 -0
  33. data/app/index.html +20 -0
  34. data/app/index.js +44 -0
  35. data/app/reducers/index.js +33 -0
  36. data/app/server.js +2 -0
  37. data/app/src/client.js +35 -0
  38. data/app/src/helper.js +85 -0
  39. data/app/src/row.js +60 -0
  40. data/app/src/socket.js +47 -0
  41. data/app/test/helper.spec.js +47 -0
  42. data/app/utils/FileUtils.js +11 -0
  43. data/art/unitylock-logo.png +0 -0
  44. data/bin/console +14 -0
  45. data/bin/setup +8 -0
  46. data/config.ru +4 -0
  47. data/config/puma.rb +9 -0
  48. data/exe/unitylock +44 -0
  49. data/lib/unitylock/client.rb +2 -0
  50. data/lib/unitylock/client/main.rb +90 -0
  51. data/lib/unitylock/server.rb +2 -0
  52. data/lib/unitylock/server/entity/unityfile.rb +38 -0
  53. data/lib/unitylock/server/model.rb +59 -0
  54. data/lib/unitylock/server/router.rb +71 -0
  55. data/lib/unitylock/server/service.rb +41 -0
  56. data/lib/unitylock/version.rb +3 -0
  57. data/package.json +52 -0
  58. data/public/favicon.ico +0 -0
  59. data/public/static/bundle.js +98 -0
  60. data/public/static/main.css +82 -0
  61. data/unitylock.gemspec +25 -0
  62. data/webpack.config.js +40 -0
  63. metadata +148 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c254d93f192db0169704d98885ce348a529d3204
4
+ data.tar.gz: a17343d86a53fbbf66d6cf19f017cc4b28b7bea7
5
+ SHA512:
6
+ metadata.gz: f7d6da95eba2841796f40a0763047b30485c853f9c9cb37d805ac367ca19e0517f4695b6398d191f2bc16158426d867eb75ca747f873f7e6e4870fbbc0c3fee5
7
+ data.tar.gz: a5dc577b0c464bbb26b9c5c675375d6fb46421d079d6aaca2934b9f17db651e4d9e10621c27c2a7f510449affc74cb697277977fee12285db1709c753d0a0787
@@ -0,0 +1,8 @@
1
+ {
2
+ "presets": ["es2015", "react"],
3
+ "env": {
4
+ "development": {
5
+ "presets": ["react-hmre"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ unitylock.json
11
+ node_modules/
@@ -0,0 +1 @@
1
+ v6.4.0
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1 @@
1
+ 2.3.1
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.12.5
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at mattak.me@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+ ruby '2.3.1'
3
+
4
+ gemspec
5
+
6
+ gem 'sinatra'
7
+ gem 'puma'
8
+ gem 'faraday'
@@ -0,0 +1,53 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ unitylock (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.2.5)
10
+ faraday (0.9.2)
11
+ multipart-post (>= 1.2, < 3)
12
+ multipart-post (2.0.0)
13
+ puma (3.6.0)
14
+ rack (1.6.4)
15
+ rack-protection (1.5.3)
16
+ rack
17
+ rake (10.5.0)
18
+ rspec (3.5.0)
19
+ rspec-core (~> 3.5.0)
20
+ rspec-expectations (~> 3.5.0)
21
+ rspec-mocks (~> 3.5.0)
22
+ rspec-core (3.5.2)
23
+ rspec-support (~> 3.5.0)
24
+ rspec-expectations (3.5.0)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.5.0)
27
+ rspec-mocks (3.5.0)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.5.0)
30
+ rspec-support (3.5.0)
31
+ sinatra (1.4.7)
32
+ rack (~> 1.5)
33
+ rack-protection (~> 1.4)
34
+ tilt (>= 1.3, < 3)
35
+ tilt (2.0.5)
36
+
37
+ PLATFORMS
38
+ ruby
39
+
40
+ DEPENDENCIES
41
+ bundler (~> 1.12)
42
+ faraday
43
+ puma
44
+ rake (~> 10.0)
45
+ rspec (~> 3.0)
46
+ sinatra
47
+ unitylock!
48
+
49
+ RUBY VERSION
50
+ ruby 2.3.0p0
51
+
52
+ BUNDLED WITH
53
+ 1.12.5
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 mattak
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1 @@
1
+ web: bundle exec puma -C config/puma.rb
@@ -0,0 +1,32 @@
1
+ # ![Unitylock](./art/unitylock-logo.png)
2
+
3
+ [![Build Status](https://travis-ci.org/mattak/unitylock.svg?branch=master)](https://travis-ci.org/mattak/unitylock)
4
+
5
+ Serve file lock management system for Unity3D.
6
+
7
+ ## Usage
8
+
9
+ You can easily deploy with heroku.
10
+
11
+ [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
12
+
13
+ Or clone repository and then type:
14
+
15
+ ```sh
16
+ ./bin/setup
17
+ rake serve
18
+ ```
19
+
20
+ ## Development
21
+
22
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
23
+
24
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
25
+
26
+ ## Contributing
27
+
28
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/unitylock-server. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
29
+
30
+ ## License
31
+
32
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
8
+ task :serve do
9
+ sh 'bundle', 'exec', 'puma', 'config.ru'
10
+ end
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "Unitylock",
3
+ "description": "Lock unity files and share with team members",
4
+ "image": "heroku/ruby",
5
+ "repository": "https://github.com/mattak/unitylock",
6
+ "keywords": ["ruby", "Unity3D"]
7
+ }
@@ -0,0 +1,22 @@
1
+ export default function Lock(dispatch, name, file) {
2
+ let urlbase = location.protocol + "//" + location.host;
3
+ let url = urlbase + "/user/" + name + "/lock";
4
+
5
+ return fetch(url, {
6
+ method: 'PUT',
7
+ headers: {
8
+ 'Accept': 'application/json',
9
+ 'Content-Type': 'application/json',
10
+ },
11
+ body: JSON.stringify({
12
+ file: file,
13
+ })
14
+ })
15
+ .then(res => res.json())
16
+ .then(result =>
17
+ dispatch({
18
+ type: "lock",
19
+ data: result
20
+ })
21
+ );
22
+ }
@@ -0,0 +1,10 @@
1
+ export default function Login(dispatch, name) {
2
+ return new Promise((resolve,reject) => {
3
+ console.log("user: " + name)
4
+ dispatch({
5
+ type: "login",
6
+ user: name,
7
+ })
8
+ resolve(name)
9
+ })
10
+ }
@@ -0,0 +1,9 @@
1
+ export default function LoginDialogAction(dispatch, open) {
2
+ return new Promise((resolve, reject) => {
3
+ dispatch({
4
+ type: 'login_dialog_open',
5
+ login_dialog_open: open,
6
+ })
7
+ resolve(open)
8
+ })
9
+ }
@@ -0,0 +1,13 @@
1
+ export default function Search(dispatch) {
2
+ var urlbase = location.protocol + "//" + location.host;
3
+ var url = urlbase + "/files";
4
+
5
+ return fetch(url)
6
+ .then(res => res.json())
7
+ .then(result =>
8
+ dispatch({
9
+ type: "search",
10
+ data: result
11
+ })
12
+ );
13
+ }
@@ -0,0 +1,6 @@
1
+ export default function SnackMessage(dispatch, message) {
2
+ return new Promise((resolve, reject) => {
3
+ dispatch({type: 'snack_message', snack_message: message})
4
+ resolve(message)
5
+ });
6
+ }
@@ -0,0 +1,22 @@
1
+ export default function Unlock(dispatch, name, file) {
2
+ let urlbase = location.protocol + "//" + location.host;
3
+ let url = urlbase + "/user/" + name + "/unlock";
4
+
5
+ return fetch(url, {
6
+ method: 'PUT',
7
+ headers: {
8
+ 'Accept': 'application/json',
9
+ 'Content-Type': 'application/json',
10
+ },
11
+ body: JSON.stringify({
12
+ file: file,
13
+ })
14
+ })
15
+ .then(res => res.json())
16
+ .then(result =>
17
+ dispatch({
18
+ type: 'unlock',
19
+ data: result
20
+ })
21
+ );
22
+ }
@@ -0,0 +1 @@
1
+ require('./src/client')
@@ -0,0 +1,24 @@
1
+ import React, { Component, PropTypes } from 'react'
2
+ import SnackBar from 'material-ui/SnackBar'
3
+
4
+ class AppSnackBarComponent extends Component {
5
+ constructor(props) {
6
+ super(props)
7
+ }
8
+
9
+ render() {
10
+ return (
11
+ <SnackBar
12
+ open={this.props.message !== ''}
13
+ message={this.props.message}
14
+ autoHideDuration={1000}
15
+ />
16
+ )
17
+ }
18
+ }
19
+
20
+ AppSnackBarComponent.propTypes = {
21
+ message: PropTypes.string.isRequired,
22
+ }
23
+
24
+ export default AppSnackBarComponent
@@ -0,0 +1,40 @@
1
+ import React, { Component, PropTypes } from 'react'
2
+ import FontIcon from 'material-ui/FontIcon'
3
+ import Paper from 'material-ui/Paper'
4
+ import {white, red500} from 'material-ui/styles/colors'
5
+
6
+ export default class FooterComponent extends Component {
7
+ constructor(props) {
8
+ super(props)
9
+ }
10
+
11
+ render() {
12
+ const style = {
13
+ marginTop: '16px',
14
+ background: '#AAAAAA',
15
+ padding: '16px',
16
+ }
17
+ const divStyle = {
18
+ color: 'white',
19
+ display: 'table-cell',
20
+ textAlign: 'center',
21
+ fontSize: '16px',
22
+ }
23
+ const iconStyle = {
24
+ paddingLeft: '8px',
25
+ paddingRight: '8px',
26
+ verticalAlign: 'middle',
27
+ }
28
+
29
+ return (
30
+ <Paper style={style} zDepth={0}>
31
+ <span style={divStyle}>
32
+ <FontIcon className='muidocs-icon-custom-github' style={iconStyle} />
33
+ <a href="https://github.com/mattak/unitylock">
34
+ unitylock
35
+ </a> is available from github
36
+ </span>
37
+ </Paper>
38
+ )
39
+ }
40
+ };
@@ -0,0 +1,60 @@
1
+ import React, { Component, PropTypes } from 'react'
2
+ import IconButton from 'material-ui/IconButton'
3
+ import AppBar from 'material-ui/AppBar'
4
+ import NotificationSync from 'material-ui/svg-icons/notification/sync'
5
+ import AccountCircle from 'material-ui/svg-icons/action/account-circle'
6
+ import { white } from 'material-ui/styles/colors'
7
+
8
+ class LockAppBarComponent extends Component {
9
+ constructor(props) {
10
+ super(props)
11
+ this.handleOnLoginClick = this.handleOnLoginClick.bind(this);
12
+ this.handleOnSyncClick = this.handleOnSyncClick.bind(this);
13
+ }
14
+
15
+ handleOnLoginClick() {
16
+ this.props.onLoginClick()
17
+ }
18
+
19
+ // event: object, isKeyboardFocused: boolean
20
+ handleOnSyncClick() {
21
+ this.props.onSyncClick()
22
+ }
23
+
24
+ render() {
25
+ const styles = {
26
+ medium: {
27
+ width: 96,
28
+ height: 96,
29
+ padding: 16,
30
+ },
31
+ mediumIcon: {
32
+ width: 48,
33
+ height: 48,
34
+ }
35
+ }
36
+
37
+ return (
38
+ <AppBar
39
+ title="unitylock"
40
+ iconElementRight={
41
+ <span>
42
+ <IconButton onTouchTap={this.handleOnSyncClick}>
43
+ <NotificationSync color={white} />
44
+ </IconButton>
45
+ <IconButton onTouchTap={this.handleOnLoginClick}>
46
+ <AccountCircle color={white} />
47
+ </IconButton>
48
+ </span>
49
+ }
50
+ />
51
+ )
52
+ }
53
+ }
54
+
55
+ LockAppBarComponent.propTypes = {
56
+ onLoginClick: PropTypes.func.isRequired,
57
+ onSyncClick: PropTypes.func.isRequired,
58
+ }
59
+
60
+ export default LockAppBarComponent