sweatshop_gears 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 448c3c917aedf3ea48cea05f90de4007d5f5f96d
4
- data.tar.gz: a99624061b1511eaeed4cc0b0102bd69af3c74c2
3
+ metadata.gz: ec1658e35ceb4fdbb0d685556ca88295e9208b80
4
+ data.tar.gz: 4590751c9868f8f5a07cc2fe5f67bbf774128fa4
5
5
  SHA512:
6
- metadata.gz: 4e11957930ea0dc7d77cc9e34bba6cfd81338a9eeb133eb2c733fe203c07f5c249aafe3fd600ef2b10369e1b15aea9195ba3cebe9346300c103c98d774576442
7
- data.tar.gz: b062a744d236c815a0404b3a60c8748c8f896d6ee4558f42027bcc35c7f6a3be132654ba0f259bf47edab782a21da27b8b2cb694474e66346a428c72470c96bc
6
+ metadata.gz: c173f6f391b05e44e52004def9774b23caf2d839466de65ef8c83bc49bf7c6a86afe75cff8309d92f0b6647265408e4699a53e3042b6ddbf0f58fe84bc806148
7
+ data.tar.gz: 1ec9db87baf3c994e5109599ecd7d7ff18c9f51b33b7f9198530918d5e6d29ea7932a2eec15fda9e0082b2f17605182e2af6ad50ec7fd7558d813a08d5317462
data/.rubocop.yml CHANGED
@@ -7,7 +7,7 @@ Style/Encoding:
7
7
  Enabled: false
8
8
 
9
9
  Metrics/LineLength:
10
- Max: 80
10
+ Max: 90
11
11
 
12
12
  Style/FileName:
13
13
  Enabled: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- robot_sweatshop-gears (0.0.1)
4
+ sweatshop_gears (1.0.1)
5
5
  bundler
6
6
  commander
7
7
  contracts
@@ -104,8 +104,8 @@ PLATFORMS
104
104
  DEPENDENCIES
105
105
  rake
106
106
  riot
107
- robot_sweatshop-gears!
108
107
  simplecov
108
+ sweatshop_gears!
109
109
 
110
110
  BUNDLED WITH
111
111
  1.10.2
