rails-fix-permissions 1.2 → 1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4753d5a24a96e6538707dc60cde4d97967ef93a6
4
- data.tar.gz: ce3705d09e48c51158609e00a3fbaf23c437e622
3
+ metadata.gz: 12209fbee3ec744398d760f456e73ea9d3400734
4
+ data.tar.gz: c1e08a44c8c24fd71853d6c7c4f8ea1af1d9cade
5
5
  SHA512:
6
- metadata.gz: 2889f400e9e4e8c91447d0eab4db6f9280328b07880ed4305bfa104a299a6f01734d0bb3885d0834f11959b3d401433a41a41b50b6b0947562f8fec40d2257bd
7
- data.tar.gz: db7104da973d43e85df69e3f7ae3e172d5de7e8a0355d9ad2bf4c774edfc765b7d6c3c548da86152bb7d29b47d216388390f9489961277972f17f3ee3f694c01
6
+ metadata.gz: 6b03022ea4d018e75de341f4382fff62d933e28ee401571c2c8b0237e233a249aa12c3f48136eb779696d158f1185f2ec3b608f7d025bdd7998515faf99ae0a4
7
+ data.tar.gz: 2a1289071fa1c55e6c0eb4ad9c71685293de33dc3606b46a4eb887b356a45e4cfe969b930f8bf40be9e6786e62bf37a7ae50f77b70bc0f877c8c96b0446d9a39
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'rails-fix-permissions'
4
4
 
5
- rails_fix_permissions = RailsFixPermissions.new()
5
+ rails_fix_permissions = RailsFixPermissions.new
@@ -1,19 +1,28 @@
1
1
  class RailsFixPermissions
2
2
  def initialize
3
- # Get the current dir and the name of the current folder.
4
- current_dir = `pwd`
5
- basename = `basename #{current_dir}`
6
- app_path = '../' + basename.chomp("\n")
7
-
8
- # Run shell scripts to set permissions.
9
- directories = `chmod 755 $(find #{app_path} -type d)`
10
- files = `chmod 644 $(find #{app_path} -type f)`
11
- bundle = `chmod 755 #{app_path+'/bin/bundle'}`
12
- rails = `chmod 755 #{app_path+'/bin/rails'}`
13
- rake = `chmod 755 #{app_path+'/bin/rake'}`
14
- spring = `chmod 755 #{app_path+'/bin/spring'}`
15
-
16
- puts 'Done!'
3
+ # Relational path of the current folder (app folder).
4
+ @app_path = '../' + File.basename(Dir.getwd)
5
+ if File.exist?(@app_path+'/bin/rails')
6
+ set_permissions
7
+ else
8
+ puts "It's not a Rails application."
9
+ puts "Exiting..."
10
+ end
11
+ end
17
12
 
13
+ # Shell scripts to recursively set the Rails defaults permissions.
14
+ def set_permissions
15
+ if File.directory?(@app_path)
16
+ puts "Running shell scripts into '"+@app_path+"' to set permissions..."
17
+ directories = `chmod 755 $(find #{@app_path} -type d)`
18
+ files = `chmod 644 $(find #{@app_path} -type f)`
19
+ bundle = `chmod 755 #{@app_path+'/bin/bundle'}`
20
+ rails = `chmod 755 #{@app_path+'/bin/rails'}`
21
+ rake = `chmod 755 #{@app_path+'/bin/rake'}`
22
+ spring = `chmod 755 #{@app_path+'/bin/spring'}`
23
+ puts 'Done!'
24
+ else
25
+ puts "Something went wrong, rails-fix-permissions can't find the current working path: '"+@app_path+"'"
26
+ end
18
27
  end
19
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-fix-permissions
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Schuindt
@@ -10,13 +10,13 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-09-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Sometimes you may mess your Rails application Unix permissions and get
14
- some annoying errors with git. This gem runs a simple Shell script to fix that.
15
- Granting 755 permissions to folders and 644 to files, also ensures that some special
16
- files inside the 'bin/' folder will recive special 755 permissions (bundle, rails,
17
- rake and spring) which is pretty much the Rails default. Works with all versions
18
- of Ruby on Rails. After install run 'rails-fix-permissions' on your applicaiton
19
- root folder to fix the permissions.
13
+ description: Sometimes you mess your Rails application Unix permissions and get some
14
+ annoying errors with git. This gem runs a simple shell script to fix that. Granting
15
+ 755 permissions to folders and 644 to files, it also ensures that some special files
16
+ inside the 'bin/' will recive special 755 permissions (bundle, rails, rake and spring)
17
+ which is pretty much the Rails default. Works with all versions of Ruby on Rails;
18
+ After install run 'rails-fix-permissions' on terminal inside the application folder
19
+ to fix. Note that in some cases you may need to run it as superuser with 'sudo'.
20
20
  email: f.schuindtcs@gmail.com
21
21
  executables:
22
22
  - rails-fix-permissions
@@ -35,12 +35,12 @@ require_paths:
35
35
  - lib
36
36
  required_ruby_version: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  requirements:
43
- - - ">="
43
+ - - '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  requirements: []