zio 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a4db5f02cc89e272c47f92ed989bd5022c35d0b0
4
+ data.tar.gz: 0ad2c4f329303b13f0fa91ea8f5d94bad7e62fbb
5
+ SHA512:
6
+ metadata.gz: 36d18b74216ee9d0e74084f4017d1b8daf0296b053287fdbd4d8adbabe973674e81b02974fb2dc99319c865c4534c74c1c06aeeeda7d618f4ae07d1a412ba122
7
+ data.tar.gz: 7826856fc69910ce3cfea1309396c74eafb63ef5f816a40a24faed9b79751763bce53daf519a84d2969eaaf705e4ed3f024b52eb519be864e63bf73d1e821cb4
@@ -0,0 +1 @@
1
+ # Created by .ignore support plugin (hsz.mobi)
@@ -0,0 +1 @@
1
+ 2.1.2
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,113 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ zio (0.0.1)
5
+ celluloid
6
+ gli (= 2.13.1)
7
+ rainbow
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ aruba (0.9.0)
13
+ childprocess (~> 0.5.6)
14
+ contracts (~> 0.9)
15
+ cucumber (>= 1.3.19)
16
+ ffi (~> 1.9.10)
17
+ rspec-expectations (>= 2.99)
18
+ thor (~> 0.19)
19
+ builder (3.2.2)
20
+ celluloid (0.17.1.2)
21
+ bundler
22
+ celluloid-essentials
23
+ celluloid-extras
24
+ celluloid-fsm
25
+ celluloid-pool
26
+ celluloid-supervision
27
+ dotenv
28
+ nenv
29
+ rspec-logsplit (>= 0.1.2)
30
+ timers (>= 4.1.1)
31
+ celluloid-essentials (0.20.2.1)
32
+ bundler
33
+ dotenv
34
+ nenv
35
+ rspec-logsplit (>= 0.1.2)
36
+ timers (>= 4.1.1)
37
+ celluloid-extras (0.20.1)
38
+ bundler
39
+ dotenv
40
+ nenv
41
+ rspec-logsplit (>= 0.1.2)
42
+ timers (>= 4.1.1)
43
+ celluloid-fsm (0.20.1)
44
+ bundler
45
+ dotenv
46
+ nenv
47
+ rspec-logsplit (>= 0.1.2)
48
+ timers (>= 4.1.1)
49
+ celluloid-pool (0.20.1)
50
+ bundler
51
+ dotenv
52
+ nenv
53
+ rspec-logsplit (>= 0.1.2)
54
+ timers (>= 4.1.1)
55
+ celluloid-supervision (0.20.1.1)
56
+ bundler
57
+ dotenv
58
+ nenv
59
+ rspec-logsplit (>= 0.1.2)
60
+ timers (>= 4.1.1)
61
+ childprocess (0.5.6)
62
+ ffi (~> 1.0, >= 1.0.11)
63
+ contracts (0.11.0)
64
+ cucumber (2.0.2)
65
+ builder (>= 2.1.2)
66
+ cucumber-core (~> 1.2.0)
67
+ diff-lcs (>= 1.1.3)
68
+ gherkin (~> 2.12)
69
+ multi_json (>= 1.7.5, < 2.0)
70
+ multi_test (>= 0.1.2)
71
+ cucumber-core (1.2.0)
72
+ gherkin (~> 2.12.0)
73
+ diff-lcs (1.2.5)
74
+ dotenv (2.0.2)
75
+ ffi (1.9.10)
76
+ ffi (1.9.10-java)
77
+ gherkin (2.12.2)
78
+ multi_json (~> 1.3)
79
+ gherkin (2.12.2-java)
80
+ multi_json (~> 1.3)
81
+ gli (2.13.1)
82
+ hitimes (1.2.2)
83
+ hitimes (1.2.2-java)
84
+ json (1.8.3)
85
+ json (1.8.3-java)
86
+ multi_json (1.11.2)
87
+ multi_test (0.1.2)
88
+ nenv (0.2.0)
89
+ rainbow (2.0.0)
90
+ rake (10.4.2)
91
+ rdoc (4.2.0)
92
+ json (~> 1.4)
93
+ rspec-expectations (3.3.1)
94
+ diff-lcs (>= 1.2.0, < 2.0)
95
+ rspec-support (~> 3.3.0)
96
+ rspec-logsplit (0.1.3)
97
+ rspec-support (3.3.0)
98
+ thor (0.19.1)
99
+ timers (4.1.1)
100
+ hitimes
101
+
102
+ PLATFORMS
103
+ java
104
+ ruby
105
+
106
+ DEPENDENCIES
107
+ aruba
108
+ rake
109
+ rdoc
110
+ zio!
111
+
112
+ BUNDLED WITH
113
+ 1.10.6
@@ -0,0 +1,6 @@
1
+ = zio
2
+
3
+ Describe your project here
4
+
5
+ :include:zio.rdoc
6
+
@@ -0,0 +1,44 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+ require 'rubygems/package_task'
4
+ require 'rdoc/task'
5
+ require 'cucumber'
6
+ require 'cucumber/rake/task'
7
+ Rake::RDocTask.new do |rd|
8
+ rd.main = "README.rdoc"
9
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
10
+ rd.title = 'Your application title'
11
+ end
12
+
13
+ spec = eval(File.read('zio.gemspec'))
14
+
15
+ Gem::PackageTask.new(spec) do |pkg|
16
+ end
17
+ CUKE_RESULTS = 'results.html'
18
+ CLEAN << CUKE_RESULTS
19
+ desc 'Run features'
20
+ Cucumber::Rake::Task.new(:features) do |t|
21
+ opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
22
+ opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
23
+ t.cucumber_opts = opts
24
+ t.fork = false
25
+ end
26
+
27
+ desc 'Run features tagged as work-in-progress (@wip)'
28
+ Cucumber::Rake::Task.new('features:wip') do |t|
29
+ tag_opts = ' --tags ~@pending'
30
+ tag_opts = ' --tags @wip'
31
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
32
+ t.fork = false
33
+ end
34
+
35
+ task :cucumber => :features
36
+ task 'cucumber:wip' => 'features:wip'
37
+ task :wip => 'features:wip'
38
+ require 'rake/testtask'
39
+ Rake::TestTask.new do |t|
40
+ t.libs << "test"
41
+ t.test_files = FileList['test/*_test.rb']
42
+ end
43
+
44
+ task :default => [:test,:features]
data/bin/zio ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gli'
3
+ require 'zio/up'
4
+
5
+ begin # XXX: Remove this begin/rescue before distributing your app
6
+ require 'zio'
7
+ rescue LoadError
8
+ STDERR.puts 'In development, you need to use `bundle exec bin/zio` to run your app'
9
+ STDERR.puts 'At install-time, RubyGems will make sure lib, etc. are in the load path'
10
+ STDERR.puts 'Feel free to remove this message from bin/zio now'
11
+ exit 64
12
+ end
13
+
14
+ include GLI::App
15
+
16
+ program_desc 'Describe your application here'
17
+
18
+ version Zio::VERSION
19
+
20
+ subcommand_option_handling :normal
21
+ arguments :strict
22
+
23
+ # desc 'Describe some switch here'
24
+ # switch [:s,:switch]
25
+ #
26
+ # desc 'Describe some flag here'
27
+ # default_value 'the default'
28
+ # arg_name 'The name of the argument'
29
+ # flag [:f,:flagname]
30
+
31
+ desc 'Run stash and git pull --rebase on git repos'
32
+ command :up do |c|
33
+ c.desc 'Dir path'
34
+ c.default_value File.expand_path('~/')
35
+ c.flag :d
36
+
37
+ c.desc 'Dirs set'
38
+ c.flag :s
39
+
40
+ dirsets = YAML.load_file(File.join(ENV['HOME'],'.zio.rc.yml'))[:dirsets]
41
+
42
+ c.action do |_global_options, options, _args|
43
+ logger = Zio::UpLogger.new
44
+ opts = { dir: options[:d] }
45
+ opts[:set] = dirsets[options[:s]] if options[:s]
46
+ Zio::Up.new(opts).up
47
+ logger.print
48
+ end
49
+
50
+ end
51
+
52
+ desc 'Describe checkout here'
53
+ arg_name 'Describe arguments to checkout here'
54
+ command :checkout do |c|
55
+ c.action do |_global_options, _options, _args|
56
+ puts 'checkout command ran'
57
+ end
58
+ end
59
+
60
+ pre do |_global, _command, _options, _args|
61
+ # Pre logic here
62
+ # Return true to proceed; false to abort and not call the
63
+ # chosen command
64
+ # Use skips_pre before a command to skip this block
65
+ # on that command only
66
+ true
67
+ end
68
+
69
+ post do |_global, _command, _options, _args|
70
+ # Post logic here
71
+ # Use skips_post before a command to skip this
72
+ # block on that command only
73
+ end
74
+
75
+ on_error do |_exception|
76
+ # Error logic here
77
+ # return false to skip default error handling
78
+ true
79
+ end
80
+
81
+ exit run(ARGV)
@@ -0,0 +1,6 @@
1
+ When /^I get help for "([^"]*)"$/ do |app_name|
2
+ @app_name = app_name
3
+ step %(I run `#{app_name} help`)
4
+ end
5
+
6
+ # Add more step definitions here
@@ -0,0 +1,15 @@
1
+ require 'aruba/cucumber'
2
+
3
+ ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
4
+ LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
5
+
6
+ Before do
7
+ # Using "announce" causes massive warnings on 1.9.2
8
+ @puts = true
9
+ @original_rubylib = ENV['RUBYLIB']
10
+ ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
11
+ end
12
+
13
+ After do
14
+ ENV['RUBYLIB'] = @original_rubylib
15
+ end
@@ -0,0 +1,8 @@
1
+ Feature: My bootstrapped app kinda works
2
+ In order to get going on coding my awesome app
3
+ I want to have aruba and cucumber setup
4
+ So I don't have to do it myself
5
+
6
+ Scenario: App just runs
7
+ When I get help for "zio"
8
+ Then the exit status should be 0
@@ -0,0 +1,5 @@
1
+ require 'zio/version'
2
+ require 'zio/exceptions'
3
+
4
+ # Add requires for other files you add to your project here, so
5
+ # you just need to require this one file in your bin file
@@ -0,0 +1,3 @@
1
+ module Zio
2
+ MISSING_ARGUMENTS = Class.new(StandardError)
3
+ end
@@ -0,0 +1,83 @@
1
+ require 'celluloid/current'
2
+ require 'open3'
3
+ require 'rainbow/ext/string'
4
+
5
+ module Zio
6
+ class UpLogger
7
+ include Celluloid
8
+ include Celluloid::Notifications
9
+ attr_accessor :out, :paths
10
+
11
+ def initialize
12
+ subscribe 'up_paths', :set_paths
13
+ subscribe 'up_capture_complete', :new_data
14
+ @out = []
15
+ @paths = [1]
16
+ end
17
+
18
+ def new_data(_topic, data)
19
+ @out << data
20
+ end
21
+
22
+ def set_paths(_topic, data)
23
+ @paths.concat(data)
24
+ end
25
+
26
+ def print
27
+ while paths.size > 0 do
28
+ if out.empty?
29
+ sleep 2
30
+ next
31
+ end
32
+ data = out.shift
33
+ path, stdout, stderr, status = *data
34
+ dirname = path.split('/').last
35
+ puts sprintf("\nProcessing - #{dirname}").color(:green)
36
+ puts sprintf('---------------------------').color(:green)
37
+ if status.exitstatus == 0
38
+ puts sprintf('[%s] - %s', dirname, stdout).color(:blue)
39
+ else
40
+ STDERR.puts stderr.color(:red)
41
+ end
42
+ paths.delete(path)
43
+ paths.delete(1) if paths.size == 1 && paths[0] == 1
44
+ end
45
+ end
46
+ end
47
+
48
+ class Up
49
+ attr_accessor :options
50
+ include Celluloid
51
+ include Celluloid::Notifications
52
+
53
+ # Celluloid.logger = nil
54
+
55
+ def initialize(options={})
56
+ @options = options
57
+ raise MISSING_ARGUMENTS unless options[:dir] || options[:set]
58
+ end
59
+
60
+ def up
61
+ publish 'up_paths', _paths
62
+ _paths.each do |path|
63
+ self.class.new(options).async.pull(path)
64
+ end
65
+ end
66
+
67
+ def pull(path)
68
+ stdout, stderr, status = Open3.capture3("cd #{path} && git stash && git checkout master && git pull --rebase")
69
+ publish 'up_capture_complete', [path, stdout, stderr, status]
70
+ end
71
+
72
+ def _paths
73
+ return options[:set] unless options[:set].nil?
74
+ @_paths ||= begin
75
+ Dir.foreach(options[:dir]).map do |path|
76
+ next if path == '.' || path == '..' || !File.exists?(File.expand_path(path, options[:dir]) + '/.git')
77
+ ab_path = File.expand_path(path, options[:dir])
78
+ File.directory?(ab_path) ? ab_path : nil
79
+ end.compact
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,3 @@
1
+ module Zio
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,14 @@
1
+ require 'test_helper'
2
+
3
+ class DefaultTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def teardown
9
+ end
10
+
11
+ def test_the_truth
12
+ assert true
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ require 'test/unit'
2
+
3
+ # Add test libraries you want to use here, e.g. mocha
4
+
5
+ class Test::Unit::TestCase
6
+
7
+ # Add global extensions to the test case class here
8
+
9
+ end
@@ -0,0 +1,25 @@
1
+ # Ensure we require the local version and not one we might have installed already
2
+ require File.join([File.dirname(__FILE__),'lib','zio','version.rb'])
3
+ spec = Gem::Specification.new do |s|
4
+ s.name = 'zio'
5
+ s.version = Zio::VERSION
6
+ s.author = 'Your Name Here'
7
+ s.email = 'your@email.address.com'
8
+ s.homepage = 'http://your.website.com'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.summary = 'A description of your project'
11
+ s.files = `git ls-files`.split("
12
+ ")
13
+ s.require_paths << 'lib'
14
+ s.has_rdoc = true
15
+ s.extra_rdoc_files = ['README.rdoc','zio.rdoc']
16
+ s.rdoc_options << '--title' << 'zio' << '--main' << 'README.rdoc' << '-ri'
17
+ s.bindir = 'bin'
18
+ s.executables << 'zio'
19
+ s.add_development_dependency('rake')
20
+ s.add_development_dependency('rdoc')
21
+ s.add_development_dependency('aruba')
22
+ s.add_runtime_dependency('gli','2.13.1')
23
+ s.add_runtime_dependency('celluloid')
24
+ s.add_runtime_dependency('rainbow')
25
+ end
@@ -0,0 +1,5 @@
1
+ = zio
2
+
3
+ Generate this with
4
+ zio rdoc
5
+ After you have described your command line interface
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zio
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Your Name Here
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: aruba
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: gli
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.13.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.13.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: celluloid
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rainbow
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email: your@email.address.com
99
+ executables:
100
+ - zio
101
+ extensions: []
102
+ extra_rdoc_files:
103
+ - README.rdoc
104
+ - zio.rdoc
105
+ files:
106
+ - ".gitignore"
107
+ - ".ruby-version"
108
+ - Gemfile
109
+ - Gemfile.lock
110
+ - README.rdoc
111
+ - Rakefile
112
+ - bin/zio
113
+ - features/step_definitions/zio_steps.rb
114
+ - features/support/env.rb
115
+ - features/zio.feature
116
+ - lib/zio.rb
117
+ - lib/zio/exceptions.rb
118
+ - lib/zio/up.rb
119
+ - lib/zio/version.rb
120
+ - test/default_test.rb
121
+ - test/test_helper.rb
122
+ - zio.gemspec
123
+ - zio.rdoc
124
+ homepage: http://your.website.com
125
+ licenses: []
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options:
129
+ - "--title"
130
+ - zio
131
+ - "--main"
132
+ - README.rdoc
133
+ - "-ri"
134
+ require_paths:
135
+ - lib
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.2.2
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: A description of your project
153
+ test_files: []
154
+ has_rdoc: true