contracto 0.0.2 → 0.0.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 +4 -4
- data/contracto.gemspec +0 -2
- data/lib/contracto.rb +8 -0
- data/lib/contracto/command.rb +2 -15
- data/lib/contracto/installer.rb +13 -0
- data/lib/contracto/installer/local.rb +36 -0
- data/lib/contracto/runner.rb +8 -0
- data/lib/contracto/version.rb +1 -1
- metadata +4 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d65346ee353e34523514f7156977572115fdb8a8
|
4
|
+
data.tar.gz: c6d33b032c54bacc6ba750e7be59ac3b29d3f510
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28fd28115eb79b3dd7dc8ca5e78d0af2de5458129319b6724b7e9e7559983e979c691d797bf0dc80c6c625e97cbdb623ce6997af242747177aed35e6ef655642
|
7
|
+
data.tar.gz: 904be7893b66393eabb037a6d92cf82672cc1ede82cc1c60e3e5583a652b7e571a49e9b5a1e16eb941724f31e597bfbcdb04d11b25efbd5e033424eda93c5bcb
|
data/contracto.gemspec
CHANGED
@@ -18,8 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'sinatra', '~> 1.4'
|
22
|
-
|
23
21
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
23
|
end
|
data/lib/contracto.rb
CHANGED
@@ -1,4 +1,12 @@
|
|
1
1
|
require "contracto/version"
|
2
2
|
|
3
3
|
module Contracto
|
4
|
+
GEM_DIR = Gem::Specification.find_by_name('contracto').gem_dir
|
5
|
+
CONTRACTO_DIR = 'contracto'
|
6
|
+
CONTRACTO_TMP_DIR = '.tmp.contracto'
|
7
|
+
RUBY_SERVER_DIR = "#{GEM_DIR}/lib/contracto/server/ruby"
|
8
|
+
CONTRACT_FILENAME = 'contract.cdc.rb'
|
9
|
+
|
10
|
+
require 'contracto/installer'
|
11
|
+
require 'contracto/runner'
|
4
12
|
end
|
data/lib/contracto/command.rb
CHANGED
@@ -1,26 +1,13 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
1
|
class Contracto::Command
|
4
2
|
class << self
|
5
3
|
|
6
4
|
def run(command, args)
|
7
5
|
case command
|
8
6
|
when 'install'
|
9
|
-
|
10
|
-
FileUtils.cp_r "#{gem_dir}/lib/contracto/server/ruby", 'contracto_'
|
11
|
-
FileUtils.mv 'contracto_', 'contracto'
|
12
|
-
unless File.exist? 'contract.cdc.rb'
|
13
|
-
FileUtils.mv 'contracto/contract.cdc.rb', '.'
|
14
|
-
puts 'created: contract.cdc.rb'
|
15
|
-
end
|
16
|
-
|
7
|
+
Contracto::Installer.new(args).execute
|
17
8
|
when 'run'
|
18
|
-
|
9
|
+
Contracto::Runner.new(args).execute
|
19
10
|
end
|
20
11
|
end
|
21
|
-
|
22
|
-
def gem_dir
|
23
|
-
@gem_dir ||= Gem::Specification.find_by_name('contracto').gem_dir
|
24
|
-
end
|
25
12
|
end
|
26
13
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
class Contracto::Installer::Local
|
4
|
+
|
5
|
+
def execute
|
6
|
+
remove_old_dir
|
7
|
+
cp_server_files
|
8
|
+
create_contract unless contract_already_exists?
|
9
|
+
rescue
|
10
|
+
revert
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def remove_old_dir
|
16
|
+
FileUtils.rm_rf Contracto::CONTRACTO_DIR
|
17
|
+
end
|
18
|
+
|
19
|
+
def cp_server_files
|
20
|
+
FileUtils.cp_r Contracto::RUBY_SERVER_DIR, Contracto::CONTRACTO_TMP_DIR
|
21
|
+
FileUtils.mv Contracto::CONTRACTO_TMP_DIR, Contracto::CONTRACTO_DIR
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_contract
|
25
|
+
FileUtils.mv "#{Contracto::CONTRACTO_DIR}/#{Contracto::CONTRACT_FILENAME}", FileUtils.pwd
|
26
|
+
puts "created: #{installer.CONTRACT_FILENAME}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def contract_already_exists?
|
30
|
+
File.exist? Contracto::CONTRACT_FILENAME
|
31
|
+
end
|
32
|
+
|
33
|
+
def revert
|
34
|
+
# TODO: implement
|
35
|
+
end
|
36
|
+
end
|
data/lib/contracto/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contracto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kacper Walanus
|
@@ -10,20 +10,6 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2015-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: sinatra
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.4'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.4'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,6 +55,9 @@ files:
|
|
69
55
|
- contracto.gemspec
|
70
56
|
- lib/contracto.rb
|
71
57
|
- lib/contracto/command.rb
|
58
|
+
- lib/contracto/installer.rb
|
59
|
+
- lib/contracto/installer/local.rb
|
60
|
+
- lib/contracto/runner.rb
|
72
61
|
- lib/contracto/server/ruby/config.ru
|
73
62
|
- lib/contracto/server/ruby/contract.cdc.rb
|
74
63
|
- lib/contracto/server/ruby/server.rb
|