dev_commands 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/lib/add.rb +9 -0
- data/lib/array.rb +4 -0
- data/lib/build.rb +7 -0
- data/lib/command.rb +1 -0
- data/lib/commands.rb +26 -0
- data/lib/commit.rb +7 -0
- data/lib/dev_commands.rb +4 -0
- data/lib/doc.rb +5 -0
- data/lib/gemspec.rb +36 -0
- data/lib/git.rb +9 -0
- data/lib/hash.rb +2 -0
- data/lib/publish.rb +7 -0
- data/lib/push.rb +7 -0
- data/lib/setup.rb +5 -0
- data/lib/test.rb +5 -0
- data/spec/commands_spec.rb +7 -0
- metadata +13 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc46c831f6d378f8e4f8636404710d3145bd6fc8
|
4
|
+
data.tar.gz: 7e16338ba218e784ca7f2f530b0e76fc295e1817
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf0334fabafa3815a761b7f945b21e6344d38dfa29a0530c6e7a94e7c58763e34e480a8b009da064f621941211e4fd92335b23fe72b9f3183501663f2a7c5dc2
|
7
|
+
data.tar.gz: b3cf64cfaee150f851c0c17332c82f452c37a55389255a9a0806050a8665a6d34386afbe112bfdda57b420069bd4b344c0800af75e25a3e60cea154c10ded389
|
data/README.md
CHANGED
@@ -26,6 +26,29 @@ This is an example of a simple usage
|
|
26
26
|
# output": ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
|
27
27
|
```
|
28
28
|
|
29
|
+
Using commands in an array
|
30
|
+
|
31
|
+
```
|
32
|
+
commands=['ruby -version','git --version']
|
33
|
+
commands.execute
|
34
|
+
```
|
35
|
+
|
36
|
+
Using commands in a hash
|
37
|
+
|
38
|
+
```
|
39
|
+
commands=
|
40
|
+
{
|
41
|
+
build: ['gem build dev_commands.gemspec'],
|
42
|
+
test: ['rspec'],
|
43
|
+
doc: ['yard doc - LICENSE'],
|
44
|
+
add: ['git add --all'],
|
45
|
+
commit: ["git commit -m'commit all'"],
|
46
|
+
|
47
|
+
}
|
48
|
+
commands.execute
|
49
|
+
|
50
|
+
```
|
51
|
+
|
29
52
|
### License
|
30
53
|
Copyright 2014-2015 Lou Parslow
|
31
54
|
|
data/lib/add.rb
ADDED
data/lib/array.rb
CHANGED
data/lib/build.rb
ADDED
data/lib/command.rb
CHANGED
data/lib/commands.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative('hash.rb')
|
2
|
+
require_relative('setup.rb')
|
3
|
+
require_relative('build.rb')
|
4
|
+
require_relative('test.rb')
|
5
|
+
require_relative('publish.rb')
|
6
|
+
require_relative('doc.rb')
|
7
|
+
require_relative('add.rb')
|
8
|
+
require_relative('commit.rb')
|
9
|
+
require_relative('push.rb')
|
10
|
+
|
11
|
+
class Commands < Hash
|
12
|
+
|
13
|
+
def initialize directory=Dir.pwd
|
14
|
+
Dir.chdir(directory) do
|
15
|
+
self[:setup]=Setup.new
|
16
|
+
self[:build]=Build.new
|
17
|
+
self[:test]=Test.new
|
18
|
+
self[:publish]=Publish.new
|
19
|
+
self[:doc]=Doc.new
|
20
|
+
self[:add]=Add.new
|
21
|
+
self[:commit]=Commit.new
|
22
|
+
self[:push]=Push.new
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/lib/commit.rb
ADDED
data/lib/dev_commands.rb
CHANGED
data/lib/doc.rb
ADDED
data/lib/gemspec.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
class Gemspec
|
2
|
+
def self.update gemspec_file
|
3
|
+
Text.replace_in_file gemspec_file,
|
4
|
+
/('\d{4}-\d{2}-\d{2}')/,
|
5
|
+
"'#{Time.now.strftime('%Y-%m-%d')}'"
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.gemfile gemspec_file
|
9
|
+
spec=Gem::Specification.load(gemspec_file)
|
10
|
+
return "#{spec.name}-#{spec.version}.gem"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.version gemspec_file
|
14
|
+
spec=Gem::Specification.load(gemspec_file)
|
15
|
+
return spec.version.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.published_version gemspec_file
|
19
|
+
published_version=''
|
20
|
+
spec=Gem::Specification.load(gemspec_file)
|
21
|
+
begin
|
22
|
+
published_version = `gem list #{spec.name} -r`.scan(/\((\d+.\d+.\d+)\)/)[0][0]
|
23
|
+
rescue
|
24
|
+
published_version=''
|
25
|
+
end
|
26
|
+
published_version
|
27
|
+
end
|
28
|
+
def self.published? gemspec_file
|
29
|
+
published_version(gemspec_file)==version(gemspec_file) ? true : false
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.normalize gemspec_file
|
33
|
+
spec=Gem::Specification.load(gemspec_file)
|
34
|
+
File.open(gemspec_file,'w'){|f|f.write(spec.to_ruby)}
|
35
|
+
end
|
36
|
+
end
|
data/lib/git.rb
ADDED
data/lib/hash.rb
CHANGED
data/lib/publish.rb
ADDED
data/lib/push.rb
ADDED
data/lib/test.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dev_commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lou Parslow
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: json
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +38,6 @@ dependencies:
|
|
52
38
|
- - '>='
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
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'
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
42
|
name: rspec
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,13 +72,25 @@ executables: []
|
|
100
72
|
extensions: []
|
101
73
|
extra_rdoc_files: []
|
102
74
|
files:
|
75
|
+
- lib/add.rb
|
103
76
|
- lib/array.rb
|
77
|
+
- lib/build.rb
|
104
78
|
- lib/command.rb
|
79
|
+
- lib/commands.rb
|
80
|
+
- lib/commit.rb
|
105
81
|
- lib/dev_commands.rb
|
82
|
+
- lib/doc.rb
|
83
|
+
- lib/gemspec.rb
|
84
|
+
- lib/git.rb
|
106
85
|
- lib/hash.rb
|
86
|
+
- lib/publish.rb
|
87
|
+
- lib/push.rb
|
88
|
+
- lib/setup.rb
|
89
|
+
- lib/test.rb
|
107
90
|
- lib/text.rb
|
108
91
|
- lib/timer.rb
|
109
92
|
- spec/command_spec.rb
|
93
|
+
- spec/commands_spec.rb
|
110
94
|
- LICENSE
|
111
95
|
- README.md
|
112
96
|
homepage: http://github.com/lou-parslow/dev_commands.gem
|