enzyme 1.0.0.beta01 → 1.0.0.beta02
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/commands/config.rb +20 -25
- data/lib/commands/create.rb +6 -6
- data/lib/commands/join.rb +9 -9
- data/lib/commands/sync.rb +11 -11
- metadata +13 -13
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.
|
1
|
+
1.0.0.beta02
|
data/lib/commands/config.rb
CHANGED
@@ -9,11 +9,21 @@ module Config extend self
|
|
9
9
|
value = ARGV.shift
|
10
10
|
ARGV.each { |x| raise UnknownArgument.new(x) }
|
11
11
|
|
12
|
+
if file.nil?
|
13
|
+
file = $system_settings.config.project.exists ? "project" : "global"
|
14
|
+
else
|
15
|
+
file = file.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
raise ConfigFileNotFound.new($system_settings.config[file].path) unless $system_settings.config[file].exists
|
19
|
+
|
20
|
+
path = $system_settings.config[file].path
|
21
|
+
|
12
22
|
unless value === nil
|
13
|
-
set(key, value,
|
14
|
-
puts "Set '#{key}' to '#{value}' in '#{
|
23
|
+
set(key, value, path)
|
24
|
+
puts "Set '#{key}' to '#{value}' in '#{path}'."
|
15
25
|
else
|
16
|
-
val = get(key,
|
26
|
+
val = get(key, path)
|
17
27
|
if val.is_a?(Array) || val.is_a?(Hash)
|
18
28
|
puts val.to_hash.to_yaml
|
19
29
|
else
|
@@ -23,17 +33,11 @@ module Config extend self
|
|
23
33
|
puts
|
24
34
|
end
|
25
35
|
|
26
|
-
# Checks if the given setting has a value.
|
27
|
-
# - key: The setting to check.
|
28
|
-
def is_set?(key)
|
29
|
-
(get(key).nil? || get(key).empty?) ? false : true
|
30
|
-
end
|
31
|
-
|
32
36
|
# Gets the value of a given setting.
|
33
37
|
# - key: The setting to get.
|
34
|
-
# -
|
35
|
-
def get(key,
|
36
|
-
s = file ? (YAML.load_file(
|
38
|
+
# - path: The path to the config file to get the setting from.
|
39
|
+
def get(key, path)
|
40
|
+
s = file ? (YAML.load_file(path) || {}) : $settings
|
37
41
|
key.to_s.split('.').each do |o|
|
38
42
|
return nil if s[o].nil?
|
39
43
|
s = s[o]
|
@@ -44,17 +48,8 @@ module Config extend self
|
|
44
48
|
# Sets the value of the given setting.
|
45
49
|
# - key: The setting to set.
|
46
50
|
# - value: The value to set the setting to.
|
47
|
-
# -
|
48
|
-
def set(key, value,
|
49
|
-
if file.nil?
|
50
|
-
file = $system_settings.config.project.exists ? "project" : "global"
|
51
|
-
else
|
52
|
-
file = file.nil? ? 'global' : file.to_s
|
53
|
-
end
|
54
|
-
|
55
|
-
# Bail if the config file doesn't exist.
|
56
|
-
raise ConfigFileNotFound.new($system_settings.config[file].path) unless $system_settings.config[file].exists
|
57
|
-
|
51
|
+
# - path: The path to the config file to set the setting in.
|
52
|
+
def set(key, value, path)
|
58
53
|
# FIXME: This could be simplified... heaps.
|
59
54
|
new_settings = { 'enzyme_version' => $system_settings.version }
|
60
55
|
current_hash = new_settings
|
@@ -68,12 +63,12 @@ module Config extend self
|
|
68
63
|
$settings = $settings.deep_merge(new_settings)
|
69
64
|
|
70
65
|
# Reload the settings to avoid including temporary settings.
|
71
|
-
settings = YAML.load_file(
|
66
|
+
settings = YAML.load_file(path) || {}
|
72
67
|
# Merge in the new settings.
|
73
68
|
settings = settings.deep_merge(new_settings)
|
74
69
|
|
75
70
|
# Save the settings to the config file.
|
76
|
-
write(
|
71
|
+
write(path, settings)
|
77
72
|
end
|
78
73
|
|
79
74
|
def write(path, settings)
|
data/lib/commands/create.rb
CHANGED
@@ -31,13 +31,13 @@ module Create extend self
|
|
31
31
|
commit_repo directory
|
32
32
|
detach_repo directory
|
33
33
|
|
34
|
-
create_repo "#{directory}/
|
35
|
-
commit_repo "#{directory}/
|
36
|
-
detach_repo "#{directory}/
|
34
|
+
create_repo "#{directory}/resources"
|
35
|
+
commit_repo "#{directory}/resources"
|
36
|
+
detach_repo "#{directory}/resources"
|
37
37
|
|
38
|
-
create_repo "#{directory}/
|
39
|
-
commit_repo "#{directory}/
|
40
|
-
detach_repo "#{directory}/
|
38
|
+
create_repo "#{directory}/production"
|
39
|
+
commit_repo "#{directory}/production"
|
40
|
+
detach_repo "#{directory}/production"
|
41
41
|
|
42
42
|
puts "Created remote project at:"
|
43
43
|
puts
|
data/lib/commands/join.rb
CHANGED
@@ -4,8 +4,8 @@ require 'commands/config'
|
|
4
4
|
module Join extend self
|
5
5
|
|
6
6
|
def run()
|
7
|
-
# --skip-
|
8
|
-
# --skip-
|
7
|
+
# --skip-resources
|
8
|
+
# --skip-production
|
9
9
|
ARGV.each { |x| raise UnknownOption.new(x) if x.start_with?("-") }
|
10
10
|
project_name = ARGV.shift
|
11
11
|
ARGV.each { |x| raise UnknownArgument.new(x) }
|
@@ -30,16 +30,16 @@ module Join extend self
|
|
30
30
|
# If the remote project directory doesn't exists, raise an error.
|
31
31
|
raise CannotFindProject.new(remote_directory) unless File.directory?(remote_directory)
|
32
32
|
|
33
|
-
# Clone the
|
33
|
+
# Clone the resources and production directories.
|
34
34
|
system "git clone -q #{remote_directory} #{local_directory}"
|
35
35
|
system "cd #{local_directory}; git checkout -q master;"
|
36
|
-
system "git clone -q #{remote_directory}/
|
37
|
-
system "cd #{local_directory}/
|
38
|
-
system "git clone -q #{remote_directory}/
|
39
|
-
system "cd #{local_directory}/
|
36
|
+
system "git clone -q #{remote_directory}/resources #{local_directory}/resources"
|
37
|
+
system "cd #{local_directory}/resources; git checkout -q master;"
|
38
|
+
system "git clone -q #{remote_directory}/production #{local_directory}/production"
|
39
|
+
system "cd #{local_directory}/production; git checkout -q master;"
|
40
40
|
|
41
|
-
# Create the user's
|
42
|
-
system "mkdir #{local_directory}/
|
41
|
+
# Create the user's production directory unless it's already there.
|
42
|
+
system "mkdir #{local_directory}/production/#{$settings.short_name}" unless File.directory?("#{local_directory}/production/#{$settings.short_name}")
|
43
43
|
|
44
44
|
puts "Joined the '#{project_name}' project at:"
|
45
45
|
puts
|
data/lib/commands/sync.rb
CHANGED
@@ -3,8 +3,8 @@ require 'enzyme'
|
|
3
3
|
module Sync extend self
|
4
4
|
|
5
5
|
def run
|
6
|
-
|
7
|
-
|
6
|
+
skip_resources = !!ARGV.delete("--skip-resources")
|
7
|
+
skip_production = !!ARGV.delete("--skip-production")
|
8
8
|
ARGV.each { |x| raise UnknownOption.new(x) if x.start_with?("-") }
|
9
9
|
project_name = ARGV.shift || $settings.project_name
|
10
10
|
ARGV.each { |x| raise UnknownArgument.new(x) }
|
@@ -26,11 +26,11 @@ module Sync extend self
|
|
26
26
|
system "git pull > /dev/null"
|
27
27
|
system "git push > /dev/null"
|
28
28
|
|
29
|
-
#
|
29
|
+
# RESOURCES
|
30
30
|
|
31
|
-
unless
|
32
|
-
system "cd #{directory}/
|
33
|
-
Dir.chdir("#{directory}/
|
31
|
+
unless skip_resources
|
32
|
+
system "cd #{directory}/resources"
|
33
|
+
Dir.chdir("#{directory}/resources")
|
34
34
|
|
35
35
|
system "git checkout -q . > /dev/null"
|
36
36
|
system "git add . > /dev/null"
|
@@ -39,10 +39,10 @@ module Sync extend self
|
|
39
39
|
system "git push > /dev/null"
|
40
40
|
end
|
41
41
|
|
42
|
-
#
|
42
|
+
# PRODUCTION
|
43
43
|
|
44
|
-
system "cd #{directory}/
|
45
|
-
Dir.chdir("#{directory}/
|
44
|
+
system "cd #{directory}/production"
|
45
|
+
Dir.chdir("#{directory}/production")
|
46
46
|
|
47
47
|
system "git add #{$settings.short_name} > /dev/null"
|
48
48
|
system "git add -u > /dev/null"
|
@@ -62,7 +62,7 @@ Enzyme.register('sync', Sync) do
|
|
62
62
|
puts ' Options:'
|
63
63
|
puts
|
64
64
|
puts " #{$format.bold}<project_name>#{$format.normal}"
|
65
|
-
puts ' The name of the project to sync. If the
|
65
|
+
puts ' The name of the project to sync. If the production directory is the root of a project this option does not need to be passed.'
|
66
66
|
puts
|
67
67
|
puts "#{$format.bold}EXAMPLES#{$format.normal}"
|
68
68
|
puts ' You can run sync like this:'
|
@@ -72,6 +72,6 @@ Enzyme.register('sync', Sync) do
|
|
72
72
|
puts
|
73
73
|
puts ' cd ~/Projects/my_project'
|
74
74
|
puts ' enzyme sync'
|
75
|
-
puts ' When the
|
75
|
+
puts ' When the production directory is the root of a project you can run sync without any arguments.'
|
76
76
|
puts
|
77
77
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enzyme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta02
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-24 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156181420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2156181420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: shoulda
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156178320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156178320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &2156156060 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2156156060
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &2156138800 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.5.2
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2156138800
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rcov
|
60
|
-
requirement: &
|
60
|
+
requirement: &2156133660 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2156133660
|
69
69
|
description: Enzyme is a tool to make collaborating on projects easier. Developed
|
70
70
|
by Katalyst Interactive.
|
71
71
|
email: haydn@katalyst.com.au
|
@@ -106,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
segments:
|
108
108
|
- 0
|
109
|
-
hash: -
|
109
|
+
hash: -3209188080824928551
|
110
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
111
|
none: false
|
112
112
|
requirements:
|