user_space 0.3.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/user_space/user_space.rb +5 -3
- data/lib/user_space/version.rb +1 -1
- metadata +6 -52
- data/History.txt +0 -9
- data/TODO.txt +0 -5
- data/data/VERSION +0 -1
- data/features/main.feature +0 -9
- data/features/step_definitions/main_steps.rb +0 -18
- data/test/user_space.rb +0 -129
- data/user_space.gemspec +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 532cc3386ae1ec0bdec441e5d25d5279f82e8547
|
4
|
+
data.tar.gz: 0a7e250d95306c27bfdc8d11781ec949eed1cb86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1a002a63985694c84a738c3028fd39fd33e0caeb19d135dbc7f2fd08c8c77bd75fdef6cc83d0263190d053b7d52dded3406883df5eba35b0127d4897bbc189e
|
7
|
+
data.tar.gz: 03b8b6d9a28934c68ca6f820a8b1d2026d7eb4bf5b1e1168ae68d763671dd2de63d0192ec5781894b95570c28923529553e7f7e4ec638fd7091783d9230929d4
|
@@ -20,8 +20,10 @@ module USER_SPACE
|
|
20
20
|
@options = OPTIONS
|
21
21
|
|
22
22
|
unless @appdir
|
23
|
-
appdir = File.dirname File.dirname
|
23
|
+
appdir = File.dirname File.dirname caller_locations(1,1)[0].path
|
24
|
+
appdir = File.dirname appdir if File.basename(appdir)=='lib'
|
24
25
|
@appdir = File.expand_path appdir
|
26
|
+
verbose.puts "Warning: UserSpace#appdir heuristics used" if verbose
|
25
27
|
end
|
26
28
|
|
27
29
|
# install with no overwrite
|
@@ -92,7 +94,7 @@ module USER_SPACE
|
|
92
94
|
options[:parser].parse File.read(config_file_name(options))
|
93
95
|
rescue
|
94
96
|
trace.puts $!.message if trace
|
95
|
-
|
97
|
+
verbose.puts $!.backtrace if verbose
|
96
98
|
nil
|
97
99
|
end
|
98
100
|
|
@@ -119,7 +121,7 @@ module USER_SPACE
|
|
119
121
|
File.read(version_file_name).strip
|
120
122
|
rescue
|
121
123
|
trace.puts $!.message if trace
|
122
|
-
|
124
|
+
verbose.puts $!.backtrace if verbose
|
123
125
|
nil
|
124
126
|
end
|
125
127
|
|
data/lib/user_space/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_space
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- carlosjhr64
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xdg
|
@@ -30,46 +30,6 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.2.3
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: rainbow
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '1.99'
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: 1.99.1
|
43
|
-
type: :development
|
44
|
-
prerelease: false
|
45
|
-
version_requirements: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '1.99'
|
50
|
-
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: 1.99.1
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: test-unit
|
55
|
-
requirement: !ruby/object:Gem::Requirement
|
56
|
-
requirements:
|
57
|
-
- - "~>"
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: '2.5'
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 2.5.5
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '2.5'
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: 2.5.5
|
73
33
|
description: |
|
74
34
|
Automates certain XDG features.
|
75
35
|
email: carlosjhr64@gmail.com
|
@@ -78,17 +38,10 @@ extensions: []
|
|
78
38
|
extra_rdoc_files:
|
79
39
|
- README.rdoc
|
80
40
|
files:
|
81
|
-
- History.txt
|
82
41
|
- README.rdoc
|
83
|
-
- TODO.txt
|
84
|
-
- data/VERSION
|
85
|
-
- features/main.feature
|
86
|
-
- features/step_definitions/main_steps.rb
|
87
42
|
- lib/user_space.rb
|
88
43
|
- lib/user_space/user_space.rb
|
89
44
|
- lib/user_space/version.rb
|
90
|
-
- test/user_space.rb
|
91
|
-
- user_space.gemspec
|
92
45
|
homepage: https://github.com/carlosjhr64/user_space
|
93
46
|
licenses:
|
94
47
|
- MIT
|
@@ -110,10 +63,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
63
|
- !ruby/object:Gem::Version
|
111
64
|
version: '0'
|
112
65
|
requirements:
|
113
|
-
- 'ruby: ruby 2.1.
|
66
|
+
- 'ruby: ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]'
|
114
67
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.
|
68
|
+
rubygems_version: 2.4.1
|
116
69
|
signing_key:
|
117
70
|
specification_version: 4
|
118
71
|
summary: Automates certain XDG features.
|
119
72
|
test_files: []
|
73
|
+
has_rdoc:
|
data/History.txt
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
=== 0.0.0 / 2013-12-21 09:33:10 -0800
|
2
|
-
=== 0.0.0 / 2013-12-22 15:18:15 -0800
|
3
|
-
2421f13574dd2ad78d6cc591e52b4261 pkg/user_space-0.0.0.gem
|
4
|
-
=== 0.1.0 / 2013-12-30 11:51:13 -0800
|
5
|
-
c0014415ced058f3b79910f5c52bfe1e pkg/user_space-0.1.0.gem
|
6
|
-
=== 0.2.0 / 2014-01-02 10:12:47 -0800
|
7
|
-
1cd8d6d59f08ff03b32c895ee254ca14 pkg/user_space-0.2.0.gem
|
8
|
-
=== 0.3.0 / 2014-01-16 08:17:03 -0800
|
9
|
-
b2df08bdd1e6f0be634109602ef1c63e pkg/user_space-0.3.0.gem
|
data/TODO.txt
DELETED
data/data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.20.300
|
data/features/main.feature
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'rainbow'
|
2
|
-
# TODO: Come up with some good cucumber tests.
|
3
|
-
Given /^(\w+) (.*)$/ do |given, condition|
|
4
|
-
condition.strip!
|
5
|
-
case given
|
6
|
-
when 'Given'
|
7
|
-
#raise "'Given' form not defined."
|
8
|
-
STDERR.puts "Need to come up with some cucumber tests".color(:blue)
|
9
|
-
when 'When'
|
10
|
-
#raise "'When' form not defined."
|
11
|
-
STDERR.puts "Need to come up with some cucumber tests".color(:blue)
|
12
|
-
when 'Then'
|
13
|
-
#raise "'Then' form not defined."
|
14
|
-
STDERR.puts "Need to come up with some cucumber tests".color(:blue)
|
15
|
-
else
|
16
|
-
raise "'#{given}' form not defined."
|
17
|
-
end
|
18
|
-
end
|
data/test/user_space.rb
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'tmpdir'
|
3
|
-
TMPDIR = Dir.mktmpdir
|
4
|
-
Dir.mkdir File.join TMPDIR, '.cache'
|
5
|
-
Dir.mkdir File.join TMPDIR, '.config'
|
6
|
-
Dir.mkdir File.join TMPDIR, '.local'
|
7
|
-
Dir.mkdir File.join TMPDIR, '.local', 'share'
|
8
|
-
APPNAME = 'ima2awesome'
|
9
|
-
|
10
|
-
ENV['HOME'] = TMPDIR
|
11
|
-
$0 = APPNAME
|
12
|
-
|
13
|
-
# Needed to setup the enviroment first, now...
|
14
|
-
require 'user_space'
|
15
|
-
|
16
|
-
class TestUserSpace < Test::Unit::TestCase
|
17
|
-
|
18
|
-
include USER_SPACE
|
19
|
-
|
20
|
-
def test_user_space_version
|
21
|
-
assert_equal('0.3.1', VERSION)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_user_space_constants
|
25
|
-
assert_equal 'config', UserSpace::OPTIONS[:config]
|
26
|
-
assert_equal JSON, UserSpace::OPTIONS[:parser]
|
27
|
-
assert_equal 'VERSION', UserSpace::OPTIONS[:version]
|
28
|
-
assert_nil UserSpace::OPTIONS[:ext]
|
29
|
-
|
30
|
-
assert_equal 'ima2awesome', UserSpace::PARAMETERS[:appname]
|
31
|
-
|
32
|
-
xdgbases = UserSpace::PARAMETERS[:xdgbases]
|
33
|
-
assert xdgbases.include? 'CACHE'
|
34
|
-
assert xdgbases.include? 'CONFIG'
|
35
|
-
assert xdgbases.include? 'DATA'
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_user_space_new
|
39
|
-
userspace = nil
|
40
|
-
assert_nothing_raised(Exception){userspace = UserSpace.new}
|
41
|
-
|
42
|
-
assert_equal(APPNAME, userspace.appname)
|
43
|
-
|
44
|
-
dirname = File.dirname File.dirname File.expand_path __FILE__
|
45
|
-
assert_equal(dirname, userspace.appdir)
|
46
|
-
|
47
|
-
xdgbases = userspace.xdgbases
|
48
|
-
assert(userspace.xdgbases.include?('CACHE'))
|
49
|
-
assert(userspace.xdgbases.include?('CONFIG'))
|
50
|
-
assert(userspace.xdgbases.include?('DATA'))
|
51
|
-
|
52
|
-
count = 0
|
53
|
-
userspace.xdg_pairs do |basedir, userdir|
|
54
|
-
count += 1
|
55
|
-
assert(File.directory?(userdir))
|
56
|
-
refute_nil(userdir=~/\/ima2awesome$/)
|
57
|
-
refute_nil(basedir=~/user_space\/((data)|(config)|(cache))$/)
|
58
|
-
end
|
59
|
-
assert_equal(3, count)
|
60
|
-
|
61
|
-
options = userspace.options
|
62
|
-
assert_equal('config', options[:config])
|
63
|
-
assert_equal('VERSION', options[:version])
|
64
|
-
assert_equal(JSON, options[:parser])
|
65
|
-
assert_nil(options[:ext])
|
66
|
-
|
67
|
-
cachedir, configdir, datadir = userspace.cachedir, userspace.configdir, userspace.datadir
|
68
|
-
assert File.exist? cachedir
|
69
|
-
assert File.exist? configdir
|
70
|
-
assert File.exist? datadir
|
71
|
-
|
72
|
-
version = File.read('data/VERSION').strip
|
73
|
-
assert_equal version, userspace.version
|
74
|
-
|
75
|
-
config_file_name = userspace.config_file_name
|
76
|
-
refute File.exist? config_file_name
|
77
|
-
config1 = {'a'=>"A", 'b'=>"B"}
|
78
|
-
userspace.config = config1
|
79
|
-
assert File.exist? config_file_name
|
80
|
-
config2 = JSON.parse File.read config_file_name
|
81
|
-
assert_equal config1, config2
|
82
|
-
|
83
|
-
# Overwrite version file...
|
84
|
-
version_file_name = userspace.version_file_name
|
85
|
-
File.open(version_file_name, 'w'){|fh|fh.puts 'A.B.C'}
|
86
|
-
# Now we get the version given to the file:
|
87
|
-
assert_equal 'A.B.C', userspace.version
|
88
|
-
# Which is different from the initial version
|
89
|
-
refute version == 'A.B.C'
|
90
|
-
|
91
|
-
# But we can re-fresh our install
|
92
|
-
assert_nothing_raised(Exception){userspace.install}
|
93
|
-
# Now we have our initial version back
|
94
|
-
assert_equal version, userspace.version
|
95
|
-
|
96
|
-
[config_file_name, version_file_name].each do |fn|
|
97
|
-
stat = File.stat(fn)
|
98
|
-
assert_equal stat.mode.to_s(8), '100600'
|
99
|
-
end
|
100
|
-
|
101
|
-
[cachedir, configdir, datadir].each do |dn|
|
102
|
-
stat = File.stat(dn)
|
103
|
-
assert_equal stat.mode.to_s(8), '40700'
|
104
|
-
end
|
105
|
-
|
106
|
-
assert userspace.version?
|
107
|
-
assert_nothing_raised(Exception){ userspace.version='Fantastico' }
|
108
|
-
assert_equal userspace.version, 'Fantastico'
|
109
|
-
|
110
|
-
# testing configures
|
111
|
-
config_file_name = userspace.config_file_name
|
112
|
-
File.unlink config_file_name if File.exist? config_file_name
|
113
|
-
config1 = {:a=>'A', :b=>'B'}
|
114
|
-
refute File.exist? config_file_name
|
115
|
-
userspace.configures(config1)
|
116
|
-
# Here, it copies to file.
|
117
|
-
assert File.exist? config_file_name
|
118
|
-
# And config1 remains unchanged.
|
119
|
-
assert_equal(config1[:a], 'A')
|
120
|
-
assert_equal(config1[:b], 'B')
|
121
|
-
assert_equal(config1[:c], nil)
|
122
|
-
config2 = {:a=>'AAA', :c=>'CCC'}
|
123
|
-
# Here, config2 is overwritten with config1 from file.
|
124
|
-
userspace.configures(config2)
|
125
|
-
assert_equal(config2[:a], 'A') # overwritten
|
126
|
-
assert_equal(config2[:b], 'B') # padded up
|
127
|
-
assert_equal(config2[:c], 'CCC') # Original value
|
128
|
-
end
|
129
|
-
end
|
data/user_space.gemspec
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
|
3
|
-
s.name = 'user_space'
|
4
|
-
s.version = '0.3.1'
|
5
|
-
|
6
|
-
s.homepage = 'https://github.com/carlosjhr64/user_space'
|
7
|
-
|
8
|
-
s.author = 'CarlosJHR64'
|
9
|
-
s.email = 'carlosjhr64@gmail.com'
|
10
|
-
|
11
|
-
s.date = '2014-01-16'
|
12
|
-
s.licenses = ['MIT']
|
13
|
-
|
14
|
-
s.description = <<DESCRIPTION
|
15
|
-
Automates certain XDG features.
|
16
|
-
DESCRIPTION
|
17
|
-
|
18
|
-
s.summary = <<SUMMARY
|
19
|
-
Automates certain XDG features.
|
20
|
-
SUMMARY
|
21
|
-
|
22
|
-
s.extra_rdoc_files = ['README.rdoc']
|
23
|
-
s.rdoc_options = ["--main", "README.rdoc"]
|
24
|
-
|
25
|
-
s.require_paths = ["lib"]
|
26
|
-
s.files = %w(
|
27
|
-
History.txt
|
28
|
-
README.rdoc
|
29
|
-
TODO.txt
|
30
|
-
data/VERSION
|
31
|
-
features/main.feature
|
32
|
-
features/step_definitions/main_steps.rb
|
33
|
-
lib/user_space.rb
|
34
|
-
lib/user_space/user_space.rb
|
35
|
-
lib/user_space/version.rb
|
36
|
-
test/user_space.rb
|
37
|
-
user_space.gemspec
|
38
|
-
)
|
39
|
-
|
40
|
-
s.add_runtime_dependency 'xdg', '~> 2.2', '>= 2.2.3'
|
41
|
-
s.add_development_dependency 'rainbow', '~> 1.99', '>= 1.99.1'
|
42
|
-
s.add_development_dependency 'test-unit', '~> 2.5', '>= 2.5.5'
|
43
|
-
s.requirements << 'ruby: ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]'
|
44
|
-
|
45
|
-
end
|