designshell 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/.gitignore +18 -0
  2. data/.idea/.name +1 -0
  3. data/.idea/.rakeTasks +7 -0
  4. data/.idea/codeStyleSettings.xml +13 -0
  5. data/.idea/compiler.xml +25 -0
  6. data/.idea/copyright/profiles_settings.xml +5 -0
  7. data/.idea/encodings.xml +5 -0
  8. data/.idea/misc.xml +11 -0
  9. data/.idea/modules.xml +11 -0
  10. data/.idea/scopes/scope_settings.xml +5 -0
  11. data/.idea/vcs.xml +9 -0
  12. data/Gemfile +2 -0
  13. data/Gemfile.lock +196 -0
  14. data/LICENSE +22 -0
  15. data/README.md +35 -0
  16. data/README.rdoc +6 -0
  17. data/Rakefile +46 -0
  18. data/bin/designshelld.example.sh +5 -0
  19. data/bin/designshelld.example2.sh +3 -0
  20. data/bin/designshellserver +22 -0
  21. data/bin/ds +177 -0
  22. data/designshell.gemspec +40 -0
  23. data/designshell.iml +84 -0
  24. data/designshell.rdoc +5 -0
  25. data/features/designshell.feature +8 -0
  26. data/features/step_definitions/designshell_steps.rb +6 -0
  27. data/features/support/env.rb +15 -0
  28. data/lib/buzzcore_mods.rb +19 -0
  29. data/lib/designshell/context.rb +48 -0
  30. data/lib/designshell/core.rb +78 -0
  31. data/lib/designshell/deploy_plan.rb +40 -0
  32. data/lib/designshell/key_chain.rb +40 -0
  33. data/lib/designshell/repo.rb +112 -0
  34. data/lib/designshell/repo_server.rb +25 -0
  35. data/lib/designshell/site_client.rb +141 -0
  36. data/lib/designshell/utils.rb +18 -0
  37. data/lib/designshell/version.rb +3 -0
  38. data/lib/designshell.rb +19 -0
  39. data/lib/designshellserver/command.rb +180 -0
  40. data/lib/designshellserver/core.rb +41 -0
  41. data/lib/designshellserver.rb +17 -0
  42. data/spec/KeyChain_spec.rb +94 -0
  43. data/spec/RepoServer_spec.rb +54 -0
  44. data/spec/Repo_spec.rb +105 -0
  45. data/spec/build_spec.rb +29 -0
  46. data/spec/client_to_server_spec.rb +111 -0
  47. data/spec/designshell_context_spec.rb +18 -0
  48. data/spec/designshell_core_spec.rb +45 -0
  49. data/spec/rspec_helper.rb +8 -0
  50. data/spec/server/deploy_spec.rb +210 -0
  51. data/spec/server/dummy_spec.rb +52 -0
  52. data/spec/site_client_spec.rb +90 -0
  53. data/test/default_test.rb +14 -0
  54. data/test/test_helper.rb +9 -0
  55. data/testmart.iml +9 -0
  56. metadata +390 -0
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .idea
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.idea/.name ADDED
@@ -0,0 +1 @@
1
+ designshell
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectCodeStyleSettingsManager">
4
+ <option name="PER_PROJECT_SETTINGS">
5
+ <value>
6
+ <XML>
7
+ <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
8
+ </XML>
9
+ </value>
10
+ </option>
11
+ </component>
12
+ </project>
13
+
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="CompilerConfiguration">
4
+ <option name="DEFAULT_COMPILER" value="Javac" />
5
+ <resourceExtensions />
6
+ <wildcardResourcePatterns>
7
+ <entry name="?*.properties" />
8
+ <entry name="?*.xml" />
9
+ <entry name="?*.gif" />
10
+ <entry name="?*.png" />
11
+ <entry name="?*.jpeg" />
12
+ <entry name="?*.jpg" />
13
+ <entry name="?*.html" />
14
+ <entry name="?*.dtd" />
15
+ <entry name="?*.tld" />
16
+ <entry name="?*.ftl" />
17
+ </wildcardResourcePatterns>
18
+ <annotationProcessing>
19
+ <profile default="true" name="Default" enabled="false">
20
+ <processorPath useClasspath="true" />
21
+ </profile>
22
+ </annotationProcessing>
23
+ </component>
24
+ </project>
25
+
@@ -0,0 +1,5 @@
1
+ <component name="CopyrightManager">
2
+ <settings default="">
3
+ <module2copyright />
4
+ </settings>
5
+ </component>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
+ </project>
5
+
data/.idea/misc.xml ADDED
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="IdProvider" IDEtalkID="103CE2DF1B7BFC2B4246041ABE713922" />
4
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="RVM: ruby-1.8.7-p358 [dash]" project-jdk-type="RUBY_SDK">
5
+ <output url="file://$PROJECT_DIR$/out" />
6
+ </component>
7
+ <component name="SvnBranchConfigurationManager">
8
+ <option name="mySupportsUserInfoFilter" value="true" />
9
+ </component>
10
+ </project>
11
+
data/.idea/modules.xml ADDED
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$REPOS$/Buzzware/13/dash-dev/dash-dev.iml" filepath="$REPOS$/Buzzware/13/dash-dev/dash-dev.iml" />
6
+ <module fileurl="file://$PROJECT_DIR$/designshell.iml" filepath="$PROJECT_DIR$/designshell.iml" />
7
+ <module fileurl="file://$PROJECT_DIR$/testmart.iml" filepath="$PROJECT_DIR$/testmart.iml" />
8
+ </modules>
9
+ </component>
10
+ </project>
11
+
@@ -0,0 +1,5 @@
1
+ <component name="DependencyValidationManager">
2
+ <state>
3
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
4
+ </state>
5
+ </component>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ <mapping directory="$REPOS$/Buzzware/13/dash-dev" vcs="svn" />
6
+ <mapping directory="$REPOS$/testmart" vcs="Git" />
7
+ </component>
8
+ </project>
9
+
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,196 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ designshell (0.0.1)
5
+ POpen4
6
+ bitbucket_rest_api
7
+ buzzcore
8
+ git
9
+ gli (= 2.5.0)
10
+ highline
11
+ json
12
+ middleman
13
+ net-ssh
14
+ net_dav
15
+ osx_keychain
16
+ termios
17
+
18
+ GEM
19
+ remote: http://rubygems.org/
20
+ specs:
21
+ POpen4 (0.1.4)
22
+ Platform (>= 0.4.0)
23
+ open4
24
+ Platform (0.4.0)
25
+ RubyInline (3.12.0)
26
+ ZenTest (~> 4.3)
27
+ ZenTest (4.8.3)
28
+ activesupport (3.2.11)
29
+ i18n (~> 0.6)
30
+ multi_json (~> 1.0)
31
+ aruba (0.5.1)
32
+ childprocess (~> 0.3.6)
33
+ cucumber (>= 1.1.1)
34
+ rspec-expectations (>= 2.7.0)
35
+ bitbucket_rest_api (0.1.1)
36
+ faraday (~> 0.8.1)
37
+ faraday_middleware (~> 0.8.1)
38
+ hashie (~> 1.2.0)
39
+ multi_json (~> 1.3)
40
+ nokogiri (~> 1.5.2)
41
+ simple_oauth
42
+ builder (3.1.4)
43
+ buzzcore (0.6.4)
44
+ POpen4
45
+ childprocess (0.3.6)
46
+ ffi (~> 1.0, >= 1.0.6)
47
+ chunky_png (1.2.7)
48
+ coffee-script (2.2.0)
49
+ coffee-script-source
50
+ execjs
51
+ coffee-script-source (1.3.3)
52
+ columnize (0.3.6)
53
+ compass (0.12.2)
54
+ chunky_png (~> 1.2)
55
+ fssm (>= 0.2.7)
56
+ sass (~> 3.1)
57
+ cucumber (1.2.1)
58
+ builder (>= 2.1.2)
59
+ diff-lcs (>= 1.1.3)
60
+ gherkin (~> 2.11.0)
61
+ json (>= 1.4.6)
62
+ diff-lcs (1.1.3)
63
+ execjs (1.4.0)
64
+ multi_json (~> 1.0)
65
+ faraday (0.8.4)
66
+ multipart-post (~> 1.1)
67
+ faraday_middleware (0.8.8)
68
+ faraday (>= 0.7.4, < 0.9)
69
+ ffi (1.3.1)
70
+ fssm (0.2.9)
71
+ gherkin (2.11.5)
72
+ json (>= 1.4.6)
73
+ git (1.2.5)
74
+ gli (2.5.0)
75
+ haml (3.1.7)
76
+ hashie (1.2.0)
77
+ highline (1.6.15)
78
+ hike (1.2.1)
79
+ http_router (0.10.2)
80
+ rack (>= 1.0.0)
81
+ url_mount (~> 0.2.1)
82
+ i18n (0.6.1)
83
+ json (1.7.6)
84
+ linecache (0.46)
85
+ rbx-require-relative (> 0.0.4)
86
+ listen (0.5.3)
87
+ maruku (0.6.1)
88
+ syntax (>= 1.0.0)
89
+ middleman (3.0.9)
90
+ middleman-core (= 3.0.9)
91
+ middleman-more (= 3.0.9)
92
+ middleman-sprockets (~> 3.0.6)
93
+ middleman-core (3.0.9)
94
+ activesupport (~> 3.2.6)
95
+ bundler (~> 1.1)
96
+ listen (~> 0.5.2)
97
+ rack (= 1.4.1)
98
+ rack-test (~> 0.6.1)
99
+ rb-fsevent (~> 0.9.1)
100
+ rb-inotify (~> 0.8.8)
101
+ thor (~> 0.15.4)
102
+ tilt (~> 1.3.1)
103
+ middleman-more (3.0.9)
104
+ coffee-script (~> 2.2.0)
105
+ coffee-script-source (~> 1.3.3)
106
+ compass (>= 0.12.2)
107
+ execjs (~> 1.4.0)
108
+ haml (>= 3.1.6)
109
+ i18n (~> 0.6.0)
110
+ maruku (~> 0.6.0)
111
+ middleman-core (= 3.0.9)
112
+ padrino-helpers (= 0.10.7)
113
+ sass (>= 3.1.20)
114
+ uglifier (~> 1.2.6)
115
+ middleman-sprockets (3.0.6)
116
+ middleman-more (>= 3.0.1)
117
+ sprockets (~> 2.1, < 2.5)
118
+ sprockets-sass (~> 0.9.0)
119
+ multi_json (1.5.0)
120
+ multipart-post (1.1.5)
121
+ net-ssh (2.6.3)
122
+ net_dav (0.5.0)
123
+ nokogiri (>= 1.3.0)
124
+ nokogiri (1.5.6)
125
+ open4 (1.3.0)
126
+ osx_keychain (1.0.0)
127
+ RubyInline (~> 3)
128
+ padrino-core (0.10.7)
129
+ activesupport (~> 3.2.0)
130
+ http_router (~> 0.10.2)
131
+ sinatra (~> 1.3.1)
132
+ thor (~> 0.15.2)
133
+ tilt (~> 1.3.0)
134
+ padrino-helpers (0.10.7)
135
+ i18n (~> 0.6)
136
+ padrino-core (= 0.10.7)
137
+ rack (1.4.1)
138
+ rack-protection (1.3.2)
139
+ rack
140
+ rack-test (0.6.2)
141
+ rack (>= 1.0)
142
+ rake (10.0.3)
143
+ rb-fsevent (0.9.3)
144
+ rb-inotify (0.8.8)
145
+ ffi (>= 0.5.0)
146
+ rbx-require-relative (0.0.9)
147
+ rdoc (3.12)
148
+ json (~> 1.4)
149
+ rspec (2.12.0)
150
+ rspec-core (~> 2.12.0)
151
+ rspec-expectations (~> 2.12.0)
152
+ rspec-mocks (~> 2.12.0)
153
+ rspec-core (2.12.2)
154
+ rspec-expectations (2.12.1)
155
+ diff-lcs (~> 1.1.3)
156
+ rspec-mocks (2.12.1)
157
+ ruby-debug (0.10.4)
158
+ columnize (>= 0.1)
159
+ ruby-debug-base (~> 0.10.4.0)
160
+ ruby-debug-base (0.10.4)
161
+ linecache (>= 0.3)
162
+ sass (3.2.5)
163
+ simple_oauth (0.2.0)
164
+ sinatra (1.3.3)
165
+ rack (~> 1.3, >= 1.3.6)
166
+ rack-protection (~> 1.2)
167
+ tilt (~> 1.3, >= 1.3.3)
168
+ sprockets (2.4.5)
169
+ hike (~> 1.2)
170
+ multi_json (~> 1.0)
171
+ rack (~> 1.0)
172
+ tilt (~> 1.1, != 1.3.0)
173
+ sprockets-sass (0.9.1)
174
+ sprockets (~> 2.0)
175
+ tilt (~> 1.1)
176
+ syntax (1.0.0)
177
+ termios (0.9.4)
178
+ thor (0.15.4)
179
+ tilt (1.3.3)
180
+ uglifier (1.2.7)
181
+ execjs (>= 0.3.0)
182
+ multi_json (~> 1.3)
183
+ url_mount (0.2.1)
184
+ rack
185
+
186
+ PLATFORMS
187
+ ruby
188
+
189
+ DEPENDENCIES
190
+ aruba
191
+ designshell!
192
+ rake
193
+ rdoc
194
+ rspec
195
+ rspec-core
196
+ ruby-debug
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Gary McGhee
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Designshell
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'designshell'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install designshell
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
30
+
31
+
32
+ install designshelld like this in ~/.ssh/authorized_keys2 :
33
+
34
+ command="/home/dashd/designshell/bin/designshelld.example.sh",no-port-forwarding,no-X11-forwarding,no-agent-forwarding ssh-rsa AAAAB3NzaC...
35
+
data/README.rdoc ADDED
@@ -0,0 +1,6 @@
1
+ = designshell
2
+
3
+ Describe your project here
4
+
5
+ :include:designshell.rdoc
6
+
data/Rakefile ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env rake
2
+ require 'rake/clean'
3
+ require 'rubygems'
4
+ require 'rubygems/package_task'
5
+ require "bundler/gem_tasks"
6
+ require 'rdoc/task'
7
+ require 'cucumber'
8
+ require 'cucumber/rake/task'
9
+ Rake::RDocTask.new do |rd|
10
+ rd.main = "README.rdoc"
11
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
12
+ rd.title = 'Your application title'
13
+ end
14
+
15
+ spec = eval(File.read('designshell.gemspec'))
16
+
17
+ Gem::PackageTask.new(spec) do |pkg|
18
+ end
19
+ CUKE_RESULTS = 'results.html'
20
+ CLEAN << CUKE_RESULTS
21
+ desc 'Run features'
22
+ Cucumber::Rake::Task.new(:features) do |t|
23
+ opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
24
+ opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
25
+ t.cucumber_opts = opts
26
+ t.fork = false
27
+ end
28
+
29
+ desc 'Run features tagged as work-in-progress (@wip)'
30
+ Cucumber::Rake::Task.new('features:wip') do |t|
31
+ tag_opts = ' --tags ~@pending'
32
+ tag_opts = ' --tags @wip'
33
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
34
+ t.fork = false
35
+ end
36
+
37
+ task :cucumber => :features
38
+ task 'cucumber:wip' => 'features:wip'
39
+ task :wip => 'features:wip'
40
+ require 'rake/testtask'
41
+ Rake::TestTask.new do |t|
42
+ t.libs << "test"
43
+ t.test_files = FileList['test/*_test.rb']
44
+ end
45
+
46
+ task :default => [:test,:features]
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ source /usr/local/rvm/environments/ruby-1.8.7-p371
3
+ cd /home/dashd/designshell
4
+ bundle exec bin/designshellserver
5
+
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ cd /home/dashd/designshell
3
+ bundle exec bin/designshellserver
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #command = ENV['SSH_ORIGINAL_COMMAND']
4
+ #STDERR.write "user #{user} authorized\n"
5
+
6
+ require "rubygems"
7
+
8
+ require 'designshellserver'
9
+
10
+ #trap("SIGHUP") { abort }
11
+
12
+ context = DesignShell::Context.new({
13
+ :argv=>ARGV.clone,
14
+ :env=>ENV.clone,
15
+ :stdout=>$stdout,
16
+ :stdin=>$stdin,
17
+ :stderr=>$stderr,
18
+ :credentials=>Credentials.new('DesignShellServer')
19
+ })
20
+ core = DesignShellServer::Core.new(context)
21
+ core.run
22
+
data/bin/ds ADDED
@@ -0,0 +1,177 @@
1
+ #!/usr/bin/env ruby
2
+ #begin # XXX: Remove this begin/rescue before distributing your app
3
+ require 'designshell'
4
+ #require 'ruby-debug';debugger
5
+
6
+ if ARGV.length==1 && ARGV[0].index(' ') # fix for intellij
7
+ parts = ARGV[0].split(' ')
8
+ ARGV[0] = parts.shift
9
+ ARGV.insert(-1,*parts)
10
+ end
11
+ #rescue LoadError
12
+ # STDERR.puts "In development, you need to use `bundle exec bin/todo` to run your app"
13
+ # STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
14
+ # STDERR.puts "Feel free to remove this message from bin/ds now"
15
+ # exit 64
16
+ #end
17
+
18
+ HighLine::Question.class_eval do
19
+ alias_method :orig_append_default, :append_default
20
+ def append_default
21
+ orig_append_default
22
+ @question = StringUtils.split3(@question,/\|.*\|/) do |head,match,tail|
23
+ match.sub!('|','(')
24
+ match[match.rindex('|'),1]=')'
25
+ match
26
+ end
27
+ end
28
+ end
29
+
30
+
31
+ include GLI::App
32
+
33
+ program_desc 'Describe your application here'
34
+
35
+ #version DesignShell::VERSION
36
+
37
+ #desc 'Describe some switch here'
38
+ #switch [:s,:switch]
39
+ #
40
+ #desc 'Describe some flag here'
41
+ #default_value 'the default'
42
+ #arg_name 'The name of the argument'
43
+ #flag [:f,:flagname]
44
+
45
+ desc 'configure credentials etc'
46
+ arg_name 'subcommands are: bitbucket'
47
+ command :configure do |configure|
48
+
49
+ configure.desc 'configure bitbucket for managing repositories'
50
+ configure.arg_name 'none'
51
+ configure.command :bitbucket do |bb|
52
+ bb.action do |global_options,options,args|
53
+ context = DesignShell::Context.new(:global_options=>global_options,:options=>options,:argv=>args)
54
+ repo = DesignShell::Repo.new
55
+ keyChain = DesignShell::KeyChain.new
56
+ core = DesignShell::Core.new(
57
+ :context => context,
58
+ :keyChain => keyChain,
59
+ :repo => repo
60
+ )
61
+ # use highline to ask questions here and store in key_chain
62
+ username = ask("User name: ") { |q|
63
+ q.default = "none"
64
+ }
65
+ say username
66
+ end
67
+ end
68
+ end
69
+
70
+
71
+ desc 'Describe push here'
72
+ arg_name 'Describe arguments to push here'
73
+ command :push do |c|
74
+ c.desc 'Describe a switch to push'
75
+ c.switch :s
76
+
77
+ c.desc 'Describe a flag to push'
78
+ c.default_value 'default'
79
+ c.flag :f
80
+ c.action do |global_options,options,args|
81
+
82
+ # Your command logic here
83
+
84
+ # If you have any errors, just raise them
85
+ # raise "that command made no sense"
86
+
87
+ puts "push command ran"
88
+ end
89
+ end
90
+
91
+ desc 'Describe pull here'
92
+ arg_name 'Describe arguments to pull here'
93
+ command :pull do |c|
94
+ c.action do |global_options,options,args|
95
+ puts "pull command ran"
96
+ end
97
+ end
98
+
99
+
100
+ desc 'Describe commit here'
101
+ arg_name 'Describe arguments to commit here'
102
+ command :commit do |c|
103
+ c.action do |*args|
104
+ context = DesignShell::Context.new(:argv=>args)
105
+ ds = DesignShell::Core.new(context)
106
+ ds.ensure_repo_open.commit
107
+ end
108
+ end
109
+
110
+ desc 'Describe build here'
111
+ arg_name 'Describe arguments to build here'
112
+ command :build do |c|
113
+ c.action do |global_options,options,args|
114
+ response = POpen4::shell('middleman build')
115
+ puts result[:stdout]
116
+ end
117
+ end
118
+
119
+
120
+ #desc 'List tasks'
121
+ #long_desc <<EOS
122
+ #List the tasks in your task list, possibly including completed tasks. By default, this will list
123
+ #all uncompleted tasks.
124
+ #EOS
125
+ #command [:list,:ls] do |c|
126
+ #
127
+ # c.desc 'List all tasks, including completed ones'
128
+ # c.command :all do |all|
129
+ # all.action do
130
+ # say 'list all'
131
+ # end
132
+ # end
133
+ #
134
+ # c.default_command :all
135
+ #end
136
+
137
+ # download existing repo : ds clone git://somegitrepo
138
+ # server side repo clone : ds fork
139
+
140
+ # ds git ... # talk directly to git
141
+ # ds middleman # talk directly to middleman
142
+
143
+
144
+ # ds pull git://somegitrepo # if no local repo, will ask "Do you wish to a) clone somegitrepo into a new folder /asds/dsa/somegitrepo or b) pull changes, except that you aren't inside a repo and haven't specified one"
145
+ # ds fork git://somegitrepo
146
+
147
+
148
+ #desc 'Describe clone here'
149
+ #arg_name 'Describe arguments to clone here'
150
+ #command :clone do |c|
151
+ # c.action do |global_options,options,args|
152
+ # puts "clone command ran"
153
+ # end
154
+ #end
155
+ #
156
+ #pre do |global,command,options,args|
157
+ # # Pre logic here
158
+ # # Return true to proceed; false to abourt and not call the
159
+ # # chosen command
160
+ # # Use skips_pre before a command to skip this block
161
+ # # on that command only
162
+ # true
163
+ #end
164
+ #
165
+ #post do |global,command,options,args|
166
+ # # Post logic here
167
+ # # Use skips_post before a command to skip this
168
+ # # block on that command only
169
+ #end
170
+ #
171
+ #on_error do |exception|
172
+ # # Error logic here
173
+ # # return false to skip default error handling
174
+ # true
175
+ #end
176
+
177
+ exit run(ARGV)