data/README.md CHANGED
@@ -6,5 +6,6 @@ Package management for [Robot Sweatshop](https://github.com/JScott/robot_sweatsh
6
6
 
7
7
  ## Future
8
8
 
9
+ - Figure out something sane for finding ports for services
9
10
  - More metadata (author, description)
10
11
  - Source from custom repo
data/Rakefile CHANGED
@@ -3,21 +3,21 @@ require 'rake'
3
3
  task :test do
4
4
  `sweatshop stop`
5
5
  $stdout.sync = true
6
- puts "sweatshop-gears"
7
- IO.popen "bats #{__dir__}/test --pretty" do |file|
8
- until file.eof?
9
- puts file.gets
6
+ puts 'sweatshop-gears'
7
+ IO.popen "bats #{__dir__}/test --pretty" do |io_stream|
8
+ while line = io_stream.gets
9
+ puts line
10
10
  end
11
11
  end
12
12
  end
13
13
 
14
14
  task :build do
15
15
  print 'Building and installing local gem..'
16
- `gem build sweatshop-gears.gemspec --force`
16
+ `gem build sweatshop_gears.gemspec --force`
17
17
  print '.'
18
- `gem install robot_sweatshop-gears-*.gem`
18
+ `gem install sweatshop_gears-*.gem`
19
19
  puts 'Done.'
20
20
  end
21
21
 
22
- task :default => :test
23
- task :test => :build
22
+ task default: :test
23
+ task test: :build
data/bin/sweatshop-gears CHANGED
@@ -4,7 +4,7 @@ require 'commander/import'
4
4
  require 'robot_sweatshop/gears'
5
5
 
6
6
  program :name, 'Sweatshop Gears'
7
- program :version, '1.0.1'
7
+ program :version, '1.0.2'
8
8
  program :description, 'Package management for Robot Sweatshop'
9
9
  program :help, 'Author', 'Justin Scott <jvscott@gmail.com>'
10
10
 
@@ -14,9 +14,10 @@ command :init do |c|
14
14
  c.syntax = 'sweatshop-gears init'
15
15
  c.description = 'Makes the Gears packages available to Robot Sweatshop'
16
16
  c.option '--path STRING', String, 'The working path for downloading packages'
17
- c.action do |args, options|
18
- options.default :path => '/opt/gears'
17
+ c.action do |_args, options|
18
+ options.default path: '/opt/gears'
19
19
  Gears.download to_path: options.path
20
+ Gears.create_runtime_paths
20
21
  Gears::Dependencies.install from_path: options.path
21
22
  Gears::Binaries.expose from_path: options.path
22
23
  Gears::Services.load from_path: options.path
@@ -1,6 +1,7 @@
1
1
  require 'git'
2
2
  require 'yaml'
3
3
 
4
+ # Provides information and downloading of Gears packages
4
5
  module Gears
5
6
  def self.clone_packages(path)
6
7
  Git.clone git_repo, File.basename(path), path: File.dirname(path)
@@ -16,12 +17,19 @@ module Gears
16
17
  Announce.success 'Packages downloaded'
17
18
  end
18
19
 
19
- def self.packages(path)
20
- paths = Dir["#{path}/*"].select { |path| File.directory? path }
20
+ def self.packages(gears_path)
21
+ paths = Dir["#{gears_path}/*"].select { |path| File.directory? path }
21
22
  paths.map { |path| File.expand_path path }
22
23
  end
23
24
 
24
- def self.metadata(path)
25
- YAML.load File.read("#{path}/metadata.yaml")
25
+ def self.metadata(package_path)
26
+ YAML.load File.read("#{package_path}/metadata.yaml")
27
+ end
28
+
29
+ def self.create_runtime_paths
30
+ config_path = File.expand_path '~/.robot_sweatshop/compiled_config.yaml'
31
+ config = YAML.load_file config_path
32
+ FileUtils.mkpath config[:logfile_path]
33
+ FileUtils.mkpath config[:pidfile_path]
26
34
  end
27
35
  end
@@ -2,6 +2,7 @@ require 'fileutils'
2
2
  require 'terminal-announce'
3
3
 
4
4
  module Gears
5
+ # Installs binary Gears packages
5
6
  module Binaries
6
7
  def self.expose(from_path:)
7
8
  Gears.packages(from_path).each do |package|
@@ -27,9 +28,9 @@ module Gears
27
28
  end
28
29
 
29
30
  def self.scripts_path
30
- sweatshop_config = '/tmp/.robot_sweatshop-eye-config.yaml'
31
- Announce.failure 'Please run `sweatshop start` again' unless File.exists? sweatshop_config
32
- config = YAML.load File.read(sweatshop_config)
31
+ config = File.expand_path '~/.robot_sweatshop/compiled_config.yaml'
32
+ Announce.failure 'Please run `sweatshop start` again' unless File.exist? config
33
+ config = YAML.load File.read(config)
33
34
  config[:scripts_path]
34
35
  end
35
36
  end
@@ -2,6 +2,7 @@ require 'terminal-announce'
2
2
  require 'bundler/cli'
3
3
 
4
4
  module Gears
5
+ # Deals with the dependencies from Gears packages
5
6
  module Dependencies
6
7
  def self.install(from_path:)
7
8
  Gears.packages(from_path).each { |path| install_gems path }
@@ -3,6 +3,7 @@ require 'terminal-announce'
3
3
  require 'erubis'
4
4
 
5
5
  module Gears
6
+ # Installs service Gears packages
6
7
  module Services
7
8
  def self.load(from_path:)
8
9
  packages = Gears.packages(from_path).select { |package| contains_service? package }
@@ -1,8 +1,8 @@
1
1
  require 'yaml'
2
2
 
3
3
  # TODO: config not guaranteed to be there. sweatshop has to run first
4
- # TODO: per-user temp file
5
- CONFIG = YAML.load_file '/tmp/.robot_sweatshop-eye-config.yaml'
4
+ CONFIG_PATH = File.expand_path '~/.robot_sweatshop/compiled_config.yaml'
5
+ CONFIG = YAML.load_file CONFIG_PATH
6
6
  PID_PATH = CONFIG[:pidfile_path]
7
7
  LOG_PATH = CONFIG[:logfile_path]
8
8
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'sweatshop_gears'
3
- gem.version = '1.0.1'
3
+ gem.version = '1.0.2'
4
4
  gem.licenses = 'MIT'
5
5
  gem.authors = ['Justin Scott']
6
6
  gem.email = 'jvscott@gmail.com'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sweatshop_gears
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Scott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-05 00:00:00.000000000 Z
11
+ date: 2015-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler