nasty 0.0.1 → 0.0.1386739802

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: f035920a1320e2ec42238fb2a6b4dc199255b671
4
- data.tar.gz: d667e30009b38a27959a885fce060072823088a8
3
+ metadata.gz: fc8ede7b185bbcd62125ea21381bef4e9cb2bdd4
4
+ data.tar.gz: 6388b4473b14925b36a0de6f5194c839b7a6816a
5
5
  SHA512:
6
- metadata.gz: 5c4dbc97df20f54684de9409085f66cc71d47818d19896b56df2f0737ebe80241ad22348e6389fdf483ee95d03b28f40574abe90bb866963bacd14acd6f8a760
7
- data.tar.gz: 4a867af41290951c9b2ddbbd901e005fbf3ab2f9e0b7a3052a5602da84110e0ee6eba586b21664ae09abe64a0cfc25337f75a5f6f1ef5dac1afbdef3cdc7befc
6
+ metadata.gz: 56a7e23883c084dca2ff130a65aa1a7c812d367a0e063db3ca6bcb159c953315642e666e2819bcfbe316d748b6a4cbdc458ff8281626dc70e9a9e9cda8b97489
7
+ data.tar.gz: 765ba5824a7b4c2fbfd47d44a5e434b72708d6553b18ff82a93603295b749a1fd62390674c06c4cf994eea957af33d6a322ad647a305033a4d10afb7cc79fe79
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Rakefile CHANGED
@@ -1 +1,20 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ task :default => :spec
4
+
5
+ task :spec do
6
+ system 'rspec'
7
+ end
8
+
9
+ task :clean do
10
+ system 'rm *.gem'
11
+ system 'rm -fr pkg'
12
+ end
13
+
14
+ task :build => :clean do
15
+ system 'gem build *.gemspec'
16
+ end
17
+
18
+ task :publish => :build do
19
+ system 'gem push *.gem'
20
+ end
data/lib/nasty.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require "nasty/command"
2
+ require "nasty/composite_command"
1
3
  require "nasty/version"
2
4
 
3
5
  module Nasty
@@ -0,0 +1,7 @@
1
+ module Nasty
2
+ module Command
3
+ def then(next_command)
4
+ CompositeCommand.new(self, next_command)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ module Nasty
2
+ class CompositeCommand
3
+ def initialize(first, last)
4
+ @first = first
5
+ @last = last
6
+ end
7
+
8
+ def run(*args)
9
+ @first.run(*args)
10
+ @last.run(*args)
11
+ end
12
+ end
13
+ end
data/lib/nasty/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nasty
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.#{Time.now.utc.to_i}"
3
3
  end
data/nasty.gemspec CHANGED
@@ -10,14 +10,17 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["mo@mokhan.ca"]
11
11
  spec.description = %q{something nasty to add to your ruby}
12
12
  spec.summary = %q{basicly it's a commons library}
13
- spec.homepage = ""
13
+ spec.homepage = "http://github.com/mokhan/nasty"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
+ spec.required_ruby_version = '>= 2.0.0'
20
21
 
21
22
  spec.add_development_dependency "bundler", "~> 1.3"
22
23
  spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "simplecov"
23
26
  end
@@ -0,0 +1,3 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+ require 'nasty'
@@ -0,0 +1,47 @@
1
+ require "spec_helper"
2
+
3
+ module Nasty
4
+ describe Command do
5
+ class SimpleCommand
6
+ include Command
7
+ def run; @ran = true; end
8
+ def ran?; @ran; end
9
+ end
10
+
11
+ class ComplexCommand < SimpleCommand
12
+ attr_accessor :arguments
13
+
14
+ def run(*args)
15
+ super()
16
+ self.arguments = args
17
+ end
18
+ end
19
+
20
+ context "without parameters" do
21
+ let(:first_command) { SimpleCommand.new }
22
+ let(:second_command) { SimpleCommand.new }
23
+
24
+ it "chains two commands together" do
25
+ result = first_command.then(second_command)
26
+ result.run
27
+ first_command.ran?.should be_true
28
+ second_command.ran?.should be_true
29
+ end
30
+ end
31
+
32
+ context "with parameters" do
33
+ let(:first_command) { ComplexCommand.new }
34
+ let(:second_command) { ComplexCommand.new }
35
+
36
+ it "forwards the input to each command" do
37
+ result = first_command.then(second_command)
38
+ result.run("hello world", 29)
39
+ first_command.ran?.should be_true
40
+ first_command.arguments.should include("hello world")
41
+ first_command.arguments.should include(29)
42
+ second_command.arguments.should include("hello world")
43
+ second_command.arguments.should include(29)
44
+ end
45
+ end
46
+ end
47
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nasty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.1386739802
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
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: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: something nasty to add to your ruby
42
70
  email:
43
71
  - mo@mokhan.ca
@@ -46,14 +74,19 @@ extensions: []
46
74
  extra_rdoc_files: []
47
75
  files:
48
76
  - .gitignore
77
+ - .travis.yml
49
78
  - Gemfile
50
79
  - LICENSE.txt
51
80
  - README.md
52
81
  - Rakefile
53
82
  - lib/nasty.rb
83
+ - lib/nasty/command.rb
84
+ - lib/nasty/composite_command.rb
54
85
  - lib/nasty/version.rb
55
86
  - nasty.gemspec
56
- homepage: ''
87
+ - spec/spec_helper.rb
88
+ - spec/unit/command_spec.rb
89
+ homepage: http://github.com/mokhan/nasty
57
90
  licenses:
58
91
  - MIT
59
92
  metadata: {}
@@ -65,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
98
  requirements:
66
99
  - - '>='
67
100
  - !ruby/object:Gem::Version
68
- version: '0'
101
+ version: 2.0.0
69
102
  required_rubygems_version: !ruby/object:Gem::Requirement
70
103
  requirements:
71
104
  - - '>='
@@ -77,4 +110,6 @@ rubygems_version: 2.1.11
77
110
  signing_key:
78
111
  specification_version: 4
79
112
  summary: basicly it's a commons library
80
- test_files: []
113
+ test_files:
114
+ - spec/spec_helper.rb
115
+ - spec/unit/command_spec.rb